2021-09-27 10:04:21 +00:00
|
|
|
/// <reference types="cypress"/>
|
|
|
|
/// <reference types="../support"/>
|
|
|
|
|
2021-07-23 09:46:44 +00:00
|
|
|
import { LOGIN_SELECTORS } from "../elements/account/login-selectors";
|
2021-09-27 10:04:21 +00:00
|
|
|
import { urlList } from "../fixtures/urlList";
|
2021-07-23 09:46:44 +00:00
|
|
|
|
2022-06-27 09:30:51 +00:00
|
|
|
describe("User authorization", () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
cy.clearSessionData();
|
|
|
|
});
|
2021-07-23 09:46:44 +00:00
|
|
|
|
2022-06-27 09:30:51 +00:00
|
|
|
it(
|
|
|
|
"should successfully log in an user",
|
|
|
|
{ tags: ["@login", "@allEnv", "@stable"] },
|
|
|
|
() => {
|
2021-07-23 09:46:44 +00:00
|
|
|
cy.visit(urlList.homePage);
|
|
|
|
cy.loginUser();
|
2021-12-05 15:03:29 +00:00
|
|
|
cy.get(LOGIN_SELECTORS.welcomePage).should("be.visible");
|
2022-06-27 16:49:35 +00:00
|
|
|
},
|
2022-06-27 09:30:51 +00:00
|
|
|
);
|
2021-07-23 09:46:44 +00:00
|
|
|
|
2022-06-27 09:30:51 +00:00
|
|
|
it(
|
|
|
|
"should fail for wrong password",
|
|
|
|
{ tags: ["@login", "@allEnv", "@stable"] },
|
|
|
|
() => {
|
2021-07-23 09:46:44 +00:00
|
|
|
cy.visit(urlList.homePage)
|
|
|
|
.get(LOGIN_SELECTORS.emailAddressInput)
|
|
|
|
.type("admin@example.com")
|
|
|
|
.get(LOGIN_SELECTORS.emailPasswordInput)
|
|
|
|
.type("wrong-password")
|
|
|
|
.get(LOGIN_SELECTORS.signInButton)
|
|
|
|
.click()
|
2021-12-05 15:03:29 +00:00
|
|
|
.get(LOGIN_SELECTORS.warningCredentialMessage)
|
|
|
|
.should("be.visible");
|
2022-06-27 16:49:35 +00:00
|
|
|
},
|
2022-06-27 09:30:51 +00:00
|
|
|
);
|
2021-07-23 09:46:44 +00:00
|
|
|
|
2022-06-27 09:30:51 +00:00
|
|
|
it(
|
|
|
|
"should successfully log out an user",
|
|
|
|
{ tags: ["@login", "@allEnv", "@stable"] },
|
|
|
|
() => {
|
2021-12-05 15:03:29 +00:00
|
|
|
cy.clearSessionData()
|
|
|
|
.loginUserViaRequest()
|
|
|
|
.visit(urlList.homePage)
|
|
|
|
.get(LOGIN_SELECTORS.userMenu)
|
2021-07-23 09:46:44 +00:00
|
|
|
.click()
|
2021-12-05 15:03:29 +00:00
|
|
|
.get(LOGIN_SELECTORS.logOutButton)
|
|
|
|
.click()
|
|
|
|
.get(LOGIN_SELECTORS.emailAddressInput)
|
|
|
|
.should("be.visible");
|
2022-06-27 16:49:35 +00:00
|
|
|
},
|
2022-06-27 09:30:51 +00:00
|
|
|
);
|
2021-07-23 09:46:44 +00:00
|
|
|
});
|