I am planning to update the Cypress version of an existing project from 6.9.1 to 12.6.0.
Currently we are navigating to a web page and logging in with ntlm-auth in a before() hook. After that the web page remains opened and can be used in all tests which are coming next.
In the latest Cypress version it seems that the page is being cleared and closed after each test case, which is the desired behavior to have better test cases as I understand.
But is there a way in the latest Cypress version to navigate to a web page in a before hook or in the first test, leave the page opened, then in the second test case to interact with it and navigate to another sections of the same page, leave the page opened, etc.?
The existing code structure looks like that:
before(() => {
cy.ntlm(
['<url>'],
<username>,
<password>
);
cy.visit(<url>);
});
it('Test 1', () => {
cy.contains('something').click();
});
it('Test 2', () => {
cy.get('#something').type('{enter}');
});
I have tried to save the session with cy.session() in the before hook and my idea was to restore the session/page in the next tests, but I am not sure if this would be the right approach.