Skip to content

Conversation

@rassie
Copy link

@rassie rassie commented Nov 24, 2025

Note: this patch in its original form has been lingering on my disk for about a year and has been successfully used in my work projects. To make it PR-ready, I've used Claude Code's assistance to add tests and do a general review and clean up. I've made every effort to re-review the code manually and I think it's in good shape; nevertheless, I consider this PR a discussion starter. It works for me, but as always, there are probably things that have been overlooked and need correcting.

Summary

This PR adds snapshot acceptance functionality to UI Mode, allowing developers to accept snapshot updates directly from the UI without switching to the command line and running --update-snapshots.

Features

  • Per-test/file/directory buttons: Accept snapshots for specific scope
  • Global "Accept all" button: Accept all failing snapshots at once
  • Smart visibility: Buttons only appear when snapshot errors exist
  • Immediate feedback: Toast notification with acceptance status
  • Works while tests run: Snapshots can be accepted even during test execution

Screenshot

image

Related Issues

Fixes #24310

Add ability to accept snapshot updates directly from UI mode:

- Add "Accept snapshots" button per test/group when snapshot errors are present
- Add "Accept all snapshots" button in toolbar to accept all snapshot errors at once
- Implement acceptSnapshots API in test server to copy actual to expected snapshots
- Support both screenshot snapshots (via attachments) and text snapshots (via matcherResult)
- Show compact toast notification with slide-in animation and click-to-dismiss
- Execute snapshot acceptance immediately (not queued) to work while tests are running
- Hide buttons when no snapshot errors present instead of showing disabled state
- Add comprehensive test coverage for the new API

This allows developers to quickly update snapshots from failed tests without
switching to the command line, improving the UI mode workflow.
@rassie
Copy link
Author

rassie commented Nov 24, 2025

@microsoft-github-policy-service agree

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] "Accept new snapshot" button in html-reporter / UI Mode

1 participant