'How to achieve retries for individual tests using Cypress Cucumber Preprocessor?

I currently face the challenge of achieving individual test retries to stabilize a small group of specific tests that are dependent on some background processing and therefore tend to be flaky. I am using Cypress 9.2.0 with TypeScript and Cypress Cucumber Preprocessor 4.3.1.

To give a few more details, the application receives events that are processed in the background (normally takes max. 1-2 sec) and then data records are created. These records are then displayed in the UI in a table.

In some Cucumber scenarios I test exactly these cases end-to-end. Since the processing sometimes takes a little longer, I would like to preventively include retries that only apply to these test cases, more specifically the "Then" steps of the scenarios that check the final display in the table.

Since individual test retries like in standard Cypress tests unfortunately don't work with the Cucumber Preprocessor and global test retries in the cypress.json are buggy as well, I wonder if there is another way to achieve this?

Docs for normal Cypress Test Retries: https://docs.cypress.io/guides/guides/test-retries



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source