feat(test) : html report with the url annotation field rendered.

This commit is contained in:
osohyun0224 2024-06-09 14:57:50 +09:00
parent 1b4cd4d29b
commit e8fc8af22e

View file

@ -724,7 +724,27 @@ for (const useIntermediateMergeReport of [false] as const) {
'a.test.js': ` 'a.test.js': `
import { test, expect } from '@playwright/test'; import { test, expect } from '@playwright/test';
test('annotated test', async ({ page }) => { test('annotated test', async ({ page }) => {
test.info().annotations.push({ type: 'issue', description: 'I am not interested in this test' }); test.info().annotations.push({ type: 'issue', description: 'I am not interested in this test' });
});
`,
}, { reporter: 'dot,html' }, { PLAYWRIGHT_HTML_OPEN: 'never' });
expect(result.exitCode).toBe(0);
expect(result.passed).toBe(1);
await showReport();
await page.click('text=annotated test');
await expect(page.locator('.test-case-annotation')).toHaveText('issue: I am not interested in this test');
});
test('should render annotations with url', async ({ runInlineTest, page, showReport }) => {
const result = await runInlineTest({
'playwright.config.js': `
module.exports = { timeout: 1500 };
`,
'a.test.js': `
import { test, expect } from '@playwright/test';
test('annotated test', async ({ page }) => {
test.info().annotations.push({ type: 'issue', description: 'I add URL field to annotations for hyperlink display', url: 'https://github.com/microsoft/playwright/pull/31014' });
}); });
`, `,
}, { reporter: 'dot,html' }, { PLAYWRIGHT_HTML_OPEN: 'never' }); }, { reporter: 'dot,html' }, { PLAYWRIGHT_HTML_OPEN: 'never' });