Uh oh!
There was an error while loading. Please reload this page.
Feat: Added a copy to clipboard feature for copying the test id. - #977
Feat: Added a copy to clipboard feature for copying the test id.#977Ambuj03 wants to merge 3 commits into
Conversation
| data-test-id="{test_id}" | ||
| title="Copy test ID" | ||
| aria-label="Copy test ID"> | ||
| <svg xmlns="http://www.w3.org/2000/svg" |
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
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.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.

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.