Cypress session erratic behavior

Viewed 12

I have this very simple test in which I attempt to set some stuff as a host and then check them as guest. So I do it as follows:

I setup a session in the describe block as follows:

describe("Test", () => {
  const signup = (name) => {
    cy.session(name, () => {
      cy.signUp();
    });
  };

And then later I start the test signing up a host like

signup("host");

I do stuff as host that I later want to check with a guest. So I manually sign off and do:

signup("guest");

And check stuff as guest.

But for some reason I don't understand the host session remains sometimes. Not always. I don't know why this happens and I suspect I may be using cy.session the wrong way, but then why does it work every now and then?

0 Answers
Related