cypress: Cypress verify command failing
Current behavior:
After an apt update of ubuntu 18.04 (yesterday 16/01/2020), the following cypress command return an error.
npx cypress verify
It looks like this is your first time using Cypress: 3.8.2
✖ Verifying Cypress can run /root/.cache/Cypress/3.8.2/Cypress → Cypress Version: 3.8.2 Cypress failed to start.
This is usually caused by a missing library or dependency.
The error below should indicate which dependency is missing.
https://on.cypress.io/required-dependencies
If you are using Docker, we provide containers with all required dependencies installed.
Command failed: /root/.cache/Cypress/3.8.2/Cypress/Cypress --no-sandbox --smoke-test --ping=24
Platform: linux (Ubuntu Linux - 18.04) Cypress Version: 3.8.2
/root/.cache/Cypress/3.8.2/Cypress/Cypress --no-sandbox --smoke-test --ping=24
(Cypress:20915): Gtk-WARNING **: 12:20:46.593: cannot open display:
Desired behavior:
cypress verify should pass
Test code to reproduce
Versions
Ubuntu Linux - 18.04 Cypress Version: 3.8.2
Packages Versions :
apt-get install libgtk2.0-0 libgtk-3-0 libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb
libgtk2.0-0 is already the newest version (2.24.32-1ubuntu1). libnotify-dev is already the newest version (0.7.7-3). libxss1 is already the newest version (1:1.2.2-1). libxtst6 is already the newest version (2:1.2.3-1). xauth is already the newest version (1:1.0.10-1). libgconf-2-4 is already the newest version (3.2.6-4ubuntu1). libasound2 is already the newest version (1.1.3-5ubuntu0.2). libgtk-3-0 is already the newest version (3.22.30-1ubuntu4). libnss3 is already the newest version (2:3.35-2ubuntu2.7). xvfb is already the newest version (2:1.19.6-1ubuntu4.3).
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 5
- Comments: 15 (7 by maintainers)
Commits related to this issue
- ci: tentatively fix cypress failure see https://github.com/cypress-io/cypress/issues/6184#issuecomment-576684800 — committed to opencollective/opencollective-frontend by znarf 4 years ago
- Working around Cypress issue by wrapping Cypress command in xvfb-run https://github.com/cypress-io/cypress/issues/6184 — committed to craigatk/projektor by craigatk 4 years ago
Got the source of the problem, Xvfb is run without
-screenso electron dies with:If is set fallback
this._xvfb_args = options.xvfb_args || [ '-screen', '0', '1024x768x24' ]at @cypress/xvfb it looks like everything works.I’ve got a docker image before it was broken. If I run the following command
you can see cypress starts and correctly waits for something that’s not running. If I do an
apt updateandapt upgradewith the following output:and the I run the previous command again I get this output
A workaround found by @krishofmans is running your command prefixed with
xvfb-run --server-args="-screen 0 1024x768x24"I also hit the same issue since yesterday. The instance is started on a clean docker container with all the necessary package mentioned in the cypress.io website.
I worked around this by pre-pending the commands with
xvfb-run .... The path that led me to this:DEBUG=cypress:cli,xvfb cypress verifysaysfrom that I just ran the command that was printed
/root/.cache/Cypress/3.8.2/Cypress/Cypressand gotwhile the previous message clearly indicates that it runs
xvfbredoing the same command with
xvfb-runjust works:So all in all it looks like a bug in Cypress, certainly related to #4624 .
Alternatively, you can use xvfb-run to wrap the commands:
Temporary workaround
Start Xvfb yourself before running Cypress