Cypress · Junior · Question 22 of 75

Which assertion checks the current URL contains /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.

Further reading

Problem with a question

Cypress · Junior · question 22

Test yourself

Take the Cypress · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz