2021-01-27 12:56:28 +00:00
|
|
|
import LoginPage from "../support/pages/LoginPage";
|
|
|
|
import Masthead from "../support/pages/admin_console/Masthead";
|
2022-01-07 07:27:58 +00:00
|
|
|
import { keycloakBefore } from "../support/util/keycloak_hooks";
|
2021-01-12 17:04:52 +00:00
|
|
|
|
2021-01-27 12:47:57 +00:00
|
|
|
const username = "admin";
|
|
|
|
const password = "admin";
|
2021-01-12 17:04:52 +00:00
|
|
|
|
2021-01-27 12:47:57 +00:00
|
|
|
const loginPage = new LoginPage();
|
|
|
|
const masthead = new Masthead();
|
2021-01-12 17:04:52 +00:00
|
|
|
|
2021-10-04 06:03:19 +00:00
|
|
|
describe("Logging In", () => {
|
|
|
|
beforeEach(() => {
|
2021-03-18 12:48:14 +00:00
|
|
|
keycloakBefore();
|
2021-01-27 12:47:57 +00:00
|
|
|
});
|
|
|
|
|
2021-10-04 06:03:19 +00:00
|
|
|
it("displays errors on wrong credentials", () => {
|
2021-03-18 12:48:14 +00:00
|
|
|
loginPage.logIn("wrong", "user{enter}");
|
|
|
|
|
|
|
|
loginPage.checkErrorMessage("Invalid username or password.").isLogInPage();
|
2021-01-27 12:47:57 +00:00
|
|
|
});
|
2021-01-21 12:09:50 +00:00
|
|
|
|
2021-10-04 06:03:19 +00:00
|
|
|
it("logs in", () => {
|
2021-01-27 12:47:57 +00:00
|
|
|
loginPage.logIn(username, password);
|
2021-01-21 12:09:50 +00:00
|
|
|
|
2022-01-05 09:56:38 +00:00
|
|
|
masthead.checkIsAdminConsole();
|
2021-01-21 12:09:50 +00:00
|
|
|
|
2021-01-27 12:47:57 +00:00
|
|
|
cy.getCookie("KEYCLOAK_SESSION_LEGACY").should("exist");
|
2021-01-21 12:09:50 +00:00
|
|
|
});
|
|
|
|
});
|