feat(test): add URL field to annotations for hyperlink display (#30665)

This commit is contained in:
오소현 2024-05-22 04:46:38 +09:00 committed by GitHub
parent 47185b743b
commit 165ecac5df
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 24 additions and 8 deletions

View file

@ -71,7 +71,8 @@ import { test, expect } from '@playwright/test';
test('basic test', { test('basic test', {
annotation: { annotation: {
type: 'issue', type: 'issue',
description: 'https://github.com/microsoft/playwright/issues/23180', description: 'feature tags API',
url: 'https://github.com/microsoft/playwright/issues/23180'
}, },
}, async ({ page }) => { }, async ({ page }) => {
await page.goto('https://playwright.dev/'); await page.goto('https://playwright.dev/');
@ -97,7 +98,8 @@ Test title.
- `tag` ?<[string]|[Array]<[string]>> - `tag` ?<[string]|[Array]<[string]>>
- `annotation` ?<[Object]|[Array]<[Object]>> - `annotation` ?<[Object]|[Array]<[Object]>>
- `type` <[string]> Annotation type, for example `'issue'`. - `type` <[string]> Annotation type, for example `'issue'`.
- `description` ?<[string]> Optional annotation description, for example an issue url. - `description` ?<[string]> Optional annotation description.
- `url` ?<[string]> Optional for example an issue url.
Additional test details. Additional test details.
@ -440,6 +442,7 @@ Group title.
- `annotation` ?<[Object]|[Array]<[Object]>> - `annotation` ?<[Object]|[Array]<[Object]>>
- `type` <[string]> - `type` <[string]>
- `description` ?<[string]> - `description` ?<[string]>
- `url` ?<[string]>
Additional details for all tests in the group. Additional details for all tests in the group.
@ -568,6 +571,7 @@ Group title.
- `annotation` ?<[Object]|[Array]<[Object]>> - `annotation` ?<[Object]|[Array]<[Object]>>
- `type` <[string]> - `type` <[string]>
- `description` ?<[string]> - `description` ?<[string]>
- `url` ?<[string]>
See [`method: Test.describe`] for details description. See [`method: Test.describe`] for details description.
@ -623,6 +627,7 @@ Group title.
- `annotation` ?<[Object]|[Array]<[Object]>> - `annotation` ?<[Object]|[Array]<[Object]>>
- `type` <[string]> - `type` <[string]>
- `description` ?<[string]> - `description` ?<[string]>
- `url` ?<[string]>
See [`method: Test.describe`] for details description. See [`method: Test.describe`] for details description.
@ -676,6 +681,7 @@ Group title.
- `annotation` ?<[Object]|[Array]<[Object]>> - `annotation` ?<[Object]|[Array]<[Object]>>
- `type` <[string]> - `type` <[string]>
- `description` ?<[string]> - `description` ?<[string]>
- `url` ?<[string]>
See [`method: Test.describe`] for details description. See [`method: Test.describe`] for details description.
@ -727,6 +733,7 @@ Group title.
- `annotation` ?<[Object]|[Array]<[Object]>> - `annotation` ?<[Object]|[Array]<[Object]>>
- `type` <[string]> - `type` <[string]>
- `description` ?<[string]> - `description` ?<[string]>
- `url` ?<[string]>
See [`method: Test.describe`] for details description. See [`method: Test.describe`] for details description.
@ -782,6 +789,7 @@ Group title.
- `annotation` ?<[Object]|[Array]<[Object]>> - `annotation` ?<[Object]|[Array]<[Object]>>
- `type` <[string]> - `type` <[string]>
- `description` ?<[string]> - `description` ?<[string]>
- `url` ?<[string]>
See [`method: Test.describe`] for details description. See [`method: Test.describe`] for details description.
@ -839,6 +847,7 @@ Group title.
- `annotation` ?<[Object]|[Array]<[Object]>> - `annotation` ?<[Object]|[Array]<[Object]>>
- `type` <[string]> - `type` <[string]>
- `description` ?<[string]> - `description` ?<[string]>
- `url` ?<[string]>
See [`method: Test.describe`] for details description. See [`method: Test.describe`] for details description.
@ -891,6 +900,7 @@ Group title.
- `annotation` ?<[Object]|[Array]<[Object]>> - `annotation` ?<[Object]|[Array]<[Object]>>
- `type` <[string]> - `type` <[string]>
- `description` ?<[string]> - `description` ?<[string]>
- `url` ?<[string]>
See [`method: Test.describe`] for details description. See [`method: Test.describe`] for details description.
@ -1109,6 +1119,7 @@ Test title.
- `annotation` ?<[Object]|[Array]<[Object]>> - `annotation` ?<[Object]|[Array]<[Object]>>
- `type` <[string]> - `type` <[string]>
- `description` ?<[string]> - `description` ?<[string]>
- `url` ?<[string]>
See [`method: Test.(call)`] for test details description. See [`method: Test.(call)`] for test details description.
@ -1214,6 +1225,7 @@ Test title.
- `annotation` ?<[Object]|[Array]<[Object]>> - `annotation` ?<[Object]|[Array]<[Object]>>
- `type` <[string]> - `type` <[string]>
- `description` ?<[string]> - `description` ?<[string]>
- `url` ?<[string]>
See [`method: Test.(call)`] for test details description. See [`method: Test.(call)`] for test details description.
@ -1291,6 +1303,7 @@ Test title.
- `annotation` ?<[Object]|[Array]<[Object]>> - `annotation` ?<[Object]|[Array]<[Object]>>
- `type` <[string]> - `type` <[string]>
- `description` ?<[string]> - `description` ?<[string]>
- `url` ?<[string]>
See [`method: Test.(call)`] for test details description. See [`method: Test.(call)`] for test details description.
@ -1436,6 +1449,7 @@ Test title.
- `annotation` ?<[Object]|[Array]<[Object]>> - `annotation` ?<[Object]|[Array]<[Object]>>
- `type` <[string]> - `type` <[string]>
- `description` ?<[string]> - `description` ?<[string]>
- `url` ?<[string]>
See [`method: Test.(call)`] for test details description. See [`method: Test.(call)`] for test details description.

View file

@ -52,8 +52,8 @@ const testCase: TestCase = {
projectName: 'chromium', projectName: 'chromium',
location: { file: 'test.spec.ts', line: 42, column: 0 }, location: { file: 'test.spec.ts', line: 42, column: 0 },
annotations: [ annotations: [
{ type: 'annotation', description: 'Annotation text' }, { type: 'annotation', description: 'Annotation text', url: 'example url' },
{ type: 'annotation', description: 'Another annotation text' }, { type: 'annotation', description: 'Another annotation text', url: 'Another example url' },
], ],
tags: [], tags: [],
outcome: 'expected', outcome: 'expected',

View file

@ -59,7 +59,7 @@ export type TestFileSummary = {
stats: Stats; stats: Stats;
}; };
export type TestCaseAnnotation = { type: string, description?: string }; export type TestCaseAnnotation = { type: string, description?: string, url?: string};
export type TestCaseSummary = { export type TestCaseSummary = {
testId: string, testId: string,

View file

@ -35,7 +35,7 @@ export type FixturesWithLocation = {
fixtures: Fixtures; fixtures: Fixtures;
location: Location; location: Location;
}; };
export type Annotation = { type: string, description?: string }; export type Annotation = { type: string, description?: string, url?: string };
export const defaultTimeout = 30000; export const defaultTimeout = 30000;

View file

@ -2156,7 +2156,8 @@ interface TestFunction<TestArgs> {
* test('basic test', { * test('basic test', {
* annotation: { * annotation: {
* type: 'issue', * type: 'issue',
* description: 'https://github.com/microsoft/playwright/issues/23180', * description: 'feature tags API',
* url: 'https://github.com/microsoft/playwright/issues/23180'
* }, * },
* }, async ({ page }) => { * }, async ({ page }) => {
* await page.goto('https://playwright.dev/'); * await page.goto('https://playwright.dev/');
@ -2232,7 +2233,8 @@ interface TestFunction<TestArgs> {
* test('basic test', { * test('basic test', {
* annotation: { * annotation: {
* type: 'issue', * type: 'issue',
* description: 'https://github.com/microsoft/playwright/issues/23180', * description: 'feature tags API',
* url: 'https://github.com/microsoft/playwright/issues/23180'
* }, * },
* }, async ({ page }) => { * }, async ({ page }) => {
* await page.goto('https://playwright.dev/'); * await page.goto('https://playwright.dev/');