playwright: [QUESTION] `failed to launch chromium` error while running `npx jest` within Dockerfile.bionic

Context: I am using this container https://github.com/microsoft/playwright/blob/master/docs/docker/Dockerfile.bionic

After running the container, install all dependencies successfully, I have the following error:

Command used to run the container:

docker run -it --name playwright  -v "C:\myProject\web":/home mcr.microsoft.com/playwright bash

Command used to install project dependencies:

npm install 

Command to run tests:

npx jest 

Error:

root@f542143afa64:/home/e2e_tests# npm run test

catalogue-testing-framework-with-playwright@1.0.0 test /home/e2e_tests npx jest

Error: Failed to launch chromium because executable doesn't exist at /root/.cache/ms-playwright/chromium-827102/chrome-linux/chrome
Try re-installing playwright with "npm install playwright"
Note: use DEBUG=pw:api environment variable and rerun to capture Playwright logs.
    at Chromium._launchProcess (/home/e2e_tests/node_modules/playwright/lib/server/browserType.js:128:19)
    at async Chromium._innerLaunch (/home/e2e_tests/node_modules/playwright/lib/server/browserType.js:70:62)
    at async ProgressController.run (/home/e2e_tests/node_modules/playwright/lib/server/progress.js:85:28)
    at async Chromium.launch (/home/e2e_tests/node_modules/playwright/lib/server/browserType.js:53:25)
    at async BrowserServerLauncherImpl.launchServer (/home/e2e_tests/node_modules/playwright/lib/browserServerImpl.js:35:25)
    at async PlaywrightRunner.launchServer (/home/e2e_tests/node_modules/jest-playwright-preset/lib/PlaywrightRunner.js:61:48)
    at async PlaywrightRunner.getTests (/home/e2e_tests/node_modules/jest-playwright-preset/lib/PlaywrightRunner.js:96:40)
    at async PlaywrightRunner.runTests (/home/e2e_tests/node_modules/jest-playwright-preset/lib/PlaywrightRunner.js:123:30)
    at async TestScheduler.scheduleTests (/home/e2e_tests/node_modules/@jest/core/build/TestScheduler.js:321:13)
    at async runJest (/home/e2e_tests/node_modules/@jest/core/build/runJest.js:376:19)

Any idea to what is going wrong here? thx

my package.json

{
  "name": "catalogue-testing-framework-with-playwright",
  "version": "1.0.0",
  "description": " E2E testing framework",
  "main": "index.js",
  "scripts": {
    "lint": "eslint test/**/*.{js,ts,tsx} --quiet --fix",
    "pretty": "npx prettier --no-config test/**/*.{js,ts,tsx} --write",
    "test": "npx jest"
  },
  "dependencies": {
    "chromedriver": "85.0.1",
    "jest": "26.6.3",
    "jest-playwright": "0.0.1",
    "jest-playwright-preset": "^1.4.0",
    "playwright": "^1.5.2",
    "ts-jest": "26.4.4",
    "typescript": "4.0.5"
  },
  "devDependencies": {
    "@types/jest": "26.0.15",
    "@types/node": "13.13.30",
    "eslint": "^6.6.0",
    "expect-playwright": "^0.2.6",
    "jest-circus": "^26.6.3",
    "jest-html-reporters": "^2.1.0",
    "playwright-core": "^1.5.2",
    "prettier": "2.1.2"
  },
  "license": "MIT",
}

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 3
  • Comments: 16 (1 by maintainers)

Commits related to this issue

Most upvoted comments

@aslushnikov on a different note where would it be a good place to start a conversation around playwright and openlayers (https://openlayers.org/) testing? My team is building apps that are using openlayers as base for maps and build the application on top of that (layers). We would like to use some playwright APIs to interact with openlayers (e.g zoom in , draws polygons , select points etc.) I was able to do some very basic interaction using puppeteer using but not totally satisfied … however it seems harder with playwright… Do you guys have any suggestion/recommendation to tests map with playwright?

Hi @fasatrix I’m also interested in testing OpenLayers with Playwright. Did you achieve to draw a point and move it on the map with Playwright?

@fasatrix but actually let me try fixing our docker image…

TLDR Workaround: su pwuser

hey I found the workaround but would be good to have it sorted for root too.

Entry point should be pwuser. then install all modules under that user (npm i) and voila’

pwuser@d35208e019fa:~/e2e_tests$ npm i npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142 npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142 npm WARN deprecated har-validator@5.1.5: this library is no longer supported npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated

playwright-core@1.6.2 install /home/pwuser/e2e_tests/node_modules/playwright-core node install.js

chromedriver@85.0.1 install /home/pwuser/e2e_tests/node_modules/chromedriver node install.js

/tmp/85.0.4183.87/chromedriver is not writable: EACCES: permission denied, open ‘/tmp/85.0.4183.87/chromedriver/1605810948234.tmp’ /tmp/85.0.4183.87/chromedriver is not writable: EACCES: permission denied, open ‘/tmp/85.0.4183.87/chromedriver/1605810948234.tmp’ Current existing ChromeDriver binary is unavailable, proceeding with download and extraction. Downloading from file: https://chromedriver.storage.googleapis.com/85.0.4183.87/chromedriver_linux64.zip Saving to file: /home/pwuser/e2e_tests/node_modules/chromedriver/tmp/85.0.4183.87/chromedriver/chromedriver_linux64.zip Received 1040K… Received 2080K… Received 3120K… Received 4160K… Received 5200K… Received 5233K total. Extracting zip contents to /home/pwuser/e2e_tests/node_modules/chromedriver/tmp/85.0.4183.87/chromedriver. Copying to target path /home/pwuser/e2e_tests/node_modules/chromedriver/lib/chromedriver Fixing file permissions. Done. ChromeDriver binary available at /home/pwuser/e2e_tests/node_modules/chromedriver/lib/chromedriver/chromedriver

playwright@1.6.2 install /home/pwuser/e2e_tests/node_modules/playwright node install.js

Downloading chromium v827102 - 119.8 Mb [====================] 100% 0.0s

chromium v827102 downloaded to /home/pwuser/.cache/ms-playwright/chromium-827102 Downloading firefox v1205 - 72.7 Mb [====================] 100% 0.0s firefox v1205 downloaded to /home/pwuser/.cache/ms-playwright/firefox-1205 Downloading webkit v1383 - 71.3 Mb [====================] 100% 0.0s webkit v1383 downloaded to /home/pwuser/.cache/ms-playwright/webkit-1383 npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^2.1.2 (node_modules/jest-haste-map/node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.2.1: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})

added 751 packages from 472 contributors and audited 756 packages in 299.17s

31 packages are looking for funding run npm fund for details

found 0 vulnerabilities

pwuser@d35208e019fa:~/e2e_tests$ pwuser@d35208e019fa:~/e2e_tests$ ls -la /home/pwuser/.cache/ms-playwright/chromium-827102 total 0 drwxrwxr-x 1 pwuser pwuser 4096 Nov 19 18:37 . drwxrwxr-x 1 pwuser pwuser 4096 Nov 19 18:37 … -rw-rw-r-- 1 pwuser pwuser 0 Nov 19 18:37 INSTALLATION_COMPLETE drwxr-xr-x 1 pwuser pwuser 4096 Nov 19 18:37 chrome-linux