Skip to content

print.mjs: also look in the Windows Playwright cache for Chrome - #150

Open
SID-6921 wants to merge 1 commit into
wheresryan22:mainfrom
SID-6921:fix/print-windows-playwright-chrome-path
Open

SID-6921 wants to merge 1 commit into
wheresryan22:mainfrom
SID-6921:fix/print-windows-playwright-chrome-path

Conversation

@SID-6921

Copy link
Copy Markdown
Contributor

What this changes

print.mjs's chromePath() now also looks for a browser under %LOCALAPPDATA%\ms-playwright (the directory npx playwright install writes to on Windows), the same way capture.mjs, drive.mjs and turn-check.mjs already do.

Why

All four scripts carry their own copy of chromePath(). Three of them (capture.mjs, drive.mjs, turn-check.mjs) were given a Windows Playwright fallback in #75. print.mjs was added later in #126 from an older copy of the function and never got that block, so on a Windows machine that only has Playwright's Chromium (no system Chrome or Edge installed), every other script finds a browser and print.mjs alone fails with No Chrome found. Set CHROME_PATH to a Chrome or Chromium binary.

Confirmed with a repro that extracts each file's chromePath() and runs it against a fake home directory containing only a Playwright Chromium cache (no system Chrome/Edge):

scripts/capture.mjs    -> .../AppData/Local/ms-playwright/chromium-1234/chrome-win/chrome.exe
scripts/drive.mjs      -> .../AppData/Local/ms-playwright/chromium-1234/chrome-win/chrome.exe
scripts/print.mjs      -> undefined (no Chrome found)        # before this fix
scripts/turn-check.mjs -> .../AppData/Local/ms-playwright/chromium-1234/chrome-win/chrome.exe

After the fix, print.mjs matches the other three.

Tests

scripts/chrome-path-parity.test.mjs asserts every chromePath() in the four files contains the Windows Playwright lookup. It fails on main (only print.mjs is missing it) and passes with this change:

# before: # tests 1 # pass 0 # fail 1
# after:  # tests 1 # pass 1 # fail 0

I also ran the full suite (node --test scripts/*.test.mjs) before and after on a Linux machine: the same 6 pre-existing failures (the react-* tests, which need the test_deps npm install from CI, and one drive test that needs a real Chrome binary) appear on a clean checkout and with this change; nothing new fails.

Checks

  • Every example rebuilds, and git status --short shows only the changes I meant. (No example or kit change.)
  • No comments in code.
  • Kit changes are opt-in. Not applicable: no kit/ change.
  • I built and looked at both themes. Not applicable: no visual change.
  • Figures with pipes, cables or round parts. Not applicable: no figure change.
  • node scripts/lines.mjs. Not applicable: no figure change.
  • Shaders: not touched.
  • 3D: not touched.
  • Every number in the figure, the readout, the caption and the docs is true.
  • A line under Unreleased in CHANGELOG.md.

Screenshots

No visual change.

Copilot AI balanced review requested due to automatic review settings November 11, 2026 00:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

capture.mjs, drive.mjs and turn-check.mjs all fall back to Chrome installed by
`npx playwright install` under %LOCALAPPDATA%\ms-playwright on Windows.
print.mjs copied the rest of chromePath() but not that block, so on a Windows
machine with only Playwright's Chromium (no system Chrome or Edge), every
other script finds a browser and print.mjs alone fails with "No Chrome found".

scripts/chrome-path-parity.test.mjs checks every chromePath() for this lookup;
it fails on main and passes with this change.
@SID-6921
SID-6921 force-pushed the fix/print-windows-playwright-chrome-path branch from 3f82db8 to e970e7e Compare November 11, 2026 00:30
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.

2 participants