Open przemek-domain opened 1 year ago
@przemek-domain For your docker container, it looks like in your container for testing (Dockerfile-test
) you installed the additional linux dependencies, but not the browser itself. If you update the line in that docker file to be npx playwright install --with-deps webkit
instead of just npx playwright install-deps webkit
, then it should work.
Let me know if that works and I can look at updating our docs site to be more clear about getting this to work in CI.
@warrensplayer thank you for getting back to me.
Unfortunately, the proposed solution does not work. I receive the same error
read ECONNRESET
Error: read ECONNRESET
at TCP.onStreamRead (node:internal/stream_base_commons:217:20)
However, I found it works when I run my CRA app over HTTPS, i.e.
npx HTTPS=true react-scripts start
You are right. I spoke too soon.
I reverted my Dockerfile-test file and rebuilt my image. When run the following:
docker run --net=host --rm 26847test npx cypress run --headless --browser webkit
it fails with the same error:
read ECONNRESET
Error: read ECONNRESET
at TCP.onStreamRead (node:internal/stream_base_commons:217:20)
Here is the entire output and notice the dri3 extension not supported
error
DevTools listening on ws://127.0.0.1:38075/devtools/browser/4fd21ec8-f17e-4553-ba3b-a4c883dbcf6e
[212:0602/143040.249741:ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported.
====================================================================================================
(Run Starting)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Cypress: 12.13.0 │
│ Browser: WebKit 16 (headless) │
│ Node Version: v18.16.0 (/usr/local/bin/node) │
│ Specs: 1 found (cra-app.cy.js) │
│ Searched: cypress/e2e/**/*.cy.{js,jsx,ts,tsx} │
│ Experiments: experimentalWebKitSupport=true │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: cra-app.cy.js (1 of 1)
template spec
read ECONNRESET
Error: read ECONNRESET
at TCP.onStreamRead (node:internal/stream_base_commons:217:20)
When I run this command
docker run --net=host --rm 26847test ls & npx cypress run --headless --browser webkit
It works just fine and there is no dri3 extension not supported
error.
[1] 16737
Dockerfile-test
Jenkinsfile
cypress
cypress.config.js
node_modules
package-lock.json
package.json
public
scripts
src
yarn.lock
[1] + done docker run --net=host --rm 26847test ls
DevTools listening on ws://127.0.0.1:59431/devtools/browser/f8f003f4-a794-4611-823b-9def776636c3
============================================================================
(Run Starting)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Cypress: 12.13.0 │
│ Browser: WebKit 16 (headless) │
│ Node Version: v16.18.1 (/Users/stokes/.nvm/versions/node/v16.18.1/bin/node) │
│ Specs: 1 found (cra-app.cy.js) │
│ Searched: cypress/e2e/**/*.cy.{js,jsx,ts,tsx} │
│ Experiments: experimentalWebKitSupport=true │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: cra-app.cy.js (1 of 1)
template spec
✓ passes (140ms)
1 passing (1s)
(Results)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 1 │
│ Passing: 1 │
│ Failing: 0 │
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: true │
│ Duration: 1 second │
│ Spec Ran: cra-app.cy.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Video)
- Started compressing: Compressing to 32 CRF
- Finished compressing: 0 seconds
- Video output: /Users/stokes/Development/firewatch/26847/cypress-network-issue/cypress/videos/cra-app.cy.js.mp4
============================================================================
(Run Finished)
Spec Tests Passing Failing Pending Skipped
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ ✔ cra-app.cy.js 00:01 1 1 - - - │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
✔ All specs passed! 00:01 1 1 - - -
The only difference is appending ls &
to the command. I am going to have to ask around to see if someone more familiar with docker can understand this.
Can you try the same thing as I did above and see if you get the same result?
Thank you @warrensplayer, for investing time in this. It is a very interesting finding.
I noticed a difference in how we set up the network. I updated the README with info on how I run the containers. 🙏🏻 Please provide the exact commands you run to set the environment, i.e. build, run, test.
When I try your way (no & ls
), but with bridge network, I see the dri3
error.
[212:0605/011105.831045:ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported.
When I add the magical & ls
, the error is gone, but I still get the ECONNREFUSED
error.
[1] 11718
Dockerfile-test
Jenkinsfile
cypress
cypress.config.js
node_modules
package-lock.json
package.json
public
scripts
src
yarn-error.log
yarn.lock
[1] + 11718 done docker run --name test-container --add-host=server.local:172.18.0.2 ls
DevTools listening on ws://127.0.0.1:51315/devtools/browser/833922f1-e240-4f9a-94b6-c5eb8c2e97ce
====================================================================================================
(Run Starting)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Cypress: 12.13.0 │
│ Browser: WebKit 16 (headless) │
│ Node Version: v16.18.1 (/Users/przemek.sech/.nvm/versions/node/v16.18.1/bin/node) │
│ Specs: 1 found (cra-app.cy.js) │
│ Searched: cypress/e2e/**/*.cy.{js,jsx,ts,tsx} │
│ Experiments: experimentalWebKitSupport=true │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: cra-app.cy.js (1 of 1)
template spec
1) passes
0 passing (51s)
1 failing
1) template spec
passes:
CypressError: `cy.visit()` failed trying to load:
http://server.local:3000/
We attempted to make an http request to this URL but the request failed without a response.
We received this error at the network level:
> Error: connect ECONNREFUSED 127.0.0.1:3000
Common situations why this would fail:
- you don't have internet access
- you forgot to run / boot your web server
- your web server isn't accessible
- you have weird network configuration settings on your computer
at <unknown> (http://localhost:51316/__cypress/runner/cypress_runner.js:147677:96)
at <unknown> (http://localhost:51316/__cypress/runner/cypress_runner.js:147676:27)
at tryCatcher (http://localhost:51316/__cypress/runner/cypress_runner.js:18744:28)
at <unknown> (http://localhost:51316/__cypress/runner/cypress_runner.js:16679:35)
at <unknown> (http://localhost:51316/__cypress/runner/cypress_runner.js:16736:43)
at <unknown> (http://localhost:51316/__cypress/runner/cypress_runner.js:16781:24)
at <unknown> (http://localhost:51316/__cypress/runner/cypress_runner.js:16857:33)
at _drainQueueStep (http://localhost:51316/__cypress/runner/cypress_runner.js:13451:27)
at _drainQueue (http://localhost:51316/__cypress/runner/cypress_runner.js:13444:24)
at <unknown> (http://localhost:51316/__cypress/runner/cypress_runner.js:13460:16)
at <unknown> (http://localhost:51316/__cypress/runner/cypress_runner.js:13330:26)
From Your Spec Code:
at (http://localhost:51316/__cypress/runner/cypress_runner.js:160646:122)
@
at (http://localhost:51316/__cypress/runner/cypress_runner.js:160854:43)
at callFn (http://localhost:51316/__cypress/runner/cypress_runner.js:114387:25)
at (http://localhost:51316/__cypress/runner/cypress_runner.js:114374:13)
at finallyHandler (http://localhost:51316/__cypress/runner/cypress_runner.js:15298:27)
at tryCatcher (http://localhost:51316/__cypress/runner/cypress_runner.js:18744:28)
at (http://localhost:51316/__cypress/runner/cypress_runner.js:16679:35)
at (http://localhost:51316/__cypress/runner/cypress_runner.js:16736:43)
at (http://localhost:51316/__cypress/runner/cypress_runner.js:16781:24)
at (http://localhost:51316/__cypress/runner/cypress_runner.js:16861:33)
at (http://localhost:51316/__cypress/runner/cypress_runner.js:16805:33)
at (http://localhost:51316/__cypress/runner/cypress_runner.js:16749:29)
at (http://localhost:51316/__cypress/runner/cypress_runner.js:16781:24)
at (http://localhost:51316/__cypress/runner/cypress_runner.js:16861:33)
at (http://localhost:51316/__cypress/runner/cypress_runner.js:16805:33)
at (http://localhost:51316/__cypress/runner/cypress_runner.js:16691:33)
at (http://localhost:51316/__cypress/runner/cypress_runner.js:16736:43)
at (http://localhost:51316/__cypress/runner/cypress_runner.js:16781:24)
at (http://localhost:51316/__cypress/runner/cypress_runner.js:16861:33)
at (http://localhost:51316/__cypress/runner/cypress_runner.js:16805:33)
at (http://localhost:51316/__cypress/runner/cypress_runner.js:17078:27)
at (http://localhost:51316/__cypress/runner/cypress_runner.js:17096:22)
at (http://localhost:51316/__cypress/runner/cypress_runner.js:17066:48)
at init (http://localhost:51316/__cypress/runner/cypress_runner.js:17030:18)
at (http://localhost:51316/__cypress/runner/cypress_runner.js:16733:25)
at (http://localhost:51316/__cypress/runner/cypress_runner.js:16781:24)
at (http://localhost:51316/__cypress/runner/cypress_runner.js:16861:33)
at (http://localhost:51316/__cypress/runner/cypress_runner.js:16805:33)
at (http://localhost:51316/__cypress/runner/cypress_runner.js:17078:27)
at (http://localhost:51316/__cypress/runner/cypress_runner.js:17096:22)
at (http://localhost:51316/__cypress/runner/cypress_runner.js:16741:43)
at (http://localhost:51316/__cypress/runner/cypress_runner.js:16781:24)
at (http://localhost:51316/__cypress/runner/cypress_runner.js:16861:33)
at (http://localhost:51316/__cypress/runner/cypress_runner.js:16805:33)
at (http://localhost:51316/__cypress/runner/cypress_runner.js:17078:27)
at (http://localhost:51316/__cypress/runner/cypress_runner.js:15904:26)
at (http://localhost:51316/__cypress/runner/cypress_runner.js:16741:43)
at (http://localhost:51316/__cypress/runner/cypress_runner.js:16781:24)
at (http://localhost:51316/__cypress/runner/cypress_runner.js:16861:33)
at _drainQueueStep (http://localhost:51316/__cypress/runner/cypress_runner.js:13451:27)
at _drainQueue (http://localhost:51316/__cypress/runner/cypress_runner.js:13444:24)
at (http://localhost:51316/__cypress/runner/cypress_runner.js:13460:16)
at (http://localhost:51316/__cypress/runner/cypress_runner.js:13330:26)
From Node.js Internals:
Error: connect ECONNREFUSED 127.0.0.1:3000
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16)
(Results)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 1 │
│ Passing: 0 │
│ Failing: 1 │
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 1 │
│ Video: true │
│ Duration: 50 seconds │
│ Spec Ran: cra-app.cy.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Screenshots)
- /Users/przemek.sech/Git/przemek-minimal-cypress-webkit-setup/cypress/screenshots (1280x720)
/cra-app.cy.js/template spec -- passes (failed).png
(Video)
- Started compressing: Compressing to 32 CRF
- Finished compressing: 1 second
- Video output: /Users/przemek.sech/Git/przemek-minimal-cypress-webkit-setup/cypress/videos/cra-app.cy.js.mp4
====================================================================================================
(Run Finished)
Spec Tests Passing Failing Pending Skipped
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ ✖ cra-app.cy.js 00:50 1 - 1 - - │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
✖ 1 of 1 failed (100%) 00:50 1 - 1 - -
ℹ️ I tried the --net=host
option and got the same response as above.
Please see README for network details.
To debug the connection between containers and ran the test-conatiner as
docker run -it --name test-container \
--add-host=server.local:172.18.0.2 --network=network-cypress \
test-image /bin/bash
and tested connection
root@82192f4c0983:/test# ping -c 4 server.local
PING server.local (172.18.0.2) 56(84) bytes of data.
64 bytes from server.local (172.18.0.2): icmp_seq=1 ttl=64 time=0.367 ms
64 bytes from server.local (172.18.0.2): icmp_seq=2 ttl=64 time=0.440 ms
64 bytes from server.local (172.18.0.2): icmp_seq=3 ttl=64 time=1.26 ms
64 bytes from server.local (172.18.0.2): icmp_seq=4 ttl=64 time=0.437 ms
--- server.local ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3014ms
rtt min/avg/max/mdev = 0.367/0.625/1.257/0.365 ms
and with curl
root@82192f4c0983:/test# curl -i http://server.local:3000
HTTP/1.1 200 OK
Content-Length: 644
Content-Disposition: inline; filename="index.html"
Accept-Ranges: bytes
ETag: "dc6657f4c6d7bb6254487d0bde156e51f59cd47d"
Content-Type: text/html; charset=utf-8
Vary: Accept-Encoding
Date: Mon, 05 Jun 2023 01:31:49 GMT
Connection: keep-alive
Keep-Alive: timeout=5
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>React App</title><script defer="defer" src="/static/js/main.7be9ec25.js"></script><link href="/static/css/main.073c9b0a.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>root@82192f4c0983:/test#
It looks like some network setup issue.
Please provide me with exact commands you ran including build, run and test so I can reproduce exactly the same on my end.
+1 I'm having the same issue, as soon as webkit attempts to interact with the app it throws
Error: read ECONNRESET at TCP.onStreamRead (node:internal/stream_base_commons:217:20)
Looking forward to a resolution on this because this is stopping us from running webkit tests in our pipeline
@adam-wood-traka Are you trying to do the same thing as the original poster with sharing a network across docker images? If not, then please file a separate issue with a reproducible example for us to look at.
@przemek-domain Thanks for the update detail on how you setup your docker containers. I had shared my exact commands above. I had just used --net=host
to use the host network instead of the way you did it.
I will pass this along to get some more help internally and will get back with you.
@przemek-domain I was able to reproduce your same scenario using your updated steps.
I couple of updates from our team. The dri3
error is a red herring. It can happen regardless of browser.
There are a few issues relating to using webkit in a docker container: https://github.com/cypress-io/cypress-docker-images/issues/526 https://github.com/cypress-io/cypress/issues/25344 https://github.com/cypress-io/cypress-docker-images/issues/916
Your issue may be related.
I am forwarding this ticket to the appropriate team. They will soon evaluate the priority of this ticket and consider their capacity to pick it up. Please note that this does not guarantee that this issue will be resolved. The ticket will indicate status changes during evaluation, so we ask that you please refrain from asking for updates. Thanks!
@adam-wood-traka Are you trying to do the same thing as the original poster with sharing a network across docker images? If not, then please file a separate issue with a reproducible example for us to look at.
@warrensplayer Yes exactly the same issue sharing a network across docker images. It works if your testing a public url but if the app you're testing is in another container that's when it throws the error. I've subscribed to this issue, looking forward to this being fixed 🤞 Worth noting that In the same scenario, using only playwright testing an app in another container, it works.
Having the same issue here.
For us it also crashes with webkit (other browsers run fine) in a normal environmnet i. e. outside docker
:
read ECONNRESET
Error: read ECONNRESET
at TCP.onStreamRead (node:internal/stream_base_commons:217:20)
at TCP.callbackTrampoline (node:internal/async_hooks:130:17
setup: Cypress 13.8.1 Node 22.1.0 playwright-webkit 1.44.0 OS: Ubuntu 22.04.4 LTS
As the original poster implicitly mentioned, this only happens when going against localhost. Setting baseUrl to a proper domain fixes the issue and the page loads without any issues in the cypress tests.
Current behavior
Setup
experimentalWebKitSupport: true
<app-server-ip> server.local
Current behaviour
When running a test against CI/CD (Jenkins) or locally, I face the following error.
Desired behavior
I would like Cypress to be able to run WebKit tests against localhost
Test code to reproduce
This repo with minimal setup to reproduce the issue https://github.com/psech/cypress-network-issue
Cypress Version
12.13.0
Node version
18.16.0
Operating System
macOS 13.3.1 arm64 + docker 23.0.5 or Jenkins agent AWS EC2 c5.9xlarge + docker
Debug Logs
Other
The above setup helps to reproduce the https://github.com/cypress-io/cypress/issues/24704
A place in code I suspect to be involved https://github.com/cypress-io/cypress/blob/7fa5103f6734680df900ff9c071bbe1ef51a86d9/packages/server/lib/browsers/webkit.ts#L132-L143