
* reference type cypress working * refactor * remove screenshots * add reference * add slash marker * run tests based on shop version * fix run tests based on shop version * fix run tests based on shop version * change base url to localhost * fix plugins * fix plugins * fix plugins * fix plugins * fix plugins * fix plugins * fix yml * fix yml * chage file names * fix files names * fix broken imports add checking for errors in grpah responses * fix broken imports add checking for errors in grpah responses * update jest * fix snapshot
44 lines
1.3 KiB
JavaScript
44 lines
1.3 KiB
JavaScript
/// <reference types="cypress"/>
|
|
/// <reference types="../support"/>
|
|
|
|
import { LOGIN_SELECTORS } from "../elements/account/login-selectors";
|
|
import { urlList } from "../fixtures/urlList";
|
|
import filterTests from "../support/filterTests";
|
|
|
|
filterTests({ definedTags: ["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/");
|
|
});
|
|
});
|
|
});
|