powerful-toothbrush-36495
04/26/2023, 2:47 PMechoing-tent-95037
04/26/2023, 2:57 PMbefore() with your login and cy.storeLocalStorage() , and then within a beforeEach() try using cy.restoreLocalStorage()powerful-toothbrush-36495
04/26/2023, 3:00 PMdescribe("Login", () => {
before()
cy.storeLocalStorage()
it("tests Login", () => {
cy.viewport(1920, 1080);
cy.visit("https://staging.pabau.com/");
cy.get("#email").click();
cy.get("#email").type("automation@automation.com");
cy.get("#password").click();
cy.get("#password").type("Automation123@");
cy.get("button").click();
});
});
?enough-truck-68085
04/26/2023, 3:11 PMcy.session which will automatically persist all the storage and cookie data for the session.
Maybe read up on this command and look at their examples?
https://docs.cypress.io/api/commands/sessiongray-kilobyte-89541
04/26/2023, 5:08 PMpowerful-toothbrush-36495
04/26/2023, 6:29 PMenough-truck-68085
04/26/2023, 6:30 PMpowerful-toothbrush-36495
04/26/2023, 6:31 PMenough-truck-68085
04/26/2023, 6:31 PMcy.session definitely builds on several other concepts and commands first. If you are completely new to Cypress and how it works I'd start from the beginning of their documentation to break it down even more before diving into the deep endpowerful-toothbrush-36495
04/26/2023, 6:32 PMpowerful-toothbrush-36495
04/26/2023, 6:35 PMenough-truck-68085
04/26/2023, 6:35 PMbefore and beforeEach hooks.
There's definitely a balance because you don't want to have a mega-spec either where it's too hard to read and everything is jammed into a single file.
Use best judgement when organizing, writing, and reading tests so that they scale appropriately.powerful-toothbrush-36495
04/26/2023, 6:36 PMenough-truck-68085
04/26/2023, 6:39 PMpowerful-toothbrush-36495
04/26/2023, 6:41 PMechoing-tent-95037
04/26/2023, 8:34 PMdata-testid for elements that way when devs start adjusting the frontend those data-testid attributes wont change.powerful-toothbrush-36495
04/28/2023, 8:56 PM