Connor's Code & Coffee

Connor's Code & Coffee

  • Blog
  • About
  • Contact

8/23/2021

Clear Browser Data Cypress

1 Comment

Read Now
 

When writing UI tests its often useful to reset the browser to a clean state.

Cypress has commands for clearing cookies cy.clearCookies(), and also resetting local storage, cy.clearLocalStorage().
​However there isn't a command for clearing session storage. Add a custom cypress command more info.
​Add to cypress/support/commands.js (or .ts if typescript)

    
Then in ​cypress/support/index.js (or .ts if typescript)

    
Then our final finished function is

    

Share

1 Comment
Cole
8/23/2021 12:14:06 pm

Very interesting

Reply



Leave a Reply.

Details

    Author

    Hi I'm Connor, I've been programming for awhile and then decided to make it my career. Hope you find it as interesting as I do!

    Categories

    All

    RSS Feed

Powered by Create your own unique website with customizable templates.
  • Blog
  • About
  • Contact