https://cypress.io logo
Hello people! As I mentioned here before my cy.ses...
# help
g
Hello people! As I mentioned here before my cy.session. I have ended up doing something like this:
Copy code
ts
Suite('My First Test', () => {
  before(() => {
    prepare();

    cy.visit('https://barrythrill.com');

    cy.get('.start-from-zero').should('be.visible').click();

    ...
  });

  Scenario('My first test cases', () => {
    Given('we are on the webpage');

    When('we save the list', () => {
          // no cy.visit
      ... // we save the list it will automatically login and it creates a cookie called BAR (has a dynamic cookie)
    });

    Then('we are able to open all-list and close it', () => {
      ... // no cy.visit
    });

    When('we remove the list through API', () => {
      ... // no cy.visit
    });
    Then('we should still be logged it', () => {
        ... // cy.visit(''https://barrythrill.com')
            // We should still be logged in through ` When('we save the list', ()`
    });
  });
});
I was not able to figure out how I can use cy.session here or to create a correct tests for my test cases. I wonder if anyone here can help me on either how I can improve my code where I can still be logged in through whole test or how I can implement cy.session without needing to call cy.visit for each
it
?