In cypress, how do I wait for a page to load?
问题 Don't tell anyone, but our app is not yet single-page. I can wait on a given XHR request by giving the route an alias, but how do I wait until some navigation completes and the browser is safely on a new page? 回答1: You can add some assert inside: cy.click('#someButtonToNavigateOnNewPage'); cy.location('pathname', {timeout: 60000}) .should('include', '/newPage'); cy.click('#YouAreOnNewPage'); You can change default timeout - by default it's 4000 ms (4 secs) - to ensure that user navigated the