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 fails to retry job on GitLab CI with --record and --group flags

See original GitHub issue

Current behavior:

On GitLab CI, when a recorded job with multiple groups fails and is being retried, Cypress errors out with You passed the --group flag, but this group name has already been used for this run. for the second group.

Desired behavior:

Retries should run for all groups.

Test code to reproduce

In our particular case we run two groups:

// .gitlab-ci.yml

cypress:
  stage: test
  image: cypress/browsers:node14.7.0-chrome84
  before_script:
    - cd cypress
    - npm ci
  script:
    - npm run cli -- --browser chrome --headless --record --group Backend --spec 'integration/backend/**/*'
    - npm run cli -- --browser chrome --headless --record --group Frontend --spec 'integration/frontend/**/*'
  artifacts:
    when: always
    paths:
      - cypress/videos/**/*.mp4
      - cypress/screenshots/**/*.png
    expire_in: 1 day

The first run fails for whatever reason. The second run (retry) starts, executes the first group (Backend) without issue, and fails on the second group (Frontend).

Second run, first group:

image

Second run, second group: Here you can see Recorded Run: https://dashboard.cypress.io/projects/khj9rq/runs/16 for the first group, followed by You passed the --group flag, but this group name has already been used for this run. for the second group:

image

Adding a new commit to the branch “fixes” it and lets the tests pass again.

On the Dashboard it translates to incomplete or mismatched reporting:

Incomplete run 16 from above logs: image

Incomplete previous run 15: image

Successful next run 17: image

Versions

  • “cypress”: “5.0.0”
  • gitlab-runner 13.0.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
damusnetcommented, Sep 1, 2020

Hi @bahmutov, thanks for the quick investigation! I figured it would be something like using the wrong GitLab ENV variable. We will use the workaround with the CI_JOB_ID instead of CI_PIPELINE_ID for now and are looking forward for a more native fix. Other than that our experience with Cypress has been amazing, it is a great product!

0reactions
damusnetcommented, Sep 16, 2020

Thanks @bahmutov!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Test Retries - Cypress Documentation
With test retries, Cypress is able to retry failed tests to help reduce test flakiness and continuous integration (CI) build failures.
Read more >
Auto Retry failed CI jobs (#3442) · Issues - GitLab.org
I would like to be able to specify retry_count in gitlab-ci. yml which will retry failing builds N times. We already have logic...
Read more >
Cypress: Setting up the first acceptance tests in Gitlab CI ...
Parallelization through Cypress Dashboard this way has one crucial drawback: if any of your tests fail and you trigger a rerun, all tests...
Read more >
Cypress Tips and Tricks - Gleb Bahmutov
Read the docs Run Cypress on your own CI Record success and. ... I have configured our GitLab CI to keep artifacts from...
Read more >
Continuous Integration - cypress - w3resource
This implies that you have to run the server in the background, else your CI provider will not be able to move onto...
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