Closed
Description
cypress-testing-library
version: 2.2.0node
version: 9.4.0yarn
version: 1.7.0
Relevant code or config
// I have a table with users, and I want to test user deletion
cy.getByTestId(`user-id-${userId}`).within(() => {
cy.getByText('Remove').click();
});
cy.getByTestId(`user-id-${userId}`).should('not.exist');
What you did:
I've tried to use cypress-testing-library custom commands with should('not.exist') expectation.
What happened:
The expectation failed, because cypress does not wait until the row/element disappeared.
On the other hand the following works as expected:
cy.getByTestId(`user-id-${invitee.userId}`).within(() => {
cy.getByText('Remove').click();
});
cy.get(`[data-testid="user-id-${invitee.userId}"`).should('not.exist');
What would be the proper way to test element disappearance with custom commands?