saleor-dashboard/cypress/integration/login_form.js
Karolina Rakoczy 1f01a09e87
add tags (#1251)
* add tags

* edit e2e.yaml

* fix test for customer registration

* add empty lines
2021-07-23 12:46:44 +03:00

42 lines
1.2 KiB
JavaScript

// <reference types="cypress" />
import { LOGIN_SELECTORS } from "../elements/account/login-selectors";
import filterTests from "../support/filterTests";
import { urlList } from "../url/urlList";
filterTests(["all"], () => {
describe("User authorization", () => {
beforeEach(() => {
cy.clearSessionData();
});
it("should successfully log in an user", () => {
cy.visit(urlList.homePage);
cy.loginUser();
cy.get(LOGIN_SELECTORS.welcomePage);
});
it("should fail for wrong password", () => {
cy.visit(urlList.homePage)
.get(LOGIN_SELECTORS.emailAddressInput)
.type("admin@example.com")
.get(LOGIN_SELECTORS.emailPasswordInput)
.type("wrong-password")
.get(LOGIN_SELECTORS.signInButton)
.click()
.get(LOGIN_SELECTORS.warningCredentialMessage);
});
it("should successfully log out an user", () => {
cy.window().then(win => {
win.sessionStorage.clear();
});
cy.visit(urlList.homePage);
cy.loginUser();
cy.get(LOGIN_SELECTORS.userMenu)
.click()
.get(LOGIN_SELECTORS.accountSettings)
.click();
cy.location("pathname").should("contains", "/staff/");
});
});
});