As part of my Cypress test, I am trying to log into an application.
The problem is that when I run the test a second time, I am already logged in, due to the previous test, so I'm not brought to the sign-in page & the login test fails.
Below is the storage when I run the test:
I assume this bluelibs-token value is the reason I'm already logged in.
I have tried to clear the storage/cookies before the test run, but I'm still logged in.
Below is my test code:
before(() => {
cy.clearLocalStorage('bluelibs-token')
cy.clearLocalStorage()
cy.clearCookies()
})
beforeEach(() => {
cy.visit('/')
})
it('First Test Case', () => {
cy.contains('Sign In').click();
// this fails as I am brought to the user's account rather than the sign-in page (I would be brought to the sign-in page if I wasn't logged in)
})
Can someone please point out why this token is not being cleared, & how I can log in during each test?
