Run Cypress Headless Without Binary
See original GitHub issueCurrent behavior:
npm install cypress
downloads the cypress app binary
Desired behavior:
npm install cypress
(or something like npm install @cypress/headless
) does not install a binary, and only installs necessary dependencies for running tests headlessly on CI.
Additional Info (images, stack traces, etc)
Our CI configuration is pretty strict about what can be externally downloaded. It would be great if cypress could be run without needing to whitelist the cypress domain.
- Operating System: Linux centos
- Cypress Version: 1.4.1
- Browser Version: Chrome 63
Issue Analytics
- State:
- Created 6 years ago
- Reactions:14
- Comments:84 (10 by maintainers)
Top Results From Across the Web
Command Line - Cypress Documentation
This matches how you run any browser via cypress open . cypress run --headed. cypress run --no-exit. To prevent Cypress from exiting after...
Read more >Introduction | Cypress Documentation
Run the binary install yourself by adding the command npx cypress install to your CI script. If there is a binary already present,...
Read more >Launching Browsers | Cypress Documentation
Launching by a path. You can launch any supported browser by specifying a path to the binary: cypress run --browser /usr/bin/chromium.
Read more >Installing - Cypress Documentation
When running Cypress in CI, however, some of the lower-tier configurations might not be able to run Cypress reliably, especially when recording videos...
Read more >Troubleshooting | Cypress Documentation
Run the same tests in both Electron and Chrome, then compare the ... If this does not succeed, it will fall back to...
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
Top Related Hashnode Post
No results found
This is something we’ve internally talked a lot about and I have a lot of notes for. It is possible to do this - you wouldn’t be able to run Electron, but you would be able to spawn an external browser.
The problem comes in where you have conflicting packages. You’d likely check in
cypress
already for local development and wouldn’t want that tonpm install
in CI, and you also wouldn’t want to check in a separate packaged like@cypress/headless
.For this to work I think we’d just need to set an env var like:
CYPRESS_INSTALL_BINARY=0
which avoids installing the binary and the CLI would have to be upgraded to run in your node environment as opposed to always expecting the binary to exist. This would then run Cypress in your node environment (which is another can of worms) but it would work.EDIT: another advantage of this is that if we supported Chrome headless (which we will), this avoids the need to orchestrate or have
xvfb
installed - since Electron would not need spawning locally. This creates a bit of combinatory explosion since it would require a lot of explaining and documentation, but that’s another upside to this method.Hello, I am reviving this issue ❤️
Since the launch of cypress 3.8.0 we now have the ability to run
cypress --headless
- which is really coolI’ve been trying to run cypress in a lambda function, and I have a few questions, which I am hoping someone here could help me with
At first I thought I would be clever, and check in my node_modules into source control, then bring this into a lambda and execute cypress from there, but it didn’t work out that well because I got this output, which I didn’t expect
The cypress binary was a curious one, and I started digging deeper from there
I saw that Cypress saves this binary, in the user’s cache directory - as below (taken from a ubuntu 18.04 virtualbox install)
I then tried to bring Cypress into my lambda function via a lambda layer (https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html) but I quickly ran into size issues
This got me onto looking at the size of Cypress, in it’s entirety
Below are the sizes of directories, in the home directory cache folder for Cypress, that are 1MB and bigger
404MB is taken up by
resources/app/packages/
of which 257MB is server node_modulesand below is the same stats from the node_modules folder
which means that pretty much the entire Cypress size comes from
cypress binary 111MB resources/app/packages 404MB
My questions are
And in closing, I just want to say, wow man, wow! You’ve built something so amazing an pretty and functional here, and I am so blown away by the quality of it all
Thank you for every little bit of effort you put into cypress because it’s really such a wonderful product