Repository navigation
test(webview): use the real VS Code toolkit in Playwright visual baselines - #2163
Conversation
The gallery vite config resolved @vscode/webview-ui-toolkit/react to the Vitest mock for every story except realToolkitImporters (only the Ollama story). The mock draws a plain input with the label after the field, so baselines showing toolkit components did not look like the extension, which renders the real custom elements with the label above the field, padding, and borders. Drop the playwright-gallery-toolkit-mock plugin so every story imports the real toolkit, and keep pre-bundling it via optimizeDeps.include so a cold Vite cache does not re-optimize and reload mid-test. The Vitest mock stays in place for unit tests.
Baselines for the nine stories that render toolkit components, captured by the pinned mcr.microsoft.com/playwright:v1.62.1-noble container via the Visual Regression workflow: auto-approve settings, Bedrock custom ARN, empty history, IO Intelligence, OpenAI-compatible Azure guidance and extra body, telemetry banner, terminal settings, and UI settings. The real toolkit draws text-field labels above their inputs and gives checkboxes, textareas, links, and buttons the extension's borders and padding, so these baselines now match what users see.
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one): 1
Please check the settings in the CodeRabbit UI or the
|
|
No code issues found. The gallery vite config change is clean, and the 26 regenerated baselines are consistent with the pinned-container Reviewed 4e740da |
Review statusThis PR was opened by an automated account. A human maintainer must verify the change intent, provenance, and validation before merging. Current step: The required review sequence passed. Remaining merge requirements apply. Review-state labels are managed by this workflow; do not edit them manually. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Zoo-Code-Org#2122 (task rename) and Zoo-Code-Org#2160 (OpenCode Go temperature) added these baselines against the mocked toolkit; Zoo-Code-Org#2163 switched the gallery to the real VS Code toolkit without regenerating them. Rendered in the CI Playwright image (v1.62.1-noble). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Regenerate the five baselines that #2163 left on the mocked toolkit rendering: history-rename-editor in all four themes and opencode-go-temperature. Captured by the pinned mcr.microsoft.com/playwright:v1.62.1-noble container via the Visual Regression workflow on this branch. The real toolkit places the search field's icon inline inside the field and renders the custom-temperature checkbox inline with its label (480x359 -> 480x340), matching the intended appearance from #2163. Fixes #2206
…Org#2209) * test(webview): refresh stale toolkit baselines missed by Zoo-Code-Org#2163 Regenerate the five baselines that Zoo-Code-Org#2163 left on the mocked toolkit rendering: history-rename-editor in all four themes and opencode-go-temperature. Captured by the pinned mcr.microsoft.com/playwright:v1.62.1-noble container via the Visual Regression workflow on this branch. The real toolkit places the search field's icon inline inside the field and renders the custom-temperature checkbox inline with its label (480x359 -> 480x340), matching the intended appearance from Zoo-Code-Org#2163. Fixes Zoo-Code-Org#2206 * ci(webview): drop pull_request path filter from Visual Regression The Protect Main ruleset should require the webview-visual check. GitHub keeps path-filtered workflows in a pending state on pull requests that do not match the filter, so a required check would block those PRs from merging. Remove the pull_request paths filter so webview-visual, theme-fixtures, and extension-host-visual report on every pull request, like code-qa and e2e already do. The merge_group event ignores path filters, so merge-queue runs are unchanged. --------- Co-authored-by: Roomote <[email protected]>
…iff default Required check webview-visual is red on this branch, and the last push did cause it. Job 141454402633 on head f4e769d completed with failure, and job 141112808655 on the previous head 8365bf8 had already completed with failure. Both failing heads carry the same experiment default change. The CI run summary is 4 failed and 110 passed, with all four failures inside the experimental settings theme matrix and nothing else failing. First failure verbatim. The locator line is paraphrased, because in the CI annotation it carries apostrophes that a quote free message cannot hold: 4) [chromium] ExperimentalSettings.visual.tsx:6:2 renders the experimental settings section in the VS Code high-contrast-light theme Error: expect(locator).toHaveScreenshot(expected) failed Locator: root element scoped to the direct playwright mounted child, then filtered by test id experimental-settings-story 4 pixels (ratio 0.01 of all image pixels) are different. Snapshot: experimental-settings-high-contrast-light.png Cause, category ii, this pull request changed what the story renders. Commit da7fc3a flips PREVENT_FOCUS_DISRUPTION in src/shared/experiments.ts from enabled false to enabled true. The story fixture spreads experimentDefault from that same module through the @roo alias, and ExperimentalFeature renders a VSCodeCheckbox whose checked state is that value, so the Background editing row now renders checked. The unit test this branch adds pins exactly that default: src/shared/__tests__/experiments-preventFocusDisruption.spec.ts line 14 asserts experimentDefault.preventFocusDisruption is true. The four baselines were last written by 332d30f and nothing touched them after that, so they still draw the old default. No upstream drift is involved: main added no commit under webview-ui/src/components/settings, the experiment sources or the theme sources after the merge base, and this pull request touches no webview rendering code that this story mounts, because SettingsView is not on the path of the experimental settings story. Pixel forensics, checked image by image. In all four CI captures the difference against the committed baseline is 40 device pixels confined to the box x 39 to 52 and y 100 to 111, which is the checkbox glyph of the Background editing row. The count and the bounding box are identical for dark, light, high-contrast and high-contrast-light, and every other pixel of the 488 by 589 image is identical. Zoomed crops of the CI capture and of the baseline show the same control, empty in the baseline and ticked in the capture. No control disappears, nothing is added, no label or description text changes, and the Dynamic thinking effort row stays ticked as the fixture intends. CI reports this as 4 pixels after its own antialiasing tolerance. Why these bytes are the container bytes rather than host bytes. The four new files are byte identical to the actual captures uploaded by job 141454402633. Those captures are byte identical across all three attempts of that job, and they are byte identical to the captures uploaded by job 141112808655 on the older head, so the pinned mcr.microsoft.com/playwright v1.64.1 image renders these four stories the same way on every run. A calibration run with the update flag confirmed that Playwright writes the captured png verbatim into the snapshot path, so taking the captured bytes equals the sanctioned flow, pnpm --dir webview-ui run test:visual:docker:update, executed inside that image. Host rendered bytes would bury a real regression instead: on this Windows machine the same story differs from the container capture by about 33700 pixels, the four themes differ by 33639, 33758, 33753 and 33750 pixels before this change and by exactly 40 fewer after it, and 107 of the 114 visual tests fail locally for that rendering reason alone. No baseline here was written by a host run. Counts. Targeted rerun before the change, 4 failed and 0 passed, at 13590, 12501, 16346 and 10873 differing host pixels. Full local suite before the change, 107 failed and 7 passed. Targeted rerun after the change, 4 failed and 0 passed on this host, holding the same rendering floor, while the container comparison for these four stories now has 0 differing pixels because the baselines are the container capture itself. Expected CI result 0 failed and 114 passed. Precedent for refreshing these baselines in place: 332d30f feat(settings): dynamic thinking effort experimental toggle (DTE-1) (Zoo-Code-Org#1521) wrote these four files, and 8254e11 fix(settings): pin Zoo Gateway provider first (Zoo-Code-Org#2419), d76dffa feat(task-title): auto-generate task titles for new root tasks (Zoo-Code-Org#2398), 5cc5a37 test(webview): use the real VS Code toolkit in Playwright visual baselines (Zoo-Code-Org#2163) and 3b825bf [Fix] Five webview visual tests fail on every pull request (Zoo-Code-Org#2209) refreshed baselines the same way. Gates on these bytes. format check 0, lint with turbo forced 0, check types with turbo forced 0, webview build 0. The first format pass returned 1 only because a local visual run had written webview-ui/test-results, a directory git ignores but prettier does not; with that generated directory removed the check returns 0. The visual rerun exits 1 on this host for the font rendering reason above, not for content, and it is the pinned image that decides the gate. Only the four png files changed. No source file, no story and no production file was touched, so the src eslint suppression counts and the prune report stay unchanged.
Related GitHub Issue
Closes: #2105
Description
The Playwright Story Gallery mocked the VS Code toolkit. Visual baselines rendered the mock, not the real components. Baselines did not match the extension (labels below inputs, no padding or borders).
This PR removes the toolkit mock from the gallery. Every story that uses toolkit components now renders the real components. This extends the approach from PR #1299 (Ollama story) to all stories. It replaces the per-story allowlist, which would need about 60 entries.
Key changes:
Points for careful review:
mainand this branch produce the same 68/5 failure split on a host run. All failures are pre-existing host font-metric pixel noise. No functional failures. No net-new failures from this change.Test Procedure
mainon the host. Record the failure set (68 failed, 5 flaky, all pixel diffs from host font metrics).visual-regression.ymlworkflow. Take the container-rendered actuals as the new baselines.pnpm typecheck. Result: pass.Note: the repository forbids host-generated baselines. All committed baselines come from the pinned CI container.
Pre-Submission Checklist
*.visual.tsxbaselines inwebview-ui/.Visual Snapshots
The primary artifacts are the 26 regenerated committed baselines across 9 stories. Before/after pairs were reviewed during validation: labels move above inputs, and inputs show real toolkit borders and padding.
Videos (interaction / animation only)
Not applicable. No interaction or animation changes.
Documentation Updates
This change is test infrastructure only. It changes no user-facing functionality.
Additional Notes
Baselines were regenerated by the pinned Playwright container through the
visual-regression.ymlworkflow, per the documented fallback for environments without Docker.Get in Touch
Discord: 0x7777777_