https://cypress.io logo
Hi everyone, I have the following in my `e2e.js` f...
# e2e-testing
a
Hi everyone, I have the following in my
e2e.js
file (see file attached), that works pretty good for me, but I face a problem, if a test fails or for some reason is not finished, and the next one is going to run, Cypress is logging in with the account of the test that failed, even if I have one of these options set in before/beforeEach/after/afterEach: -
cy.clearCookies
-
Copy code
cy.clearCookie('sessionID')
-
Cypress.session.clearAllSavedSessions()` I logging as follow: Cypress.Commands.add('loginByAPI', (email, password='mypassword') => { cy.clearCookies('sessionID') //added this to try here cy.request({ method: 'POST', url: Cypress.env('accountAPIUrl') + '/security/login2', body: { "email": email, "password": password, } }).then((response) => { expect(response.status).to.eq(200) cy.log({ name: 'loginResponse', message: response.body.sessionID }) cy.log({ name: 'loginResponse', message: response.body.email }) cy.setCookie('sessionID', response.body.sessionID) cy.visit(
/
); }) })