Skip to content

test(webview): use the real VS Code toolkit in Playwright visual baselines - #2163

Merged
edelauna merged 2 commits into
mainfrom
test/webview-gallery-real-toolkit
Oct 26, 2026
Merged

edelauna merged 2 commits into
mainfrom
test/webview-gallery-real-toolkit

Conversation

@zoomote

@zoomote zoomote Bot commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

​Created by Roomote. View the session.

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:

  • Remove the gallery toolkit mock. The Vitest unit-test mock stays unchanged.
  • Regenerate all affected baselines in the pinned Playwright container on CI.
  • 26 baseline diffs across 9 stories. All diffs are expected pixel changes: labels now sit above inputs, and text fields, checkboxes, and links show real toolkit borders and padding.

Points for careful review:

  • Confirm the new baselines match the rendered extension UI.
  • The flaky-test count is unchanged. Unchanged main and 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

  1. Run the full webview visual suite on unchanged main on the host. Record the failure set (68 failed, 5 flaky, all pixel diffs from host font metrics).
  2. Run the same suite on this branch on the host. Confirm the failure set is identical. This proves no net-new failures.
  3. Push the branch and run the pinned-container visual-regression.yml workflow. Take the container-rendered actuals as the new baselines.
  4. Re-run the workflow to verify. Result: all 73 webview visual tests pass in the container. This includes the contrast audits and the layout contracts. The theme-fixture and extension-host visual suites also pass.
  5. Run pnpm typecheck. Result: pass.

Note: the repository forbids host-generated baselines. All committed baselines come from the pinned CI container.

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I reviewed my own code with care.
  • Writing Style: The PR title and description use Simplified Technical English (ASD-STE100): short sentences, plain words, active voice, one idea per sentence, no contractions.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Visual Snapshot (UI changes only): This PR updates the committed *.visual.tsx baselines in webview-ui/.
  • Documentation Impact: I checked if my changes need documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I read and agree to the Contributor Guidelines.

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

  • No documentation updates are required.
  • Yes, documentation updates are required. (Describe what to update, or link to a PR in the docs repository).

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.yml workflow, per the documented fallback for environments without Docker.

Get in Touch

Discord: 0x7777777_

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.
@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one): 1
  • coderabbit-review-active

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@zoomote

zoomote Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor Author

No code issues found. The gallery vite config change is clean, and the 26 regenerated baselines are consistent with the pinned-container webview-visual run that passed on this exact commit. See session

Reviewed 4e740da

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Review status

This 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. community-approved is managed the same way — do not add or remove it manually. It signals a fresh community code approval for the current head as an advisory priority only; maintainer review is still required.

@codecov

codecov Bot commented Oct 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@edelauna
edelauna marked this pull request as ready for review October 26, 2026 02:53
@edelauna
edelauna enabled auto-merge October 26, 2026 02:54
@edelauna
edelauna added this pull request to the merge queue Oct 26, 2026
Merged via the queue into main with commit 5cc5a37 Oct 26, 2026
40 of 41 checks passed
@edelauna
edelauna deleted the test/webview-gallery-real-toolkit branch October 26, 2026 03:19
rrewll added a commit to rrewll/Zoo-Code that referenced this pull request Oct 26, 2026
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]>
zoomote Bot pushed a commit that referenced this pull request Oct 27, 2026
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
edelauna pushed a commit to myk1yt/Zoo-Code that referenced this pull request Oct 28, 2026
…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]>
easonLiangWorldedtech added a commit to easonLiangWorldedtech/Zoo-Code that referenced this pull request Nov 29, 2026
…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.
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.

test(webview): use the real VS Code toolkit in Playwright visual baselines

2 participants