saleor-dashboard/cypress/support/index.js
M.Graczyk ef967eb5e4
Refactor of login tests (#630)
* WIP refactor of login tests

* Xit not woriking tests, fixed rest of them

* Properly pass env vars to cypress

* Remove unused code

Co-authored-by: Krzysztof Wolski <krzysztof.k.wolski@gmail.com>
2020-08-20 15:36:00 +02:00

19 lines
433 B
JavaScript

import "./user";
Cypress.Commands.add("clearSessionData", () => {
// Because of known cypress bug, not all local storage data are cleared.
// Here is workaround to ensure tests have no side effects.
// Suggested usage:
// beforeEach(() => {
// cy.clearSessionData();
// });
cy.clearCookies();
cy.clearLocalStorage();
cy.visit("/", {
onBeforeLoad: win => {
win.sessionStorage.clear();
}
});
});