Cypress-cucumber-preprocessor: How can I retry the scenario or step definition if the test was failed

Created on 14 Apr 2021  路  6Comments  路  Source: TheBrainFamily/cypress-cucumber-preprocessor

There is the test retries configuration on cypress.json. But in some special situation, I don't want to retry all the tests, only some tests need to be retried.

Can we add the retry on a specific scenario?

All 6 comments

Upvoted, I also need a way to add configurations per test scenario

Cypress does provide native retry: https://docs.cypress.io/guides/guides/test-retries#Custom-Configurations

And this lovely plugin does accept a test config block...
Given( "the dashboard is sorted by column {string} in {string} order", { retries: { runMode: 3, openMode: 3, }, }, (column, order) => { ... ...

But it's not working. Tracing the generated test (as seen in the test runner):
(0, _steps.Given)("the dashboard is sorted by column {string} in {string} order", { retries: { runMode: 3, openMode: 3 } }, function (column, order) { ... ...

Looks OK but no dice. If I do the same in a spec directly (no cucumber) the retries override does work as expected.

Have not been able to figure out why it's not working under this plugin.

As I dive into the source code, the generated code looks like this

  `describe(${filename}, ()=> {...})`

which will fall to the no-config case of cypress.
Actually I can help a pull request for this, but not sure where to put the configs in the feature file

馃槩
Is there a way to do this from within Cypress steps, as in configure this ad-hoc outside of the actual definition?

Retries doesn't work correctly. If I use for ex. retries:2 in cypress.json, and two test scenarios, when the first scenario fails it retries only the second scenario 4 times.

@sKavanaghV you get the solution to this problem?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

claudiunicolaa picture claudiunicolaa  路  4Comments

OllyNuralAND picture OllyNuralAND  路  6Comments

raisapirgari picture raisapirgari  路  6Comments

leegee picture leegee  路  4Comments

flowt-au picture flowt-au  路  3Comments