8d72f8a705
* upgrade cypress * fixed delete now has dialog * also check "unAssign" * client type no longer required * providers and group changes * grp creation working * moved create realm button ouside the dropdown * sped up test and added cleanup * Revert "moved create realm button ouside the dropdown" This reverts commit e2076a5305808417de910ba8fada8e528e5c356a. * make test re-runnable * removed un needed navigation * Fix misformed Cypress config for GitHub Action * cleanup after test * fixed cleanup * temporary removed this test * also remove user "new" * try adding a wait for CI * get different modal id * add {force: true} to modal functions * mv grp search last and ignore 401 * try using cy.get and disable video for testing * add back video artifacts Co-authored-by: mfrances <mfrances@redhat.com> Co-authored-by: Jon Koops <jonkoops@gmail.com> Co-authored-by: jenny-s51 <jshandel@redhat.com>
167 lines
4.6 KiB
TypeScript
167 lines
4.6 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";
|
|
import GroupModal from "../support/pages/admin_console/manage/groups/GroupModal";
|
|
import UserGroupsPage from "../support/pages/admin_console/manage/users/UserGroupsPage";
|
|
import AdminClient from "../support/util/AdminClient";
|
|
|
|
let groupName = "group";
|
|
let groupsList: string[] = [];
|
|
|
|
describe("Group creation", () => {
|
|
const loginPage = new LoginPage();
|
|
const masthead = new Masthead();
|
|
const sidebarPage = new SidebarPage();
|
|
const groupModal = new GroupModal();
|
|
|
|
beforeEach(() => {
|
|
keycloakBefore();
|
|
loginPage.logIn();
|
|
sidebarPage.goToGroups();
|
|
});
|
|
|
|
function createNewGroup() {
|
|
groupName += "_" + (Math.random() + 1).toString(36).substring(7);
|
|
|
|
groupModal
|
|
.open("openCreateGroupModal")
|
|
.fillGroupForm(groupName)
|
|
.clickCreate();
|
|
|
|
groupsList = [...groupsList, groupName];
|
|
masthead.checkNotificationMessage("Group created");
|
|
|
|
sidebarPage.goToGroups();
|
|
}
|
|
|
|
it("Add groups to be joined", () => {
|
|
for (let i = 0; i <= 2; i++) {
|
|
createNewGroup();
|
|
}
|
|
});
|
|
});
|
|
|
|
describe("Users test", () => {
|
|
const loginPage = new LoginPage();
|
|
const sidebarPage = new SidebarPage();
|
|
const createUserPage = new CreateUserPage();
|
|
const userGroupsPage = new UserGroupsPage();
|
|
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();
|
|
});
|
|
|
|
after(async () => {
|
|
await new AdminClient().deleteGroups();
|
|
});
|
|
|
|
it("Go to create User page", () => {
|
|
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", () => {
|
|
itemId += "_" + (Math.random() + 1).toString(36).substring(7);
|
|
|
|
// Create
|
|
createUserPage.goToCreateUser();
|
|
|
|
createUserPage.createUser(itemId);
|
|
|
|
createUserPage.toggleAddGroupModal();
|
|
|
|
const groupsListCopy = groupsList.slice(0, 1);
|
|
|
|
console.log(groupsList);
|
|
|
|
groupsListCopy.forEach((element) => {
|
|
cy.getId(`${element}-check`).click();
|
|
});
|
|
|
|
createUserPage.joinGroups();
|
|
|
|
createUserPage.save();
|
|
|
|
masthead.checkNotificationMessage("The user has been created");
|
|
|
|
sidebarPage.goToUsers();
|
|
});
|
|
|
|
it("User details test", () => {
|
|
listingPage.searchItem(itemId).itemExist(itemId);
|
|
|
|
listingPage.goToItemDetails(itemId);
|
|
|
|
userDetailsPage.fillUserData().save();
|
|
|
|
masthead.checkNotificationMessage("The user has been saved");
|
|
|
|
sidebarPage.goToUsers();
|
|
listingPage.searchItem(itemId).itemExist(itemId);
|
|
});
|
|
|
|
it("Add user to groups test", () => {
|
|
// Go to user groups
|
|
listingPage.searchItem(itemId).itemExist(itemId);
|
|
listingPage.goToItemDetails(itemId);
|
|
|
|
userGroupsPage.goToGroupsTab();
|
|
userGroupsPage.toggleAddGroupModal();
|
|
|
|
const groupsListCopy = groupsList.slice(1, 2);
|
|
|
|
groupsListCopy.forEach((element) => {
|
|
cy.getId(`${element}-check`).click();
|
|
});
|
|
|
|
userGroupsPage.joinGroups();
|
|
});
|
|
|
|
it("Leave group test", () => {
|
|
listingPage.searchItem(itemId).itemExist(itemId);
|
|
listingPage.goToItemDetails(itemId);
|
|
// Go to user groups
|
|
userGroupsPage.goToGroupsTab();
|
|
cy.contains("Leave").click();
|
|
cy.getId("modalConfirm").click();
|
|
});
|
|
|
|
it("Go to user consents test", () => {
|
|
listingPage.searchItem(itemId).itemExist(itemId);
|
|
|
|
listingPage.goToItemDetails(itemId);
|
|
|
|
cy.getId("user-consents-tab").click();
|
|
cy.getId("empty-state").contains("No consents");
|
|
});
|
|
|
|
it("Delete user test", () => {
|
|
// Delete
|
|
listingPage.deleteItem(itemId);
|
|
|
|
modalUtils.checkModalTitle("Delete user?").confirmModal();
|
|
|
|
masthead.checkNotificationMessage("The user has been deleted");
|
|
|
|
listingPage.itemExist(itemId, false);
|
|
});
|
|
});
|
|
});
|