I am using Playwright with Jest and jest-playwright-preset and trying to get my tests to run in GitLab CI.
My .gitlab-ci.yml:
ui_test:
image: node:latest
script:
- npm install
- npm run test:ui
When I run this locally on my Windows machine everything works fine. However if I try to run in GitLab CI I get the following error:
2020-06-26T21:01:39.770Z pw:api => chromium.launchServer started
2020-06-26T21:01:39.786Z pw:api <= chromium.launchServer succeeded
2020-06-26T21:01:40.182Z pw:api => chromium.connect started
2020-06-26T21:01:40.217Z pw:api <= chromium.connect failed
FAIL browser: chromium ./test.js
● Test suite failed to run
WebSocket error: connect ECONNRESET 127.0.0.1:38267
================== chromium.connect logs ==================
<ws connecting> ws://127.0.0.1:38267/b32ed779b7c87222e0b2b6aa117b0c79
<ws connect error> ws://127.0.0.1:38267/b32ed779b7c87222e0b2b6aa117b0c79 connect ECONNRESET 127.0.0.1:38267
<ws disconnected> ws://127.0.0.1:38267/b32ed779b7c87222e0b2b6aa117b0c79
============================================================
Note: use DEBUG=pw:api environment variable and rerun to capture Playwright logs.
at WebSocket.<anonymous> (node_modules/playwright/lib/transport.js:119:24)
at WebSocket.onError (node_modules/playwright/node_modules/ws/lib/event-target.js:128:16)
at ClientRequest.<anonymous> (node_modules/playwright/node_modules/ws/lib/websocket.js:568:15)
EDIT: This has nothing to do with Jest. The same problem will arise when only using Playwright and using the node image instead of the Playwright image.