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

Make a command not count towards the reliability limit #6

Open
1 of 4 tasks
Lakitna opened this issue Apr 7, 2019 · 2 comments
Open
1 of 4 tasks

Make a command not count towards the reliability limit #6

Lakitna opened this issue Apr 7, 2019 · 2 comments
Labels
enhancement New feature or request stale

Comments

@Lakitna
Copy link
Owner

Lakitna commented Apr 7, 2019

Type of feature

  • Add a new command
  • Extend a default Cypress command
  • Change a Cypress-commands command
  • Other

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 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.

@Lakitna
Copy link
Owner Author

Lakitna commented May 16, 2019

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.

@Lakitna
Copy link
Owner Author

Lakitna commented Sep 15, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request stale
Projects
None yet
Development

No branches or pull requests

1 participant