Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged

Conversation

osohyun0224
Copy link
Contributor

@osohyun0224 osohyun0224 commented May 5, 2024

related issue: #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 #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 and others added 2 commits May 5, 2024 20:41
The 'url' field is added to the test annotations to provide a distinct way to store links alongside descriptions. This change allows annotations to include URLs for improved clarity and direct linking, which enhances test report organization.

References: microsoft#30095
@osohyun0224
Copy link
Contributor Author

@microsoft-github-policy-service agree

Comment on lines 8124 to 8126
/**
* Optional URL to provide additional context or link to an issue tracker.
*/

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/**
* Optional URL to provide additional context or link to an issue tracker.
*/
/**
* Optional URL to provide additional context or link to an issue tracker.
*/

This comment has been minimized.

This comment has been minimized.

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.

This comment has been minimized.

Copy link
Contributor

github-actions bot commented May 5, 2024

Test results for "tests 1"

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

27306 passed, 671 skipped
✔️✔️✔️

Merge workflow run.

@pavelfeldman pavelfeldman merged commit 165ecac into microsoft:main May 21, 2024
29 of 30 checks passed
@pavelfeldman
Copy link
Member

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?

@saurabhdes
Copy link

thanks @osohyun0224 for your change, will this change also fix #30140 ? or that's a separate issue

@osohyun0224
Copy link
Contributor Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: Show URL's within annotations as hyperlink
4 participants