garris / BackstopJS

Catch CSS curve balls.
http://backstopjs.org
MIT License
6.67k stars 605 forks source link

Chromium not available for non root user within docker for Playwright at version 6.2.0 #1468

Closed websi closed 1 year ago

websi commented 1 year ago

With Version 6.2.0 the chromium browser is not available for non root user. The normal user is node. See https://github.com/garris/BackstopJS/blob/1144782deebfe7e70650f09cc7fa2d3ffb349f7a/docker/Dockerfile#L18

$ docker run --rm -v $CI_PROJECT_DIR:/src  backstopjs/backstopjs:6.2.0 test --config=backstop.config.js
BackstopJS v6.2.0
Loading config:  /src/backstop.config.js 
COMMAND | Executing core for "test"
createBitmaps | Selected 10 of 10 scenarios.
Creating Browser
      COMMAND | Command "test" ended with an error after [0.007s]
      COMMAND | browserType.launch: Executable doesn't exist at /home/node/.cache/ms-playwright/chromium-1048/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                                                      ║
                ╚═════════════════════════════════════════════════════════════════════════╝
                    at module.exports.createPlaywrightBrowser (/usr/local/lib/node_modules/backstopjs/core/util/runPlaywright.js:43:42)
                    at /usr/local/lib/node_modules/backstopjs/core/util/createBitmaps.js:136:7
                    at delegateScenarios (/usr/local/lib/node_modules/backstopjs/core/util/createBitmaps.js:1[35](https://gitlab.dkd.de/dkd/products/typo3-cms-standard/-/jobs/242187#L35):12)
                    at module.exports (/usr/local/lib/node_modules/backstopjs/core/util/createBitmaps.js:192:19)
                    at Object.execute (/usr/local/lib/node_modules/backstopjs/core/command/test.js:17:14)
                    at Object.execute [as test] (/usr/local/lib/node_modules/backstopjs/core/command/index.js:59:49)
                    at execute (/usr/local/lib/node_modules/backstopjs/core/command/index.js:109:31)
                    at module.exports (/usr/local/lib/node_modules/backstopjs/core/runner.js:6:10)
                    at main (/usr/local/lib/node_modules/backstopjs/cli/index.js:[40](https://gitlab.dkd.de/dkd/products/typo3-cms-standard/-/jobs/242187#L40):5)
                    at Object.<anonymous> (/usr/local/lib/node_modules/backstopjs/cli/index.js:8:1)

Current workaround is to start the image as root user.

$ docker run --rm -v $CI_PROJECT_DIR:/src -u root backstopjs/backstopjs:6.2.0 test --config=backstop.config.js
tkrah commented 1 year ago

chromium is installed globally via package system, you should not need to install another chromium. I don't know playwright though - maybe it just needs a variable or something to get the path? See the pupeteteer one in the image. Sounds a little bit like https://github.com/garris/BackstopJS/issues/1454

Why do you think it is not available for the node user, backstopjs running as user node does find it ... Must be some playwright exclusive problem here.

@websi Can you add a small reproducer (branch) somewhere which does show your issue to analyze / help further?

tsvetislavt99 commented 1 year ago

Running into the same issue.

@tkrah I made a small repo where this can be reproduced.

tkrah commented 1 year ago

Running into the same issue.

@tkrah I made a small repo where this can be reproduced.

      COMMAND | TypeError: Cannot read properties of undefined (reading 'replace')
                    at Object.makeSafe (/usr/local/lib/node_modules/backstopjs/core/util/engineTools.js:48:14)
                    at module.exports.runPlaywright (/usr/local/lib/node_modules/backstopjs/core/util/runPlaywright.js:51:41)
                    at /usr/local/lib/node_modules/backstopjs/node_modules/p-map/index.js:57:28

trying to run your backstop example just always ends in that for me, ideas? using npm 9.6.2 with node 18.x.

tsvetislavt99 commented 1 year ago

trying to run your backstop example just always ends in that for me, ideas? using npm 9.6.2 with node 18.x.

@tkrah Sorry forgot to make .nvmrc. I'm on node - 16.14.2 npm - 8.19.4

tkrah commented 1 year ago

trying to run your backstop example just always ends in that for me, ideas? using npm 9.6.2 with node 18.x.

@tkrah Sorry forgot to make .nvmrc. I'm on node - 16.14.2 npm - 8.19.4

fix is already merged, does it help you?

tkrah commented 1 year ago

@websi @tsvetislavt99 Do you still have that problem with 6.2.2? Should be working again now.

tsvetislavt99 commented 1 year ago

@tkrah Hey, yes I can confirm the issue is resolved with me.

websi commented 1 year ago

I can also confirm that the issue was resolved.