playwright: [BUG] Running Nightly as root in a regular user's session is not supported.
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.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 4
- Comments: 15 (6 by maintainers)
Commits related to this issue
- Attempt to fix firefox in CI (https://github.com/microsoft/playwright/issues/6500) — committed to Holf/playwright-python-bdd-playground by deleted user 4 years ago
- build: workaround for tests in CI This workaround is based on issue https://github.com/microsoft/playwright/issues/6500 — committed to OmarCastro/its-a-color-wheel by OmarCastro 4 years ago
- try to fix firefox problem https://github.com/microsoft/playwright/issues/6500 — committed to juliuxu/julianjark.no by juliuxu 4 years ago
- Try and prevent GitHub Actions from stopping Firefox running Refs #976, ebc5045862df0e1838692f1e32150c1b376a567e, https://github.com/microsoft/playwright/issues/6500 — committed to PREreview/prereview.org by thewilkybarkid 3 years ago
- Workaround for root issue See https://github.com/microsoft/playwright/issues/6500 — committed to YoungVision-eV/homepage-sveltekit by MrGreenTea 3 years ago
- setup playwright tests (#12) * Add playwright workflow * Add html reporter to test workflow * use playwright image for Github action * Use selected fonts for consistency and reproducability * Upd... — committed to YoungVision-eV/homepage-sveltekit by MrGreenTea 3 years ago
- fix: nightly cannot be run from root - attempting solution from https://github.com/mxschmitt/firefox-github-actions-container/pull/3/files - thread: https://github.com/microsoft/playwright/issues/650... — committed to IEEE-PSH/hackpsh-web by dineshUmasankar 3 years ago
- fix: test firefox error Refer to: https://github.com/microsoft/playwright/issues/6500#issuecomment-1577221956 — committed to nix6839/vote-it by nix6839 3 years ago
- Setting up End-To-End Testing (#7) * Setup Playwright with common browsers * Update gitignore to add trace files * chore: update deps [next 13.5] * e2e testing on push/pull playwright - T... — committed to IEEE-PSH/hackpsh-web by dineshUmasankar 3 years ago
- Add HOME=/root to container samples #6500 Signed-off-by: Jozef Hollý <1708197+j2ghz@users.noreply.github.com> — committed to j2ghz/playwright by j2ghz 3 years ago
- Add HOME=/root to container samples in docs (#27832) Reference: #6500 (https://github.com/microsoft/playwright/issues/6500#issuecomment-1664210041) It seems that this is now required, so this PR ... — committed to microsoft/playwright by j2ghz 3 years ago
- Use pre-installed playwritght container for widget-tests (#165) * use pre-installed playwritght container for widget-tests * use HOME=root workaround for firefox -> see https://github.com/micro... — committed to Docmaps-Project/docmaps by ships 3 years ago
- Add workaround for browser... - See: https://github.com/microsoft/playwright/issues/6500 — committed to tajdeluca/portfolio by tajdeluca 3 years ago
- Upgrade to Nuxt V3 (#63) * Refactor project structure * Update to nuxt v3 * Fix build * Fix categorization and links * Remove file that should be ignored * Fix build * Fix test run ... — committed to tajdeluca/portfolio by tajdeluca 3 years ago
@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?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.In our CI we got the following error after adding the user param:
@aslushnikov Yeah, that does get round the problem:
@thewilkybarkid could you help me reproducing it at the https://github.com/mxschmitt/firefox-github-actions-container repository? (feel free to create a PR there with what I did wrong)
Reopening since this is still relevant and affects the default configuration.
Repro: https://github.com/mxschmitt/firefox-github-actions-container Upstream bug which implemented it: https://bugzilla.mozilla.org/show_bug.cgi?id=1323302
Actually while looking at it again, it seems working fine: https://github.com/mxschmitt/firefox-github-actions-container
Waiting for new customer reports.
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.