playwright
playwright copied to clipboard
feat(test): add `URL` field to annotations for hyperlink display
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' });
....
@microsoft-github-policy-service agree
Test results for "tests 1"
17800 passed, 305 skipped :heavy_check_mark::heavy_check_mark::heavy_check_mark:
Merge workflow run.
Test results for "tests 1"
27307 passed, 671 skipped :heavy_check_mark::heavy_check_mark::heavy_check_mark:
Merge workflow run.
Test results for "tests 1"
15 passed :heavy_check_mark::heavy_check_mark::heavy_check_mark:
Merge workflow run.
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.
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?
thanks @osohyun0224 for your change, will this change also fix https://github.com/microsoft/playwright/issues/30140 ? or that's a separate issue
@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.