[Question] Running on GitLab leads to WebSocket error: connect ECONNRESET 127.0.0.1:42495
See original GitHub issueStill struggling a bit with running Playwright tests on GitLab.
GitLab: 12.9.2-ee .gitlab-ci.yml
stages:
- test
cache:
paths:
- node_modules/
# - ~/.cache/ms-playwright
test:
stage: test
image: node:13
script:
- npm i
- DEBUG=pw:api npm run test
artifacts:
paths:
- screenshots
expire_in: 15 days
only:
- master
allow_failure: false
when: manual
using jest-playwright.config.js:
module.exports = {
launchOptions: {
args: [
`--no-sandbox`,
'--disable-dev-shm-usage',
'--ipc=host',
'--disable-setuid-sandbox'
]
}
}
Run leads to:
$ DEBUG=pw:api npm run test
> @ test /builds/online/mvp/online-mvp-qa
> jest
2020-06-23T08:05:40.260Z pw:api => chromium.launchServer started
2020-06-23T08:05:40.272Z pw:api <= chromium.launchServer succeeded
2020-06-23T08:05:40.333Z pw:api => chromium.connect started
2020-06-23T08:05:40.346Z pw:api <= chromium.connect failed
FAIL browser: chromium __tests__/smoke.spec.ts
● Test suite failed to run
WebSocket error: connect ECONNRESET 127.0.0.1:42495
================== chromium.connect logs ==================
<ws connecting> ws://127.0.0.1:42495/650495df1a372b4495e61a682fad5c1d
<ws connect error> ws://127.0.0.1:42495/650495df1a372b4495e61a682fad5c1d connect ECONNRESET 127.0.0.1:42495
<ws disconnected> ws://127.0.0.1:42495/650495df1a372b4495e61a682fad5c1d
============================================================
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)
Not quite sure where to dig. Can you please assist here?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:14 (6 by maintainers)
Top Results From Across the Web
WebSocket error when using Playwright on GitLab CI
The node:latest does not have the appropriate system dependencies to run the browsers. You can use the Playwright docker image.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thanks @volekerb. I believe you had to add the additional step to install playwright again because of the caching behavior. We’ve documented this here, but perhaps there’s a better way.
@Simonwep In my case I figured out that I have to add
- npm i -D playwrighteven with usingimage: aslushnikov/playwright:bionic. Looks like runner couldn’t find installed browser that’s why I had such issue.So, I’ve got such config:
.gitlab-ci.ymlI’m using several environments so have in
psckage.jsonAnd in each config have some global vars (related to each staging env) and