Cypress · Junior · Question 22 of 75
Which assertion checks the current URL contains /dashboard?
- 1
cy.url().should('include', '/dashboard') - 2
cy.location().equals('/dashboard') - 3
cy.get('url').should('have', '/dashboard')
Show the answer
Correct answer: cy.url().should('include', '/dashboard')
Explanation
cy.url() yields the URL and retries with the assertion. cy.location('pathname') yields just the path.