Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cypress and Docker - Can't run because no spec files were found

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.

like image 757
Garuuk Avatar asked Feb 03 '23 20:02

Garuuk


2 Answers

Turns out cypress automatically checks for /cypress/integration folder. Moving all my cypress files inside this folder got it working.

like image 123
Garuuk Avatar answered Apr 30 '23 01:04

Garuuk


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>/**/**/*
like image 24
avivamg Avatar answered Apr 30 '23 03:04

avivamg