Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to retry a specific scenario #697

Closed
badeball opened this issue Apr 21, 2022 · 1 comment
Closed

Ability to retry a specific scenario #697

badeball opened this issue Apr 21, 2022 · 1 comment

Comments

@badeball
Copy link
Owner

Cypress offers an interface to override retry-settings per test, but this interface is lost of the Gherkin translation.

An alternative solution has been proposed here.

Personally I like the @retries:N approach. Furthermore, one could perhaps specify N for different modes with @retries(openMode=5) or similar.

This is a good first issue if anyone would like to take a stab at it. However, for any contribution I expect test coverage and a corresponding update in documentation. The implementation is the easy part and without the other components you would just be committing work to me and thus not really contributing.

@aljedaxi
Copy link

aljedaxi commented May 9, 2022

I've got an ersatz solution for anyone that needs it:

  • run cypress with --reporter json
  • then feed the results into the following function:
const makeSeds = s => {
  return s
    .split (/^\{/m)
    .flatMap (s => s.split (/^\}/m))
    .filter ((_, idx) => isOdd (idx + 1))
    .map (s => JSON.parse (`{${s}}`))
    .flatMap (o => o.failures?.map (f => f.title) ?? [])
    .map (scenario => `gsed -i '/Scenario: ${scenario}/i \\  @focus' cypress/integration/*.feature`
`)
}

(gsed on mac; just sed on linux)

run that code, and it'll put a @focus on top of every scenario that failed. Then you can just re-run cypress.

furthermore, you can mark only the feature files that failed using --spec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants