Repository navigation
Closed
Labels
Description
Running playwright automation in Github CI using docker image fails for Firefox
Github Actions Workflow looks as follow:
jobs:
test_e2e:
runs-on: self-hosted
container:
image: mcr.microsoft.com/playwright
options: '--ipc=host --entrypoint /bin/bash'
steps:
- uses: actions/checkout@v2
- run: npm ci --no-optional --no-audit --prefer-offline --progress=false
- run: npm run ci:e2e
Output is:
npm run ci:e2e
shell: sh -e {0}
> @clap/clap-frontend@0.1.0 ci:e2e /__w/clap-ui/clap-ui
> jest -c jest-e2e.config.js
Protocol error (Browser.enable): Browser closed.
==================== Browser output: ====================
<launching> /ms-playwright/firefox-1250/firefox/firefox -no-remote -headless -profile /tmp/playwright_firefoxdev_profile-8PNwPz -juggler-pipe -silent
<launched> pid=629
[pid=629][err] Running Nightly as root in a regular user's session is not supported. ($HOME is /github/home which is owned by pwuser.)Error
at /__w/clap-ui/clap-ui/node_modules/playwright/lib/server/firefox/ffConnection.js:55:63
at new Promise (<anonymous>)
at FFConnection.send (/__w/clap-ui/clap-ui/node_modules/playwright/lib/server/firefox/ffConnection.js:54:16)
at Function.connect (/__w/clap-ui/clap-ui/node_modules/playwright/lib/server/firefox/ffBrowser.js:65:24)
at Firefox._connectToTransport (/__w/clap-ui/clap-ui/node_modules/playwright/lib/server/firefox/firefox.js:65:38)
at Firefox._innerLaunch (/__w/clap-ui/clap-ui/node_modules/playwright/lib/server/browserType.js:133:36)
at async ProgressController.run (/__w/clap-ui/clap-ui/node_modules/playwright/lib/server/progress.js:76:28)
at async Firefox.launch (/__w/clap-ui/clap-ui/node_modules/playwright/lib/server/browserType.js:78:25)
at async BrowserServerLauncherImpl.launchServer (/__w/clap-ui/clap-ui/node_modules/playwright/lib/browserServerImpl.js:35:25)
at async PlaywrightRunner.launchServer (/__w/clap-ui/clap-ui/node_modules/jest-playwright-preset/lib/PlaywrightRunner.js:68:44)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @clap/clap-frontend@0.1.0 ci:e2e: `jest -c jest-e2e.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @clap/clap-frontend@0.1.0 ci:e2e script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /github/home/.npm/_logs/2021-05-11T12_50_21_530Z-debug.log
Error: Process completed with exit code 1.
Reacted by Pedro Andrés Chaparro Quintero, Ruslan Kazakov, Nick Partridge and electrovir
Activity
JoelEinbinder commentedon May 11, 2021
Andrey Lushnikov (@aslushnikov) for help with docker.
The code in firefox is in
toolkit/xre/nsAppRunner.cpp, and it checks if the directories$HOME,$XDG_RUNTIME_DIRand$XAUTHORITYare owned by the current user. Could you try running withHOME=/root npm run ci:e2e?Th3S4mur41 commentedon May 11, 2021
Thanks Joel Einbinder (@JoelEinbinder) that solved the issue 👍
mxschmitt commentedon May 21, 2021
Update: I raised an issue on GitHub side, since it seems not fixable on our side except using
HOME=/rootas a workaround as Joel has recommended.aslushnikov commentedon Jun 15, 2021
Looks like the workaround is good-enough
Attempt to fix firefox in CI
build: workaround for tests in CI
24 remaining items
taylorkline commentedon Aug 3, 2023
If possible, it'd be great if someone had a moment to update the docs at the following two locations:
aslushnikov commentedon Aug 3, 2023
Taylor Kline (@taylorkline) feel free to send us a pull request!
Workaround for root issue
setup playwright tests (#12)
fix: nightly cannot be run from root
fix: test firefox error
Setting up End-To-End Testing (#7)
Add HOME=/root to container samples
Add HOME=/root to container samples in docs (#27832)
Use pre-installed playwritght container for widget-tests (#165)
Add workaround for browser...
Upgrade to Nuxt V3 (#63)
nickofthyme commentedon Apr 13, 2025
Update on this for future viewers...
Instead of running the tests with
HOME=/root npx playwrightinside the container, you can just set the--userfrom thejobs.<job_id>.container.optionsas shown in the docs here, also shown below.SetupCoding commentedon Apr 22, 2025
In our CI we got the following error after adding the user param: