saleor-dashboard/cypress/support/index.js
Krzysztof Wolski c778c200ed
Move from test cafe to Cypress (#584)
* Typo

* Add cypress config

* Login and logout tests

* Typo

* Add basic test for warehouse

* Wrong password test

* Fixes and docs

* Remove testcafe

* Add gh action

* Update changelog

* Fix typo

* Update msgs

* Work on GH action

* Record artifacts

* Fix warehouse test
2020-07-20 11:42:44 +02:00

27 lines
627 B
JavaScript

Cypress.Commands.add("loginUser", (email, password) =>
cy
.get("input[name='email']")
.type(email)
.get("input[name='password']")
.type(password)
.get("[data-test=submit]")
.click()
);
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();
}
});
});