playwright icon indicating copy to clipboard operation
playwright copied to clipboard

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

Open osohyun0224 opened this issue 9 months ago • 5 comments

related issue: https://github.com/microsoft/playwright/issues/30095

Description: This pull request introduces the ability to include URL directly within annotations in Playwright tests, enabling the URLs to be displayed as hyperlinks in test reports.

Motivation: Current annotation functionality only allows for text descriptions, which limits the ability to navigate directly to related resources or issue trackers. By integrating a URL field, we provide a more interactive and informative testing environment.

Changes: Added an optional url field to the Annotation type to accommodate URL Updated type definitions and documentation to reflect the addition.

Expected Outcome: With the addition of the url field, annotations can now directly link to URLs, which are displayed as hyperlinks in test reports. This update improves the functionality of test descriptions and enhances the accessibility of related online resources.

References: Closes https://github.com/microsoft/playwright/issues/30095 - "[Feature]: Show URL's within annotations as hyperlink"

Code Check

toggle dropdown

I have written a test to ensure that the changes were applied correctly, and I have verified its functionality through screenshots. I examined whether the test is running as expected by capturing images of the test execution results.

it('should not hang on ctrl-click during provisional load', async ({ context, page, server, isWindows, browserName, isLinux }) => {
  it.info().annotations.push({ type: 'issue', url: 'https://github.com/microsoft/playwright/issues/11595' });
....

image

osohyun0224 avatar May 05 '24 11:05 osohyun0224

@microsoft-github-policy-service agree

osohyun0224 avatar May 05 '24 12:05 osohyun0224

Test results for "tests 1"

17800 passed, 305 skipped :heavy_check_mark::heavy_check_mark::heavy_check_mark:

Merge workflow run.

github-actions[bot] avatar May 05 '24 12:05 github-actions[bot]

Test results for "tests 1"

27307 passed, 671 skipped :heavy_check_mark::heavy_check_mark::heavy_check_mark:

Merge workflow run.

github-actions[bot] avatar May 05 '24 12:05 github-actions[bot]

Test results for "tests 1"

15 passed :heavy_check_mark::heavy_check_mark::heavy_check_mark:

Merge workflow run.

github-actions[bot] avatar May 05 '24 12:05 github-actions[bot]

Test results for "tests 1"

1 failed :x: [installation tests] › playwright-electron-should-work.spec.ts:18:5 › electron should work

27306 passed, 671 skipped :heavy_check_mark::heavy_check_mark::heavy_check_mark:

Merge workflow run.

github-actions[bot] avatar May 05 '24 13:05 github-actions[bot]

This change looks good. Could you follow up with:

  • rendering it in the HTML report and other reports
  • rendering it in the Trace
  • supporting it in the TeleReceiver/Emitter for shard merger?

pavelfeldman avatar May 21 '24 19:05 pavelfeldman

thanks @osohyun0224 for your change, will this change also fix https://github.com/microsoft/playwright/issues/30140 ? or that's a separate issue

saurabhdes avatar May 22 '24 17:05 saurabhdes

@saurabhdes Hello :) I checked your issue, and I think it's an issue related to the newly added feature. I kept the title and description as is and added a new url field. But the functional purpose of your issue is the same ;) I am planning to develop additional features suggested by the maintainer.

osohyun0224 avatar May 23 '24 07:05 osohyun0224