I'm getting the following error when running a Cypress test suite in a Docker container:
The automation client disconnected. Cannot continue running tests.
Using this command, running in a cypress/browsers:node12.6.0-chrome75
container:
cypress run --browser=chrome
This seems to occur when running out of shm space.
By default, Docker creates a container with a /dev/shm
shared memory space of 64MB.
This is typically too small for Chrome and could cause Chrome to crash.
I have found two options to resolve this:
/dev/shm
:// cypress/plugins/index.js
module.exports = (on, config) => {
// ref: https://docs.cypress.io/api/plugins/browser-launch-api.html#Usage
on('before:browser:launch', (browser = {}, args) => {
if (browser.name === 'chrome') {
args.push('--disable-dev-shm-usage')
return args
}
return args
})
}
/dev/shm
in the container:Run the container with docker run --shm-size=1gb
(or whatever size you want)