I'm trying to run cypress tests inside a docker container. I've simplified my setup so I can just try to get a simple container instance running and a few tests executed.
I'm using docker-compose
version: '2.1' services: e2e: image: test/e2e:v1 command: ["./node_modules/.bin/cypress", "run", "--spec", "integration/mobile/all.js"] build: context: . dockerfile: Dockerfile-cypress container_name: cypress network_mode: host and my Dokerfile-cypress
FROM cypress/browsers:chrome69 RUN mkdir /usr/src/app WORKDIR /usr/src/app RUN npm install [email protected] COPY cypress /usr/src/app/cypress COPY cypress.json /usr/src/app/cypress RUN ./node_modules/.bin/cypress verify when I run docker-compose up after I build my image I see
cypress | name_to_handle_at on /dev: Operation not permitted cypress | Can't run because no spec files were found. cypress | cypress | We searched for any files matching this glob pattern: cypress | cypress | integration/mobile/all-control.js cypress exited with code 1 I've verified that my cypress files and folders have been copied over and I can verify that my test files exist. I've been stuck on this for a while and i'm unsure what to do besides giving up.
Any guidance appreciated.
4 Answers
Turns out cypress automatically checks for /cypress/integration folder. Moving all my cypress files inside this folder got it working.
*** UPDATE July 2023 ***
If you are using the latest cypress (version 12) the correct file path location is now /cypress/e2e folder
You may also need to change your test files to example.cy.ts
The problem: No cypress specs files were found on your automation suite.
Solution: Cypress Test files are located in cypress/integration by default, but can be configured to another directory. In this folder insert your suites per section:
for example:
- cypress/integration/billing-scenarios-suite - cypress/integration/user-management-suite - cypress/integration/proccesses-and-handlers-suite I assume that these suite directories contains sub directories (which represents some micro logic) ,therefore you need to run it recursively to gather all files:
cypress run --spec \ cypress/integration/<your-suite>/**/* , \ cypress/integration/<your-suite>/**/**/* If you run in cypress on docker verify that cypress volume contains the tests and mapped and mounted in container on volume section (on Dockerfile / docker-compose.yml file) and run it properly:
docker exec -it <container-id> cypress run --spec \ cypress/integration/<your-suite>/**/* , \ cypress/integration/<your-suite>/**/**/* After migrating from an older version of Cypress (8 to 12), I had to rename the cypress/integration folder to cypress/e2e and the spec files from *.spec.ts to *.cy.ts.
I noticed that if you CLICK AND DRAG file method to get file path in VSC, then it generates path with SMALL c-drive letter and this causes error: "Can't run because no spec files were found. + We searched for specs matching this glob pattern:"
e.g. by click and drag I get:
cypress run --spec c:\Users\dmitr\Desktop\cno-dma-replica-for-cy-test\cypress\integration\dma-playground.spec.js Notice SMALL c, in above.
BUT if I use right click 'get path', I get BIG C, and it works for some reason:
cypress run --spec C:\Users\dmitr\Desktop\cno-dma-replica-for-cy-test\cypress\integration\dma-playground.spec.js and this causes it to work.
Its strange I know, but there you go.
but if you just use: