cy.url() do in Cypress?cy.url() gets the current URL of the page being tested. It allows you to check or assert the URL during your test.
cy.url()?Use cy.url().should('include', 'string') to check if the current URL contains the given string.
Use cy.url().should('eq', 'https://example.com') to assert the URL equals the exact string.
cy.url()?Use cy.url().should('match', /pattern/) where /pattern/ is a regular expression to test the URL.
Asserting the URL confirms the app navigated to the correct page, just like checking the address on a letter to make sure it reached the right place.
include is the correct assertion to check if the URL contains a substring.
eq asserts exact equality of the URL string.
match accepts a regex to test the URL pattern.
cy.url() return?cy.url() gets the current URL string of the page.
URL assertions confirm the app navigated to the right page.
cy.url() to check if the current URL contains a specific word.