Skip to content

Use .should instead of .then to retry assertions in cypress #87

Description

Our cypress tests have been a bit flaky lately. I think this is partially due to our usage of cypress' .then instead of .should. The cypress docs recommend using .should as it'll automatically retry:

image

As they note, we should be aware that the callback in a .should could be run multiple times, so we should make sure that there are no side effects in the callback.

So I'd say:

  • If it's an assertion, use .should instead of .then (make sure there are no side-effects)
  • If you want to work with the subject yielded from the previous command, and it's not an assertion, use .then

If everyone agrees I say we refactor our tests to follow the above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    testingRelated to our tests

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions