Feat: Added a copy to clipboard feature for copying the test id.#977
Open
Ambuj03 wants to merge 3 commits intopytest-dev:masterfrom
Open
Feat: Added a copy to clipboard feature for copying the test id.#977Ambuj03 wants to merge 3 commits intopytest-dev:masterfrom
Ambuj03 wants to merge 3 commits intopytest-dev:masterfrom
Conversation
| data-test-id="{test_id}" | ||
| title="Copy test ID" | ||
| aria-label="Copy test ID"> | ||
| <svg xmlns="http://www.w3.org/2000/svg" |
Member
There was a problem hiding this comment.
how feasible is it to use U+1F4CB instead of the svg - i'd much prefer the character - but i have no idea how well supported that is
Author
There was a problem hiding this comment.
Pull request overview
This PR adds a “copy test id to clipboard” affordance to the pytest-html results table, allowing users to quickly copy a test’s nodeid from the report UI.
Changes:
- Adds a copy button next to the rendered test id in the results table HTML.
- Binds a click handler in the report JS to copy the test id to the clipboard and apply a brief “copied” visual state.
- Adds styling for the new copy button in both the generated CSS and the SCSS source.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/pytest_html/scripts/main.js |
Attaches click handling for the new copy button and implements clipboard write behavior. |
src/pytest_html/resources/style.css |
Adds button styling for the copy-to-clipboard UI in the shipped CSS. |
src/pytest_html/basereport.py |
Emits the new copy button markup in the “Test ID” results table cell. |
src/layout/css/style.scss |
Adds button styling in the SCSS source (presumably compiled into the shipped CSS). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

As I suggested in discussions #976.
I have tried to add this little feature, Please give the feedback.
Will be happy to make any required changes.