
* add update data test ids * fix not changed test ids * fix data-test-id for gift cards * remove comment * fix base url
45 lines
1.4 KiB
JavaScript
45 lines
1.4 KiB
JavaScript
/// <reference types="cypress"/>
|
|
/// <reference types="../support"/>
|
|
|
|
import { LOGIN_SELECTORS } from "../elements/account/login-selectors";
|
|
import { HOMEPAGE_SELECTORS } from "../elements/homePage/homePage-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).should("be.visible");
|
|
});
|
|
|
|
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)
|
|
.should("be.visible");
|
|
});
|
|
|
|
it("should successfully log out an user", () => {
|
|
cy.clearSessionData()
|
|
.loginUserViaRequest()
|
|
.visit(urlList.homePage)
|
|
.get(LOGIN_SELECTORS.userMenu)
|
|
.click()
|
|
.get(LOGIN_SELECTORS.logOutButton)
|
|
.click()
|
|
.get(LOGIN_SELECTORS.emailAddressInput)
|
|
.should("be.visible");
|
|
});
|
|
});
|
|
});
|