-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
Description
Description
Hello, we have a flaky test in our project and by trial and error we discovered that it might be caused by an assertion in the middle of a query chain. We have something like this (i modified the real example for simplicity):
cy.find('div').eq(2).should('contain', 'Header').children('.child').eq(3).should('contain', 'child');
- If we start the query and our
divcontains the text "Header" we will continue the execution. - Since our application is loading at this stage, the text
childis not visible. - Once the data loads, the entire
divis re-rendered, but cypress only will retry the selector from.children('.child').eq(3)because the assertion.should('contain', 'Header')was met in point1 - Since the
divthat cypress has in the query is detached, it will fail with an error like:
Timed out retrying after 30000ms: cy.children() failed because the page updated as a result of this command, but you tried to continue the command chain. The subject is no longer attached to the DOM, and Cypress cannot requery the page after commands such as cy.children().
Is my understanding correct? If so i think that in the page dedicated to Retry-ability it will be useful to have this explicitly mentioned.
pioluk