test-runner icon indicating copy to clipboard operation
test-runner copied to clipboard

How to specify Chromium path

Open alexbjorlig opened this issue 1 year ago • 5 comments

How can I specify a chromium path when running test-storybook in CI on Github actions? It works locally 🙃

Describe the bug When I try to run my tests in Github Action CI with test-storybook I get this error:

Test Suites: 0 of 6 total
Tests:       0 total
Snapshots:   0 total
Time:        0.449 s
Ran all test suites.
Error: Executable doesn't exist at /home/runner/.cache/ms-playwright/chromium-1091/chrome-linux/chrome
╔═════════════════════════════════════════════════════════════════════════╗
║ Looks like Playwright Test or Playwright was just installed or updated. ║
║ Please run the following command to download new browsers:              ║
║                                                                         ║
║     npx playwright install                                              ║
║                                                                         ║
║ <3 Playwright Team                                                      ║
╚═════════════════════════════════════════════════════════════════════════╝ Failed to launch browser.
    at executablePathOrDie (/home/runner/work/eddystone/eddystone/node_modules/playwright-core/lib/server/registry/index.js:362:[15](https://github.com/21RISK/eddystone/actions/runs/7612750703/job/20731226666?pr=4680#step:14:16))
    at Object.executablePathOrDie (/home/runner/work/eddystone/eddystone/node_modules/playwright-core/lib/server/registry/index.js:375:43)
    at Chromium._launchProcess (/home/runner/work/eddystone/eddystone/node_modules/playwright-core/lib/server/browserType.js:[16](https://github.com/21RISK/eddystone/actions/runs/7612750703/job/20731226666?pr=4680#step:14:17)6:39)
    at async Chromium._innerLaunch (/home/runner/work/eddystone/eddystone/node_modules/playwright-core/lib/server/browserType.js:103:9)
    at async Chromium._innerLaunchWithRetries (/home/runner/work/eddystone/eddystone/node_modules/playwright-core/lib/server/browserType.js:84:14)
    at async ProgressController.run (/home/runner/work/eddystone/eddystone/node_modules/playwright-core/lib/server/progress.js:91:22)
    at async Chromium.launch (/home/runner/work/eddystone/eddystone/node_modules/playwright-core/lib/server/browserType.js:61:[21](https://github.com/21RISK/eddystone/actions/runs/7612750703/job/20731226666?pr=4680#step:14:22))
    at async BrowserServerLauncherImpl.launchServer (/home/runner/work/eddystone/eddystone/node_modules/playwright-core/lib/browserServerImpl.js:48:21)
    at async PlaywrightRunner.launchServer (/home/runner/work/eddystone/eddystone/node_modules/jest-playwright-preset/lib/PlaywrightRunner.js:69:44)
    at async PlaywrightRunner.getTests (/home/runner/work/eddystone/eddystone/node_modules/jest-playwright-preset/lib/PlaywrightRunner.js:90:[36](https://github.com/21RISK/eddystone/actions/runs/7612750703/job/20731226666?pr=4680#step:14:37)) 

However I did actually run npx playwright install, and when running this line:

ls -a ~/.cache/ms-playwright

I get:

chromium-1071
ffmpeg-1009
firefox-1419
webkit-[18](https://github.com/21RISK/eddystone/actions/runs/7612750703/job/20731226666?pr=4680#step:9:19)69

alexbjorlig avatar Jan 22 '24 14:01 alexbjorlig

Hey @alexbjorlig we also faced this issue but for a different reason. Did you already try configuring PLAYWRIGHT_BROWSERS_PATH to $HOME/.cache/ms-playwright in your CI workflow in the step where you execute the test step?

tamarasaurus avatar Jan 24 '24 13:01 tamarasaurus

I'm also running into this, it used to work but now it looks like the version the test runner is looking for doesn't match the version installed by the Playwright install command. Setting the env var didn't work for me unfortunately.

Playwright install command: Chromium 124.0.6367.29 (playwright build v1112) downloaded to /home/runner/.cache/ms-playwright/chromium-1112

Storybook test job: [test] [sb] Error: Executable doesn't exist at /home/runner/.cache/ms-playwright/chromium-1097/chrome-linux/chrome

This is the CI job https://github.com/nerdyman/react-compare-slider/actions/runs/8573359817/job/23497910013?pr=139

nerdyman avatar Apr 05 '24 17:04 nerdyman

I was able to resolve this by setting a fixed version for Playwright, matching the version installed by the test runner.

E.g. pnpm dlx [email protected] install --with-deps

This is defs a workaround though, is there a way to get the test runner to play nice with the latest Playwright npx commands?

nerdyman avatar Apr 05 '24 18:04 nerdyman

I have the same issue. Also, it's hard to understand which version of chromium is included in the playwright versions. The release page doesn't help.

I expect the installation of test-runner to install the browsers as well, but this doesn't seem to happen.

Error: Executable doesn't exist at /Users/user/Library/Caches/ms-playwright/chromium-1117/chrome-mac/Chromium.app/Contents/MacOS/Chromium

I can't get chromium-1117 with any pnpm dlx playwright@<version> install --with-deps commands.

If I could configure the chromium version to be used via an env variable for test-storybook, that would help.

lucarestagno avatar May 08 '24 07:05 lucarestagno

I fixed it with

pnpm dlx playwright@latest install --with-deps

It looks like test-runner looks for the latest playwright build by default. Yesterday it was looking for chromium-1115, while today chromium-1117. The version of test-runner didn't change in the meantime.

lucarestagno avatar May 08 '24 10:05 lucarestagno