2021-01-21 12:09:50 +00:00
|
|
|
import LoginPage from "./../support/pages/LoginPage.js";
|
|
|
|
import Masthead from "./../support/pages/admin_console/Masthead.js";
|
2021-01-12 17:04:52 +00:00
|
|
|
|
2021-01-21 12:09:50 +00:00
|
|
|
describe("Logging In", function () {
|
|
|
|
const username = "admin";
|
|
|
|
const password = "admin";
|
2021-01-12 17:04:52 +00:00
|
|
|
|
2021-01-21 12:09:50 +00:00
|
|
|
const loginPage = new LoginPage();
|
|
|
|
const masthead = new Masthead();
|
2021-01-12 17:04:52 +00:00
|
|
|
|
2021-01-21 12:09:50 +00:00
|
|
|
describe("Login form submission", function () {
|
|
|
|
beforeEach(function () {
|
|
|
|
cy.visit("");
|
|
|
|
});
|
2021-01-12 17:04:52 +00:00
|
|
|
|
2021-01-21 12:09:50 +00:00
|
|
|
it("displays errors on login", function () {
|
|
|
|
loginPage
|
|
|
|
.logIn("wrong", "user{enter}")
|
|
|
|
.checkErrorMessage("Invalid username or password.")
|
|
|
|
.isLogInPage();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("redirects to admin console on success", function () {
|
|
|
|
loginPage.logIn(username, password);
|
|
|
|
|
|
|
|
masthead.isAdminConsole();
|
|
|
|
|
|
|
|
cy.getCookie("KEYCLOAK_SESSION_LEGACY").should("exist");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|