I've noticed this is quite common issue when working with containerized Cypress. I've found one topic here but resetting settings isn't really a real solution. In some cases may be.
I'm using docker-compose to manage build of my containers:
...
other services
...
nginx:
build:
context: ./services/nginx
dockerfile: Dockerfile
restart: always
ports:
- 80:80
depends_on:
- users
- client
cypress:
build:
context: ./services/cypress
dockerfile: Dockerfile
depends_on:
- nginx
here's my cypress.json:
{
"baseUrl": "http://172.17.0.1",
"video": false
}
I know it's recommended to refer to service directly like this "http://nginx" but it never worked for me and referring to it by IP worked when I used non-containerized Cypress. Now I'm using Cypress in a container to make it consistent with all other services but Cypress is giving me a hard time. I'm not including volumes because so far I didn't see reason for including them. I don't need to persist any data at this point.
Dockerfile:
FROM cypress/base:10.18.0
RUN mkdir /app
WORKDIR /app
ADD cypress_dev /app
RUN npm i --save-dev cypress@4.9.0
RUN $(npm bin)/cypress verify
RUN ["npm", "run", "cypress:e2e"]
package.json:
{
"scripts": {
"cypress:e2e": "cypress run"
}
}
I'd very much appreciated any guidance. Please do ask for more info if I haven't provided enough.