You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an assertion fails the previous command will be retried until the assertion passes. Only one command will be retried. I want to find a way to make Cypress retry 2 or more commands instead.
Why?
This can be very useful for improving tests stability when building custom commands or when added to certain commands like for example text().
Describe possible implementations
The only existing thing in Cypress that resembles this behaviour is the should(fn). Creating an alias for should is a last resort to get this behaviour. It would be a lot better if we can hook into the underlying logic of should instead to bypass the default chaining logic.
Additional context
The first step would be to find out if this is even possible. Next step would be to find out if this behaviour can be added to existing commands with an option.
The text was updated successfully, but these errors were encountered:
So I worked on this a bit while making the .attribute() command.
When creating a command with the option type: 'assertion' you can make Cypress retry both the command itself and the preceding command. This results basically in a command that behaves like .should(fn) with the difference that it actually yields the returned value.
Now hold your horses it's not all good. Cypress retries everything in the command, including things like setup and logging. This results in a log entry for every time the command is retried, a bit overkill.
Also note that verifyUpcomingAssertions does not work when using type: 'assertion. In this context, this means that default implicit assertions do not work and will have to be reimplemented for every command.
There are currently no plans for doing any work on this. I simply don't have any leads to make this work, so I feel it's not worth spending time on this.
I'll leave it open, as a place to make suggestions for how to do this.
Type of feature
What do you want to accomplish?
When an assertion fails the previous command will be retried until the assertion passes. Only one command will be retried. I want to find a way to make Cypress retry 2 or more commands instead.
Why?
This can be very useful for improving tests stability when building custom commands or when added to certain commands like for example
text()
.Describe possible implementations
The only existing thing in Cypress that resembles this behaviour is the
should(fn)
. Creating an alias for should is a last resort to get this behaviour. It would be a lot better if we can hook into the underlying logic ofshould
instead to bypass the default chaining logic.Additional context
The first step would be to find out if this is even possible. Next step would be to find out if this behaviour can be added to existing commands with an option.
The text was updated successfully, but these errors were encountered: