It is not possible to run tests in headless mode with browser extensions installed, because the only supported browser in headless mode is Electron, and Electron doesn't support extensions as stated in the documentation.
Either allow choosing another browser for running in headless mode or add support for third-party extensions in Electron browser.
My web project has several environments (development, beta, production) that share the same URLs and are distinguished by custom headers (say, X-FooApp-Environment: Beta).
To achieve this currently, we set the headers in an extension using headless Chrome and Selenium WebDriver.
Adding extensions will be possible once we land https://github.com/cypress-io/cypress/issues/684
Adding headless chrome is a separate feature and should be pretty easy to do.
So is there a way currently to run cypress headless with chrome now?
@nanomosfet You can run cypress using cypress run in Chrome by passing the --browser flag like so. However, this is not running "headless" Chrome, this will run a headed version of Chrome.
The nomenclature has been a bit unclear in the past between running using cypress run and cypress open and the difference between a headless and headed browser. Does what I said make sense?
@jennifer-shehane If i were to do cypress run --browser chrome in a headless envirornment(maybe a EC2 AWS instance) would it work the way it would in a headed environment? If not, that is the feature I would want to request.
Is this possible yet? I've seen people mention headless chrome in other issues (e.g. #2307 #2494). Is there an example of how to do it? My tests don't work in electron.
@jennifer-shehane If i were to do
cypress run --browser chromein a headless envirornment(maybe a EC2 AWS instance) would it work the way it would in a headed environment? If not, that is the feature I would want to request.
@jennifer-shehane Can you please answer the above question? Is that even possible because my tests would run in kubernetes cluster
@jennifer-shehane If i were to do
cypress run --browser chromein a headless envirornment(maybe a EC2 AWS instance) would it work the way it would in a headed environment? If not, that is the feature I would want to request.
I've faced similar issue and found the solution for Docker container here. If you launch cypress run --browser chrome in a container based on some image from the link (for example cypress/browsers:chrome69) it works like a charm, no additional configs are required. Hope it helps.
Closing as duplicate of https://github.com/cypress-io/cypress/issues/832
Most helpful comment
@jennifer-shehane If i were to do
cypress run --browser chromein a headless envirornment(maybe a EC2 AWS instance) would it work the way it would in a headed environment? If not, that is the feature I would want to request.