From 935ced6e31c43e4b9c6dc291de76540e4908fa87 Mon Sep 17 00:00:00 2001 From: osohyun0224 Date: Sun, 5 May 2024 21:46:54 +0900 Subject: [PATCH] feat(types): add 'url' field to TestCaseAnnotation type Added an optional 'url' field to the TestCaseAnnotation type to support hyperlink functionality within test annotations. This update allows annotations to include URLs, enhancing their utility by providing direct links to related resources or issue trackers. --- docs/src/test-api/class-test.md | 18 ++++++++++++++++-- .../html-reporter/src/testCaseView.spec.tsx | 4 ++-- packages/html-reporter/src/types.ts | 2 +- packages/playwright/types/test.d.ts | 2 +- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/docs/src/test-api/class-test.md b/docs/src/test-api/class-test.md index f00e125215..7013583f2b 100644 --- a/docs/src/test-api/class-test.md +++ b/docs/src/test-api/class-test.md @@ -71,7 +71,8 @@ import { test, expect } from '@playwright/test'; test('basic test', { annotation: { type: 'issue', - description: 'https://github.com/microsoft/playwright/issues/23180', + description: 'featur tags API', + url: 'https://github.com/microsoft/playwright/issues/23180' }, }, async ({ page }) => { await page.goto('https://playwright.dev/'); @@ -97,7 +98,8 @@ Test title. - `tag` ?<[string]|[Array]<[string]>> - `annotation` ?<[Object]|[Array]<[Object]>> - `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. @@ -440,6 +442,7 @@ Group title. - `annotation` ?<[Object]|[Array]<[Object]>> - `type` <[string]> - `description` ?<[string]> + - `url` ?<[string]> Additional details for all tests in the group. @@ -568,6 +571,7 @@ Group title. - `annotation` ?<[Object]|[Array]<[Object]>> - `type` <[string]> - `description` ?<[string]> + - `url` ?<[string]> See [`method: Test.describe`] for details description. @@ -623,6 +627,7 @@ Group title. - `annotation` ?<[Object]|[Array]<[Object]>> - `type` <[string]> - `description` ?<[string]> + - `url` ?<[string]> See [`method: Test.describe`] for details description. @@ -676,6 +681,7 @@ Group title. - `annotation` ?<[Object]|[Array]<[Object]>> - `type` <[string]> - `description` ?<[string]> + - `url` ?<[string]> See [`method: Test.describe`] for details description. @@ -727,6 +733,7 @@ Group title. - `annotation` ?<[Object]|[Array]<[Object]>> - `type` <[string]> - `description` ?<[string]> + - `url` ?<[string]> See [`method: Test.describe`] for details description. @@ -782,6 +789,7 @@ Group title. - `annotation` ?<[Object]|[Array]<[Object]>> - `type` <[string]> - `description` ?<[string]> + - `url` ?<[string]> See [`method: Test.describe`] for details description. @@ -839,6 +847,7 @@ Group title. - `annotation` ?<[Object]|[Array]<[Object]>> - `type` <[string]> - `description` ?<[string]> + - `url` ?<[string]> See [`method: Test.describe`] for details description. @@ -891,6 +900,7 @@ Group title. - `annotation` ?<[Object]|[Array]<[Object]>> - `type` <[string]> - `description` ?<[string]> + - `url` ?<[string]> See [`method: Test.describe`] for details description. @@ -1109,6 +1119,7 @@ Test title. - `annotation` ?<[Object]|[Array]<[Object]>> - `type` <[string]> - `description` ?<[string]> + - `url` ?<[string]> See [`method: Test.(call)`] for test details description. @@ -1214,6 +1225,7 @@ Test title. - `annotation` ?<[Object]|[Array]<[Object]>> - `type` <[string]> - `description` ?<[string]> + - `url` ?<[string]> See [`method: Test.(call)`] for test details description. @@ -1291,6 +1303,7 @@ Test title. - `annotation` ?<[Object]|[Array]<[Object]>> - `type` <[string]> - `description` ?<[string]> + - `url` ?<[string]> See [`method: Test.(call)`] for test details description. @@ -1436,6 +1449,7 @@ Test title. - `annotation` ?<[Object]|[Array]<[Object]>> - `type` <[string]> - `description` ?<[string]> + - `url` ?<[string]> See [`method: Test.(call)`] for test details description. diff --git a/packages/html-reporter/src/testCaseView.spec.tsx b/packages/html-reporter/src/testCaseView.spec.tsx index 28fe8247f5..0a4da91b6e 100644 --- a/packages/html-reporter/src/testCaseView.spec.tsx +++ b/packages/html-reporter/src/testCaseView.spec.tsx @@ -52,8 +52,8 @@ const testCase: TestCase = { projectName: 'chromium', location: { file: 'test.spec.ts', line: 42, column: 0 }, annotations: [ - { type: 'annotation', description: 'Annotation text' }, - { type: 'annotation', description: 'Another annotation text' }, + { type: 'annotation', description: 'Annotation text', url: 'example url' }, + { type: 'annotation', description: 'Another annotation text', url: 'Another example url' }, ], tags: [], outcome: 'expected', diff --git a/packages/html-reporter/src/types.ts b/packages/html-reporter/src/types.ts index 733e88e8b9..79dc2f3812 100644 --- a/packages/html-reporter/src/types.ts +++ b/packages/html-reporter/src/types.ts @@ -59,7 +59,7 @@ export type TestFileSummary = { stats: Stats; }; -export type TestCaseAnnotation = { type: string, description?: string }; +export type TestCaseAnnotation = { type: string, description?: string, url?: string}; export type TestCaseSummary = { testId: string, diff --git a/packages/playwright/types/test.d.ts b/packages/playwright/types/test.d.ts index b9d9b3ff36..74c31bc937 100644 --- a/packages/playwright/types/test.d.ts +++ b/packages/playwright/types/test.d.ts @@ -8120,7 +8120,7 @@ export interface TestInfo { * Optional description. */ description?: string; - + /** * Optional URL to provide additional context or link to an issue tracker. */