question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] Running on GitLab leads to WebSocket error: connect ECONNRESET 127.0.0.1:42495

See original GitHub issue

Still 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:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
arjunattamcommented, Jun 27, 2020

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.

1reaction
volekerbcommented, Jun 26, 2020

@Simonwep In my case I figured out that I have to add - npm i -D playwright even with using image: 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.yml

stages:
  - test

cache:
  paths:
    - node_modules/

test-prod:
  stage: test
  image: aslushnikov/playwright:bionic
  script:
    - npm install
    - npm i -D playwright
    - DEBUG=pw:api npm run test-prod
  artifacts:
    paths:
      - screenshots
    expire_in: 15 days
  only:
    - master
  allow_failure: false
  when: manual

I’m using several environments so have in psckage.json

{
  "private": true,
  "scripts": {
    "test-prod": "jest --config=jest.prod.config.js",
    "test-dev": "jest --config=jest.dev.config.js",
    "test-test": "jest --config=jest.test.config.js"
  },
...

And in each config have some global vars (related to each staging env) and

module.exports = {
    preset: "jest-playwright-preset",
}
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found