question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cypress docker gitlab example failing in test stage

See original GitHub issue

Current behavior:

I’m trying to add Cypress to the pipeline on Gitlab using this example cypress-example-docker-gitlab. When it goes to the cypress-e2e or cypress-e2e-chrome job it fails.

The error message says: ERROR: No files to upload

image

Desired behavior:

It should run the job correctly.

Steps to reproduce: (app code and test code)

# .gitlab-ci.yml
# I'm using yarn

stages:
  - build
  - test

variables:
  npm_config_cache: /builds/vctormb/testing-cypress/.npm
  CYPRESS_CACHE_FOLDER: /builds/vctormb/testing-cypress/cache/Cypress

cache:
  key: ${CI_COMMIT_REF_SLUG}
  paths:
    - ~/.cache

install:
  image: cypress/base:10
  stage: build

  script:
    - yarn install --frozen-lockfile
    - $(yarn bin)/cypress verify

cypress-e2e:
  image: cypress/base:10
  stage: test
  script:
    - $(yarn bin)/cypress run
  artifacts:
    expire_in: 1 week
    when: always
    paths:
      - cypress/screenshots
      - cypress/videos

cypress-e2e-chrome:
  image: cypress/browsers:chrome67
  stage: test
  script:
    - $(yarn bin)/cypress run --browser chrome
  artifacts:
    expire_in: 1 week
    when: always
    paths:
      - cypress/screenshots
      - cypress/videos

Versions

“cypress”: “3.2.0”

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
bahmutovcommented, May 2, 2019

@vctormb yes, we are using --record to send test results to our dashboard, if you are not a subscriber, just use cypress run (and run a single job)

1reaction
ryan-snydercommented, Apr 15, 2019

We used to have this issue as well. The problem is getting the cypress binary to cache correctly with yarn since yarn doesn’t actually install the cypress binary. Our pipeline which works looks like so

  variables:
    CYPRESS_CACHE_FOLDER: /builds/project/repo/cache/Cypress
  cache:
    key: ${CI_COMMIT_REF_SLUG}
    paths:
      - .npm
      - cache/Cypress
      - node_modules
  before_script:
    - npm install && npm ci
    - $(npm bin)/cypress verify

I would recommend trying npm instead of yarn for any cypress stuff just because it typically works better. .Currently we just have a docker image with the cypress binary pre-installed which allows your pipelines to run much quicker. That’s a possible work around if the above doesn’t work

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cypress integration test using docker-compose passes locally ...
A cypress test that tests websocket connection behavior fails in GitLab CI. The actual pipeline is passing, but that is only so that...
Read more >
GitLab CI - Cypress Documentation
The example below is basic CI setup and job using GitLab CI/CD to run Cypress tests within the Electron browser. This GitLab CI...
Read more >
Run your Cypress E2E Tests in GitLab CI — Complete Guide
Let's put everything in another job, e2e tests . We will run this job in parallel to the unit tests by assigning the...
Read more >
Why Cypress service is failing? - docker - Stack Overflow
Below is my pipeline on which I'm trying to get Cypress job to run tests against Nginx service (which ...
Read more >
Running Cypress in Gitlab CI - jessie.codes
I ran into some difficulties a few weeks ago when attempting to run Cypress tests as part of my CI script in Gitlab....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found