Skip to content

feat(ui-mode): update individual snapshots - #42421

Open
Devin Rousso (dcrousso) wants to merge 1 commit into
microsoft:mainfrom
dcrousso:fix-42393
Open

Devin Rousso (dcrousso) wants to merge 1 commit into
microsoft:mainfrom
dcrousso:fix-42393

Conversation

@dcrousso

Copy link
Copy Markdown
Contributor

reviewing image diffs currently requires rerunning tests with snapshot updates enabled

add a button for each diff that copies the actual image over the expected snapshot

fixes #42393

@dcrousso

This comment was marked as outdated.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

Hi, I'm the Playwright bot and I took a first look at the CI failures here.

🟢 CI is clear — the one failure is a pre-existing flake

The single failure, [firefox] › mcp/cli-core.spec.ts:123 › select, is a known flake: the same test failed on the same mcp-windows-latest-firefox bot on an unrelated push SHA (610977b), and timed out on chromium/chrome on other SHAs/PRs. This PR only touches UI-mode snapshot-update code, which the MCP select tool doesn't exercise.

Details

Overall: nothing in this diff reaches the failing paths. The PR adds a "Save actual as expected" button in trace-viewer plus an updateSnapshot test-server endpoint (testServer.ts, testServerInterface.ts, attachmentsTab.tsx, uiModeTraceView.tsx, workbench.tsx). None of that is loaded by the MCP CLI or the library/page tests below.

Pre-existing flake / infra

  • [firefox] › mcp/cli-core.spec.ts:123 › select — pre-existing flake. In the test-results DB this test has failed/timed out on SHAs this PR can't be responsible for: firefox on push SHA 610977b (run 30020951381), chromium timedOut on push SHA 3e14efd (run 30034115836), and chrome timedOut on PR feat(trace): load trace files independently, produce a single context entry #42350 (run 32489690957). Firefox alone is green in 722 of 724 runs. The MCP browser_select path is untouched by this PR.

Not failures (no action)

  • The "tests 1" report lists 3 flaky, 0 failed — within-run flakes rescued on retry, all with long flake histories (e.g. firefox-page › page-goto.spec.ts:90 › should work with Cross-Origin-Opener-Policy rescued 302 times; page-event-request.spec.ts:181 › ...COOP... rescued 373 times; chromium.spec.ts:436 › Service Worker (advanced) rescued 239 times). Nothing to triage.

I'm a first pass, not the final word — but I couldn't find any failure that points back at this change.

Triaged by the Playwright bot - agent run

@dgozman

Copy link
Copy Markdown
Collaborator

There have been multiple attempts at this functionality (some examples: #12707, #14883, #24310, #28415) that never landed, so I'd recommend to first research what went wrong with previous attempts.

@pavelfeldman

Copy link
Copy Markdown
Member

Requesting a demo of this one, unclear from the code what is happening and which scenarios this supports.

@dcrousso
Devin Rousso (dcrousso) force-pushed the fix-42393 branch 2 times, most recently from c38f708 to 7308b9e Compare August 28, 2026 18:39
@dcrousso

Copy link
Copy Markdown
Contributor Author

before
Screenshot 2026-08-28 at 12 26 16

after
Screenshot 2026-08-28 at 12 25 21

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

</div>;
};

function UpdateSnapshotButton({ actualPath, expectedPath, onUpdateSnapshot }: {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think we agreed to flash a green checkmark instead of updating the text?

/>;
};

function addLocalAttachmentPaths(model: TraceModel, result: reporterTypes.TestResult) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What's going on here? Why don't we have correct attachment paths? Why do we only call before a single setModel(), and not before all the others?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ive reworked this

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Unfortunately, that did not make it clear. My questions still stand - what's going on, why do we need to correct attachment paths, do we get wrong paths there? I'd like to understand and, hopefully, fix the root cause of wrong attachment paths.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ah my apologies yes i shouldve been clearer

the completed trace intentionally replaces each local path with a generic file reference when it embeds the attachment into trace.zip

UI Mode renders the attachment from that archived file, but saving the actual image still needs the original local source and destination paths

TestResult.attachments retains those local paths, so the new code keeps a separate map between each trace attachment and its corresponding local path without mutating TraceModel

note that this is only needed for handling a completed trace because live traces have not been archived yet and still contain their local paths

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

reviewing image diffs in UI Mode requires rerunning tests with snapshot updates enabled

add a button beside each diff to save its actual image as the expected snapshot

resolve paths from registered attachments and reject ambiguous or stale saves
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@pavelfeldman

Copy link
Copy Markdown
Member

I'll archive due to no activity

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

1 failed
❌ [firefox-library] › library/browsercontext-storage-state.spec.ts:453 › should work when service worker is intefering and the origin is not open @firefox-ubuntu-22.04-node20

8 flaky ⚠️ [chromium-library] › library/video.spec.ts:699 › screencast › should capture full viewport on hidpi `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/chromium/chromium.spec.ts:373 › should produce network events, routing, and annotations for Service Worker `@realtime-time-library-chromium-linux`
⚠️ [chromium-library] › library/video.spec.ts:736 › screencast › should work with video+trace `@realtime-time-library-chromium-linux`
⚠️ [chromium-page] › page/workers.spec.ts:191 › should attribute network activity for worker inside iframe to the iframe `@realtime-time-library-chromium-linux`
⚠️ [chromium-library] › library/video.spec.ts:699 › screencast › should capture full viewport on hidpi `@chromium-ubuntu-22.04-node24`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:257 › third party 'Partitioned;' cookies `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:470 › top level 'Partitioned;' cookie and same origin iframe `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-page] › page/page-emulate-media.spec.ts:144 › should keep reduced motion and color emulation after reload `@firefox-ubuntu-22.04-node20`

51761 passed, 1247 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

🟢 The one failure is broken on main, not caused by this PR

Hi, I'm the Playwright bot and I took a look at the CI failures here.

[firefox-library] › browsercontext-storage-state.spec.ts:453 is failing on main too — it has failed 44 of 44 runs across 12 different SHAs in the CI results DB, with zero passes on any Firefox bot. Nothing in this PR touches it.

Details

This PR only touches UI mode / trace viewer (attachmentsTab, uiModeTraceView, workbench) and the test server RPC for updating snapshots. None of that is loaded by library tests.

Pre-existing failure (not this PR)

  • [firefox-library] › library/browsercontext-storage-state.spec.ts:453 › should work when service worker is intefering and the origin is not open — not even a flake, it's a hard breakage on main. Run history for firefox-ubuntu-22.04-node20, oldest first:

    🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥

    It also fails on firefox-windows-latest, firefox-macos-15-large, firefox-macos-15-xlarge and tracing-firefox on unrelated main SHAs (e.g. 500c9c82, 249916f0, 4dc79d4a, a9da2dbe) and on other PRs (fix(storage): preserve IndexedDB Map and Set values #42707, feat(evaluate): opt in to Map and Set serialization #42709). Every attempt fails, retries included. The assertion picks up an extra cookie written by the service worker:

    expect(received).toEqual(expected)
    +   Object { "name": "fromServiceWorker", "value": "yes" }
    

    Looks like a Firefox service-worker cookie-visibility change, worth a separate issue.

Flaky, all unrelated

The 8 flaky results (video screencast, third-party partitioned cookies, worker network attribution, emulate-media) all passed on retry and are in browser-level code this PR doesn't touch.

Triaged by the Playwright bot - agent run

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

8564 passed, 1446 skipped


Merge workflow run.

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]: Update snapshot sticky header in UI Mode Attachments panel

3 participants