fix(merge): preserve static annotations on the tests that did not run (#30348)
Fixes https://github.com/microsoft/playwright/issues/30260
This commit is contained in:
parent
2b5488902a
commit
1ef85015f3
|
|
@ -69,6 +69,7 @@ export type JsonTestCase = {
|
||||||
retries: number;
|
retries: number;
|
||||||
tags?: string[];
|
tags?: string[];
|
||||||
repeatEachIndex: number;
|
repeatEachIndex: number;
|
||||||
|
annotations?: { type: string, description?: string }[];
|
||||||
};
|
};
|
||||||
|
|
||||||
export type JsonTestEnd = {
|
export type JsonTestEnd = {
|
||||||
|
|
@ -391,6 +392,7 @@ export class TeleReporterReceiver {
|
||||||
test.location = this._absoluteLocation(payload.location);
|
test.location = this._absoluteLocation(payload.location);
|
||||||
test.retries = payload.retries;
|
test.retries = payload.retries;
|
||||||
test.tags = payload.tags ?? [];
|
test.tags = payload.tags ?? [];
|
||||||
|
test.annotations = payload.annotations ?? [];
|
||||||
return test;
|
return test;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -208,6 +208,7 @@ export class TeleReporterEmitter implements ReporterV2 {
|
||||||
retries: test.retries,
|
retries: test.retries,
|
||||||
tags: test.tags,
|
tags: test.tags,
|
||||||
repeatEachIndex: test.repeatEachIndex,
|
repeatEachIndex: test.repeatEachIndex,
|
||||||
|
annotations: test.annotations,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1752,3 +1752,46 @@ test('open blob-1.42', async ({ runInlineTest, mergeReports }) => {
|
||||||
> webkit > example.spec.ts > test 6
|
> webkit > example.spec.ts > test 6
|
||||||
> webkit > example.spec.ts > describe 1 > test 5`);
|
> webkit > example.spec.ts > describe 1 > test 5`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('preserve static annotations when tests did not run', async ({ runInlineTest, mergeReports, showReport, page }) => {
|
||||||
|
test.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/30260' });
|
||||||
|
const reportDir = test.info().outputPath('blob-report');
|
||||||
|
const files = {
|
||||||
|
'playwright.config.ts': `
|
||||||
|
module.exports = {
|
||||||
|
reporter: 'blob',
|
||||||
|
projects: [
|
||||||
|
{ name: 'setup', testMatch: 'setup.js' },
|
||||||
|
{ name: 'tests', testMatch: /.*test.js/, dependencies: ['setup'] },
|
||||||
|
]
|
||||||
|
};
|
||||||
|
`,
|
||||||
|
'setup.js': `
|
||||||
|
import { test, expect } from '@playwright/test';
|
||||||
|
test('setup', { annotation: [{ type: "sample", description: "uno" }] }, async ({}) => {
|
||||||
|
expect(1).toBe(2);
|
||||||
|
});
|
||||||
|
`,
|
||||||
|
'a.test.js': `
|
||||||
|
import { test, expect } from '@playwright/test';
|
||||||
|
test('first', { annotation: [{ type: "sample", description: "uno" }] }, async ({}) => {});
|
||||||
|
test.skip('second', { annotation: [{ type: "sample", description: "dos" }] }, async ({}) => {});
|
||||||
|
`
|
||||||
|
};
|
||||||
|
await runInlineTest(files);
|
||||||
|
const { exitCode } = await mergeReports(reportDir, { 'PW_TEST_HTML_REPORT_OPEN': 'never' }, { additionalArgs: ['--reporter', 'html'] });
|
||||||
|
expect(exitCode).toBe(0);
|
||||||
|
await showReport();
|
||||||
|
// Check first annotation.
|
||||||
|
{
|
||||||
|
await page.getByRole('link', { name: 'first' }).click();
|
||||||
|
await expect(page.getByText('sample: uno')).toBeVisible();
|
||||||
|
await page.goBack();
|
||||||
|
}
|
||||||
|
// Check second annotation.
|
||||||
|
{
|
||||||
|
await page.getByRole('link', { name: 'second' }).click();
|
||||||
|
await expect(page.getByText('sample: dos')).toBeVisible();
|
||||||
|
await page.goBack();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue