saleor-dashboard/cypress/integration/login_form.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

35 lines
979 B
JavaScript

// <reference types="cypress" />
describe("User authorization", () => {
beforeEach(() => {
cy.clearSessionData();
});
describe("Login", () => {
it("should successfully log in an user", () => {
cy.visit("/");
cy.loginUser("admin@example.com", "admin");
cy.get("[data-test=welcomeHeader]").contains("Hello there");
});
it("should fail for wrong password", () => {
cy.visit("/");
cy.loginUser("admin@example.com", "wrong-password");
cy.get("[data-test=loginErrorMessage]");
});
});
describe("Logout", () => {
it("should successfully log out an user", () => {
cy.window().then(win => {
win.sessionStorage.clear();
});
cy.visit("/");
cy.loginUser("admin@example.com", "admin");
cy.get("[data-test=userMenu]")
.click()
.get("[data-test=accountSettingsButton]")
.click();
cy.location("pathname").should("contains", "/staff/");
});
});
});