chilly-quill-34099
08/24/2022, 5:39 PMcy.loginWithApiCall()-function is creating several items in the local storage, which than is being used by the website to authenticate the user.
The problem which I am facing is with sessions:
Currently I have to login for every test, which might lead to a lock down of the account (because of to many calls in a certain period). I would prefer to stay logged in, if that is possible, but have separate tests (it('test1'), ...). Is that possible, or is it prevented by design to have isolated tests?
ts
/// <reference types="cypress" />
describe('Dashboard', () => {
it('login via RPOC works correctly', () => {
cy.session('mySession', () => {
cy.loginWithApiCall(); //👈call for each test
cy.visit('/').url().should('include', '/portal');
});
});
it('"Welcome" is visible', () => {
cy.session('mySession', () => {
cy.loginWithApiCall(); //👈call for each test
cy.visit('/portal').contains('Welcome');
});
});
});
The strange part is, that the cy.beforeEach() function does not work as well (Is it because it is outside the session?).
I would think, that I could reuse a session with the same ID, but I guess this is isolated for each it() function?