I have this test in cypress that’s supposed to check that a certain element is focused.
Example Test
cy.focused().should('have.value', 'foobar')
But it’s really brittle since I'm testing it on a modal that may or may not have fully animated into the screen.
We need to have the cy.focused() command retry the assertion until it passes or times out at the duration of it's command timeout. Currently, it checks against the assertion once then passes or fails.
I have this test in cypress that’s supposed to check that a certain element is focused.
Example Test
cy.focused().should('have.value', 'foobar')But it’s really brittle since I'm testing it on a modal that may or may not have fully animated into the screen.
We need to have the
cy.focused()command retry the assertion until it passes or times out at the duration of it's command timeout. Currently, it checks against the assertion once then passes or fails.