keycloak-scim/tests/cypress/integration/login_test.spec.js
Stan Silvert f2e26b0049
Cypress tests for masthead. (#304)
* Cypress tests for masthead.

* Update snapshot

* Update Keycloak version.

* Fix download address

* Update start.js

Co-authored-by: Erik Jan de Wit <erikjan.dewit@gmail.com>

* Follow redirect when downloading keycloak.

* Refactor HeaderPage into Masthead and ModalUtils

* Minor change to kick off build.

* logOutTest no longer needs a param

* goToAcctMgtTest no longer needs a param

* Update tests/cypress/support/pages/admin_console/Masthead.js

Co-authored-by: Aboullos <61687012+Aboullos@users.noreply.github.com>

* Update tests/cypress/support/pages/admin_console/Masthead.js

Co-authored-by: Aboullos <61687012+Aboullos@users.noreply.github.com>

* Fix userDropdown() method

* Minor refactor

Co-authored-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
Co-authored-by: Aboullos <61687012+Aboullos@users.noreply.github.com>
2021-01-21 07:09:50 -05:00

31 lines
820 B
JavaScript

import LoginPage from "./../support/pages/LoginPage.js";
import Masthead from "./../support/pages/admin_console/Masthead.js";
describe("Logging In", function () {
const username = "admin";
const password = "admin";
const loginPage = new LoginPage();
const masthead = new Masthead();
describe("Login form submission", function () {
beforeEach(function () {
cy.visit("");
});
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");
});
});
});