Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/playwright/src/reporters/line.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class LineReporter extends TerminalReporter {
}

private _updateLine(test: TestCase, result: TestResult, step?: TestStep) {
const retriesPrefix = this.totalTestCount < this._current ? ` (retries)` : ``;
const retriesPrefix = result.retry ? ` (retries)` : ``;
const prefix = `[${this._current}/${this.totalTestCount}]${retriesPrefix} `;
const currentRetrySuffix = result.retry ? this.screen.colors.yellow(` (retry #${result.retry})`) : '';
const title = this.formatTestTitle(test, step) + currentRetrySuffix;
Expand Down
2 changes: 1 addition & 1 deletion tests/page/page-basic.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ it('page.title should not throw during navigation', async ({ page, server }) =>
promise,
]);
expect(typeof titleOrError).toBe('string');
expect(titleOrError).toMatch(/^(Loading http.*title.html|hello|Woof-Woof)$/);
expect(titleOrError).toMatch(/^(hello|Loading http.*title.html||Woof-Woof)$/);
await expect(page).toHaveTitle('Woof-Woof');
});

Expand Down
20 changes: 20 additions & 0 deletions tests/playwright-test/reporter-line.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,26 @@ for (const useIntermediateMergeReport of [false, true] as const) {
expect(result.exitCode).toBe(1);
});

test('should not label passing tests as retries', async ({ runInlineTest }) => {
const result = await runInlineTest({
'a.test.js': `
const { test, expect } = require('@playwright/test');
test('failing', async ({}) => {
expect(1).toBe(0);
});
test('passing', async ({}) => {
expect(1).toBe(1);
});
`,
}, { retries: 1, reporter: 'line' });
const text = result.output;
expect(text).toContain('[1/2] a.test.js:3:11 › failing');
expect(text).toContain('a.test.js:3:11 › failing (retry #1)');
expect(text).toContain('[3/2] a.test.js:6:11 › passing');
expect(text).not.toContain('(retries) a.test.js:6:11 › passing');
expect(result.exitCode).toBe(1);
});

test('render flaky', async ({ runInlineTest }) => {
const result = await runInlineTest({
'a.test.js': `
Expand Down
Loading