keycloak-scim/cypress/integration/users_test.spec.ts
Stan Silvert 398ca19ec1
Allow New Admin Console to run as a WAR on Keycloak server. (#439)
* Allow app to run as a WAR on Keycloak server.

* New client creation json that works for both dev and prod

* fixed tests

* Try Mark's trick to get realm_test to run.

* Make tests use keycloakBefore()

* Fix duplicate import

* fix github actions

Co-authored-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
2021-03-18 08:48:14 -04:00

79 lines
2.3 KiB
TypeScript

import SidebarPage from "../support/pages/admin_console/SidebarPage";
import LoginPage from "../support/pages/LoginPage";
import CreateUserPage from "../support/pages/admin_console/manage/users/CreateUserPage";
import Masthead from "../support/pages/admin_console/Masthead";
import ListingPage from "../support/pages/admin_console/ListingPage";
import UserDetailsPage from "../support/pages/admin_console/manage/users/UserDetailsPage";
import ModalUtils from "../support/util/ModalUtils";
import { keycloakBefore } from "../support/util/keycloak_before";
describe("Users test", () => {
const loginPage = new LoginPage();
const sidebarPage = new SidebarPage();
const createUserPage = new CreateUserPage();
const masthead = new Masthead();
const modalUtils = new ModalUtils();
const listingPage = new ListingPage();
const userDetailsPage = new UserDetailsPage();
let itemId = "user_crud";
describe("User creation", () => {
beforeEach(() => {
keycloakBefore();
loginPage.logIn();
sidebarPage.goToUsers();
});
it("Go to create User page", () => {
cy.wait(100);
createUserPage.goToCreateUser();
cy.url().should("include", "users/add-user");
// Verify Cancel button works
createUserPage.cancel();
cy.url().should("not.include", "/add-user");
});
it("Create user test", function () {
itemId += "_" + (Math.random() + 1).toString(36).substring(7);
// Create
cy.wait(100);
createUserPage.goToCreateUser();
createUserPage.createUser(itemId).save();
masthead.checkNotificationMessage("The user has been created");
sidebarPage.goToUsers();
});
it("Go to user details test", function () {
cy.wait(1000);
listingPage.searchItem(itemId).itemExist(itemId);
cy.wait(1000);
listingPage.goToItemDetails(itemId);
userDetailsPage.fillUserData().save();
masthead.checkNotificationMessage("The user has been saved");
sidebarPage.goToUsers();
listingPage.searchItem(itemId).itemExist(itemId);
// Delete
cy.wait(1000);
listingPage.deleteItem(itemId);
modalUtils.checkModalTitle("Delete user?").confirmModal();
masthead.checkNotificationMessage("The user has been deleted");
listingPage.itemExist(itemId, false);
});
});
});