Issue running Jest/Puppeteer on Windows for Workshop 2 on Automated Testing
Opened this issue · 0 comments
Filing this here to remind myself of something that needs addressing:
Running Jest (which hooks into Puppeteer) on WSL with Ubuntu 20.04 fails with the current setup. I tried fixing it by installing missing packages but it still fails on a Chrome sandbox issue.
Here is one of the initial errors I saw for a missing package after running yarn install
and yarn test
:
marcy@MARCYSUTTONB95F:~/Sites/testing-accessibility-demos$ yarn run test
yarn run v1.22.17
$ jest workshop2-automated-testing/components/* workshop2-automated-testing/exercise1-jest/*
Error: Jest: Got error running globalSetup - /home/marcy/Sites/testing-accessibility-demos/node_modules/jest-environment-puppeteer/setup.js, reason: Failed to launch the browser process!
/home/marcy/Sites/testing-accessibility-demos/node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome: error while loading shared libraries: libgbm.so.1: cannot open shared object file: No such file or directory
TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
at onClose (/home/marcy/Sites/testing-accessibility-demos/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:203:20)
at Interface.<anonymous> (/home/marcy/Sites/testing-accessibility-demos/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:193:68)
at Interface.emit (node:events:532:35)
at Interface.close (node:readline:586:8)
at Socket.onend (node:readline:277:10)
at Socket.emit (node:events:532:35)
at endReadableNT (node:internal/streams/readable:1346:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
error Command failed with exit code 1.
I followed the trail of package installations and moved forward with this list:
sudo apt-get install libnss3 libxss1 libasound2 libatk-bridge2.0-0 libgtk-3-0 libgbm-dev
It still fails on a Chrome Sandbox issue that doesn't come up at all on Mac OSX. There is apparently an option for Puppeteer to disable the sandbox, but I was hesitant to go that route without more research for security reasons. And this project uses jest-puppeteer, in any case.
Here is the sandbox stack trace:
marcy@MARCYSUTTONB95F:~/Sites/testing-accessibility-demos$ yarn test
yarn run v1.22.17
$ jest workshop2-automated-testing/components/* workshop2-automated-testing/exercise1-jest/*
Error: Jest: Got error running globalSetup - /home/marcy/Sites/testing-accessibility-demos/node_modules/jest-environment-puppeteer/setup.js, reason: Failed to launch the browser process!
[0215/162416.488894:FATAL:zygote_host_impl_linux.cc(117)] No usable sandbox! Update your kernel or see https://chromium.googlesource.com/chromium/src/+/main/docs/linux/suid_sandbox_development.md for more information on developing with the SUID sandbox. If you want to live dangerously and need an immediate workaround, you can try using --no-sandbox.
#0 0x7f186af80f49 (/home/marcy/Sites/testing-accessibility-demos/node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome+0x5555d46dc04d649e)
#1 0x7f186aeea933 (/home/marcy/Sites/testing-accessibility-demos/node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome+0x5555d46dc043fe88)
#2 0x7f186aefe500 (/home/marcy/Sites/testing-accessibility-demos/node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome+0x5555d46dc0453a55)
#3 0x7f186910013b (/home/marcy/Sites/testing-accessibility-demos/node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome+0x5555d46dbe655690)
#4 0x7f186aa9ab9f (/home/marcy/Sites/testing-accessibility-demos/node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome+0x5555d46dbfff00f4)
#5 0x7f186aa98fa5 (/home/marcy/Sites/testing-accessibility-demos/node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome+0x5555d46dbffee4fa)
#6 0x7f186aa990cd (/home/marcy/Sites/testing-accessibility-demos/node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome+0x5555d46dbffee622)
#7 0x7f186aaf7fd9 (/home/marcy/Sites/testing-accessibility-demos/node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome+0x5555d46dc004d52e)
#8 0x7f186aaf7cf8 (/home/marcy/Sites/testing-accessibility-demos/node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome+0x5555d46dc004d24d)
#9 0x7f186790bae1 (/home/marcy/Sites/testing-accessibility-demos/node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome+0x5555d46dbce61036)
#10 0x7f18632870b3 (/usr/lib/x86_64-linux-gnu/libc-2.31.so+0x5555d46db87dc608)
#11 0x7f186790b92a (/home/marcy/Sites/testing-accessibility-demos/node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome+0x5555d46dbce60e7f)
Received signal 6
#0 0x7f186af80f49 (/home/marcy/Sites/testing-accessibility-demos/node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome+0x5555d46dc04d649e)
#1 0x7f186aeea933 (/home/marcy/Sites/testing-accessibility-demos/node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome+0x5555d46dc043fe88)
#2 0x7f186af80a21 (/home/marcy/Sites/testing-accessibility-demos/node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome+0x5555d46dc04d5f76)
#3 0x7f18644823c0 (/usr/lib/x86_64-linux-gnu/libpthread-2.31.so+0x5555d46db99d7915)
#4 0x7f18632a618b (/usr/lib/x86_64-linux-gnu/libc-2.31.so+0x5555d46db87fb6e0)
#5 0x7f1863285859 (/usr/lib/x86_64-linux-gnu/libc-2.31.so+0x5555d46db87dadae)
#6 0x7f186af7fcb5 (/home/marcy/Sites/testing-accessibility-demos/node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome+0x5555d46dc04d520a)
#7 0x7f186aefe927 (/home/marcy/Sites/testing-accessibility-demos/node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome+0x5555d46dc0453e7c)
#8 0x7f186910013b (/home/marcy/Sites/testing-accessibility-demos/node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome+0x5555d46dbe655690)
#9 0x7f186aa9ab9f (/home/marcy/Sites/testing-accessibility-demos/node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome+0x5555d46dbfff00f4)
#10 0x7f186aa98fa5 (/home/marcy/Sites/testing-accessibility-demos/node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome+0x5555d46dbffee4fa)
#11 0x7f186aa990cd (/home/marcy/Sites/testing-accessibility-demos/node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome+0x5555d46dbffee622)
#12 0x7f186aaf7fd9 (/home/marcy/Sites/testing-accessibility-demos/node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome+0x5555d46dc004d52e)
#13 0x7f186aaf7cf8 (/home/marcy/Sites/testing-accessibility-demos/node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome+0x5555d46dc004d24d)
#14 0x7f186790bae1 (/home/marcy/Sites/testing-accessibility-demos/node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome+0x5555d46dbce61036)
#15 0x7f18632870b3 (/usr/lib/x86_64-linux-gnu/libc-2.31.so+0x5555d46db87dc608)
#16 0x7f186790b92a (/home/marcy/Sites/testing-accessibility-demos/node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome+0x5555d46dbce60e7f)
r8: 0000000000000000 r9: 00007fffdc3a2cc0 r10: 0000000000000008 r11: 0000000000000008
r12: 00007fffdc3a3f90 r13: 00007fffdc3a2f20 r14: 00007fffdc3a3fa0 r15: aaaaaaaaaaaaaaaa
di: 0000000000000002 si: 00007fffdc3a2cc0 bp: 00007fffdc3a2f10 bx: 00007f1861ea1500
dx: 0000000000000000 ax: 0000000000000000 cx: 0000000000000008 sp: 00007fffdc3a2cc0
ip: 00007f18632a618b efl: 0000000000000246 cgf: 00000053002b0033 erf: 0000000000000000
trp: 0000000000000000 msk: 0000000000000000 cr2: 0000000000000000
[end of stack trace]
TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
at onClose (/home/marcy/Sites/testing-accessibility-demos/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:203:20)
at Interface.<anonymous> (/home/marcy/Sites/testing-accessibility-demos/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:193:68)
at Interface.emit (node:events:532:35)
at Interface.close (node:readline:586:8)
at Socket.onend (node:readline:277:10)
at Socket.emit (node:events:532:35)
at endReadableNT (node:internal/streams/readable:1346:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
error Command failed with exit code 1.
Where I left it
There is a note in this project's README about WSL not being supported for Workshop 2 for the moment. I'll remove it when I figure out the best fix (suggestions welcome!).