cy.location() do in Cypress?cy.location() gets information about the current URL of the page under test. It helps you check parts like the hostname, pathname, or protocol.
cy.location()?You use cy.location('pathname') to get just the path part of the URL, like /about or /products/123.
cy.location() to verify the domain name?Use cy.location('hostname') to get the domain name, like example.com.
cy.location()?Check the protocol by using cy.location('protocol').should('eq', 'https:'). This confirms the page is loaded over HTTPS.
cy.url() and cy.location()?cy.url() returns the full URL as a string. cy.location() returns an object with URL parts like pathname, hostname, and protocol. Use cy.location() to check specific parts easily.
cy.location() property gives you the path after the domain?The pathname property returns the part of the URL after the domain, like /home.
The protocol property shows the URL scheme. Checking it equals https: confirms HTTPS.
cy.location('hostname') return?hostname returns the domain name part of the URL.
cy.url() returns the full URL string.
cy.location() property do you use?The port property gives the port number from the URL.
cy.location() to verify different parts of a URL in a Cypress test.cy.url() and cy.location() and when to use each.