fix(test-runner): don't add slow annotation twice (#31414)

This commit is contained in:
Max Schmitt 2024-06-24 23:34:17 +02:00 committed by GitHub
parent 2b12f53332
commit 47fb9a080d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 26 additions and 1 deletions

View File

@ -261,7 +261,7 @@ export class WorkerMain extends ProcessRunner {
testInfo.expectedStatus = 'failed';
break;
case 'slow':
testInfo.slow();
testInfo._timeoutManager.slow();
break;
}
};

View File

@ -690,3 +690,28 @@ test('static modifiers should be added in serial mode', async ({ runInlineTest }
expect(result.report.suites[0].specs[2].tests[0].annotations).toEqual([{ type: 'skip' }]);
expect(result.report.suites[0].specs[3].tests[0].annotations).toEqual([]);
});
test('should contain only one slow modifier', async ({ runInlineTest }) => {
const result = await runInlineTest({
'slow.test.ts': `
import { test } from '@playwright/test';
test.slow();
test('pass', { annotation: { type: 'issue', description: 'my-value' } }, () => {});
`,
'skip.test.ts': `
import { test } from '@playwright/test';
test.skip();
test('pass', { annotation: { type: 'issue', description: 'my-value' } }, () => {});
`,
'fixme.test.ts': `
import { test } from '@playwright/test';
test.fixme();
test('pass', { annotation: { type: 'issue', description: 'my-value' } }, () => {});
`,
});
expect(result.exitCode).toBe(0);
expect(result.passed).toBe(1);
expect(result.report.suites[0].specs[0].tests[0].annotations).toEqual([{ type: 'fixme' }, { type: 'issue', description: 'my-value' }]);
expect(result.report.suites[1].specs[0].tests[0].annotations).toEqual([{ type: 'skip' }, { type: 'issue', description: 'my-value' }]);
expect(result.report.suites[2].specs[0].tests[0].annotations).toEqual([{ type: 'slow' }, { type: 'issue', description: 'my-value' }]);
});