2022-12-07 15:28:28 +00:00
|
|
|
import ListingPage from "../support/pages/admin-ui/ListingPage";
|
2023-12-07 14:34:31 +00:00
|
|
|
import ClientRolesTab from "../support/pages/admin-ui/manage/clients/ClientRolesTab";
|
2022-02-09 11:46:58 +00:00
|
|
|
import UserRegistration, {
|
|
|
|
GroupPickerDialog,
|
2022-12-07 15:28:28 +00:00
|
|
|
} from "../support/pages/admin-ui/manage/realm_settings/UserRegistration";
|
|
|
|
import Masthead from "../support/pages/admin-ui/Masthead";
|
|
|
|
import SidebarPage from "../support/pages/admin-ui/SidebarPage";
|
2022-02-09 11:46:58 +00:00
|
|
|
import LoginPage from "../support/pages/LoginPage";
|
2022-02-24 10:31:46 +00:00
|
|
|
import adminClient from "../support/util/AdminClient";
|
2022-03-09 16:42:51 +00:00
|
|
|
import { keycloakBefore } from "../support/util/keycloak_hooks";
|
2022-02-16 16:34:54 +00:00
|
|
|
import ModalUtils from "../support/util/ModalUtils";
|
2022-02-09 11:46:58 +00:00
|
|
|
|
|
|
|
describe("Realm settings - User registration tab", () => {
|
|
|
|
const loginPage = new LoginPage();
|
|
|
|
const sidebarPage = new SidebarPage();
|
2022-02-16 16:34:54 +00:00
|
|
|
const modalUtils = new ModalUtils();
|
2022-02-09 11:46:58 +00:00
|
|
|
const masthead = new Masthead();
|
|
|
|
|
|
|
|
const listingPage = new ListingPage();
|
|
|
|
const groupPicker = new GroupPickerDialog();
|
|
|
|
const userRegistration = new UserRegistration();
|
2023-12-07 14:34:31 +00:00
|
|
|
const rolesTab = new ClientRolesTab();
|
2022-02-09 11:46:58 +00:00
|
|
|
|
|
|
|
const groupName = "The default group";
|
|
|
|
|
2023-02-10 10:10:35 +00:00
|
|
|
before(() => adminClient.createGroup(groupName));
|
2022-02-09 11:46:58 +00:00
|
|
|
|
|
|
|
beforeEach(() => {
|
2023-02-10 10:10:35 +00:00
|
|
|
loginPage.logIn();
|
|
|
|
keycloakBefore();
|
2022-02-09 11:46:58 +00:00
|
|
|
sidebarPage.goToRealmSettings();
|
|
|
|
userRegistration.goToTab();
|
|
|
|
});
|
|
|
|
|
|
|
|
after(() => adminClient.deleteGroups());
|
|
|
|
|
2022-02-16 16:34:54 +00:00
|
|
|
it("Add admin role", () => {
|
2022-02-09 11:46:58 +00:00
|
|
|
const role = "admin";
|
2022-02-16 16:34:54 +00:00
|
|
|
userRegistration.addRole();
|
|
|
|
sidebarPage.waitForPageLoad();
|
2022-02-09 11:46:58 +00:00
|
|
|
userRegistration.selectRow(role).assign();
|
|
|
|
masthead.checkNotificationMessage("Associated roles have been added");
|
|
|
|
listingPage.searchItem(role, false).itemExist(role);
|
2023-12-07 14:34:31 +00:00
|
|
|
|
|
|
|
sidebarPage.goToRealmRoles();
|
|
|
|
listingPage.goToItemDetails("admin");
|
|
|
|
rolesTab.goToUsersInRoleTab();
|
|
|
|
cy.findByTestId("users-in-role-table").contains("admin");
|
2022-02-09 11:46:58 +00:00
|
|
|
});
|
|
|
|
|
2022-02-16 16:34:54 +00:00
|
|
|
it("Remove admin role", () => {
|
|
|
|
const role = "admin";
|
2022-09-16 08:58:43 +00:00
|
|
|
listingPage.markItemRow(role).removeMarkedItems("Unassign");
|
2022-02-16 16:34:54 +00:00
|
|
|
sidebarPage.waitForPageLoad();
|
|
|
|
modalUtils
|
2022-12-02 09:41:30 +00:00
|
|
|
.checkModalTitle("Remove role?")
|
|
|
|
.checkModalMessage("Are you sure you want to remove this role?")
|
2022-02-16 16:34:54 +00:00
|
|
|
.checkConfirmButtonText("Remove")
|
|
|
|
.confirmModal();
|
2022-09-16 08:58:43 +00:00
|
|
|
masthead.checkNotificationMessage("Scope mapping successfully removed");
|
2022-02-16 16:34:54 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it("Add default group", () => {
|
|
|
|
userRegistration.goToDefaultGroupTab().addDefaultGroup();
|
2022-02-09 11:46:58 +00:00
|
|
|
groupPicker.checkTitle("Add default groups").clickRow(groupName).clickAdd();
|
|
|
|
masthead.checkNotificationMessage("New group added to the default groups");
|
|
|
|
listingPage.itemExist(groupName);
|
|
|
|
});
|
|
|
|
});
|