Skip to content

Visual harness: stop print emulation wiping the color-scheme emulation - #2723

Merged
chalin merged 3 commits into
google:mainfrom
chalin:chalin-m24-visual-print-scheme-2026-0818
Aug 18, 2026
Merged

Visual harness: stop print emulation wiping the color-scheme emulation#2723
chalin merged 3 commits into
google:mainfrom
chalin:chalin-m24-visual-print-scheme-2026-0818

Conversation

@chalin

@chalin chalin commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator
  • Contributes to Cleanup: don't hard-code styles into layouts #783 (migration check-harness reliability)
  • Bug: the harness's emulateMediaType('print') call wiped the preceding scheme emulation (it and emulateMediaFeatures both map to CDP's single Emulation.setEmulatedMedia, each sending only its own field), so print shots followed the machine's system appearance: light-default Linux CI stayed green while macOS auto-dark broke local evening runs
  • Fix: one CDP call carrying media type and scheme features together; the session stays attached (detaching reverts the override)
  • Goldens: only the four print-dark shots change (darwin committed; linux installed from CI's visual-diffs artifact): the first genuine dark print renders
  • Red-proof (probe pre/post-fix on a system-light machine, plus --force-dark-mode to simulate a dark system):
    old, system-light:        {"dark":false,"print":true}   ← scheme wiped, follows system
    old, forced-dark system:  {"dark":true,"print":true}    ← follows system
    new, system-light:        {"dark":true,"print":true}    ← requested scheme sticks
    

chalin added 3 commits August 18, 2026 08:40
- Combines media type and prefers-color-scheme into one Emulation.setEmulatedMedia CDP call: Puppeteer's emulateMediaType and emulateMediaFeatures each send that command with only their own field, so the print call was erasing the scheme and print shots followed the machine's system appearance
- Keeps the CDP session attached for the page's lifetime: detaching reverts its emulation overrides
- Re-records the darwin print-dark goldens, the first genuine dark print renders (they were light-system shots); Linux CI goldens follow via the artifact updater
- Cuts the symptom replay (the commit/PR own the regression story), collapses the cause-consequence chain to one clause, and names the emulated feature (scheme) precisely
@chalin
chalin merged commit 1e1b175 into google:main Aug 18, 2026
18 checks passed
@chalin
chalin deleted the chalin-m24-visual-print-scheme-2026-0818 branch August 18, 2026 15:28
@chalin chalin added this to the 0.17.0 milestone Aug 26, 2026
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.

1 participant