I'm trying to improve our tests' performance by ut...
# e2e-testing
e
I'm trying to improve our tests' performance by utilizing the new
testIsolation=legacy
option to prevent page reloads between tests that don't need to refresh the entire page. Currently we do the following
Copy code
js
beforeEach(() => {
  cy.login()
  cy.visit("/some-page-to-test")
})
Where
cy.login()
is a custom command that uses
cy.session()
to login as recommended in the docs. Since we now no longer want to reset the page between every test. I've moved this code from
beforeEach
to
before
so we only run it once per suite. This works fine for the first test, but after the first test it gets redirected to our login page since we no longer call
cy.login()
between tests. Splitting it up so we do the
visit()
in
before
and
login
in
beforeEach
seems like it should help, but this causes it to end up at the
about:blank
page since
cy.session()
seems to always clear the page after running, regardless of the
testisolation
option. If it is indeed the case that
cy.session()
always clears the page, then I wonder what the point of the
testIsolation
option is? Unless I am misunderstanding/misusing it?