https://cypress.io logo
Hello. I'm experiencing something weird, and am wo...
# e2e-testing
a
Hello. I'm experiencing something weird, and am wondering if it's a bug or normal. Let's say I have two pages, Page A and Page B each one having a
tablist
. I want to do something like that to select a certain tab in my tab list on page B:
Copy code
// Page A
cy.contains('a', 'Page B');
// Trying to find a button on the tablist from page B
cy.findByRole('tablist').contains('button', 'Submenu').click()
The thing is, the tested app doesn't start updating the DOM until it's got the response from the server (when switching to Page B). As such, on the second line, Cypress will pick the tablist from Page A (which is still displayed when the command is executed), and then will try, for all the duration of the retry, the
Submenu
in THAT tablist. Even if in the meantime, Page B, with a
tablist
which actually contains that button, appears. I wonder if there is a way to select something by re-evaluating the actual chain for the whole retry duration, or if I'm stuck? Or doing something wrong?