Test Automation Stack

Cypress clears cookies and local storage before running every test by default. But we can let cypress know to cache the cookies and local storage using cy.session function.

Say you have multiple tests where you need to login every time before performing next set of tests, in this case you can wrap your login code inside cy.session function so that cookies and local storage are cached in the cypress session and same is reused.

Below code shows an example for same.

Leave a comment

I’m Gurudatt

Profile Pic

With over 12 years of quality assurance experience, i have used various test automation tools and testing concepts and helped organization and teams to speed up testing process effectively. I’m also a Cypress.io Ambassador and BrowserStack Champion.

Let’s connect

Discover more from Test Automation Stack

Subscribe now to keep reading and get access to the full archive.

Continue reading