2022-01-07 12:56:27 +00:00
|
|
|
import ListingPage from "../support/pages/admin_console/ListingPage";
|
2022-02-16 11:39:08 +00:00
|
|
|
import UserProfile from "../support/pages/admin_console/manage/realm_settings/UserProfile";
|
2022-01-07 12:56:27 +00:00
|
|
|
import SidebarPage from "../support/pages/admin_console/SidebarPage";
|
|
|
|
import LoginPage from "../support/pages/LoginPage";
|
|
|
|
import AdminClient from "../support/util/AdminClient";
|
2022-01-07 16:31:56 +00:00
|
|
|
import { keycloakBefore } from "../support/util/keycloak_hooks";
|
2022-01-07 12:56:27 +00:00
|
|
|
import ModalUtils from "../support/util/ModalUtils";
|
|
|
|
|
|
|
|
const loginPage = new LoginPage();
|
|
|
|
const sidebarPage = new SidebarPage();
|
2022-02-16 11:39:08 +00:00
|
|
|
const userProfileTab = new UserProfile();
|
2022-01-07 12:56:27 +00:00
|
|
|
const adminClient = new AdminClient();
|
|
|
|
const listingPage = new ListingPage();
|
|
|
|
const modalUtils = new ModalUtils();
|
|
|
|
|
|
|
|
// Selectors
|
2022-02-16 11:39:08 +00:00
|
|
|
const getUserProfileTab = () => userProfileTab.goToTab();
|
|
|
|
const getAttributesTab = () => userProfileTab.goToAttributesTab();
|
|
|
|
const getAttributesGroupTab = () => userProfileTab.goToAttributesGroupTab();
|
|
|
|
const getJsonEditorTab = () => userProfileTab.goToJsonEditorTab();
|
|
|
|
const clickCreateAttributeButton = () =>
|
|
|
|
userProfileTab.createAttributeButtonClick();
|
2022-01-07 12:56:27 +00:00
|
|
|
|
|
|
|
describe("User profile tabs", () => {
|
|
|
|
const realmName = "Realm_" + (Math.random() + 1).toString(36).substring(7);
|
|
|
|
|
|
|
|
before(() =>
|
|
|
|
adminClient.createRealm(realmName, {
|
|
|
|
attributes: { userProfileEnabled: "true" },
|
|
|
|
})
|
|
|
|
);
|
|
|
|
|
|
|
|
after(() => adminClient.deleteRealm(realmName));
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
keycloakBefore();
|
|
|
|
loginPage.logIn();
|
|
|
|
sidebarPage.goToRealm(realmName);
|
|
|
|
sidebarPage.goToRealmSettings();
|
|
|
|
});
|
|
|
|
|
2022-02-16 11:39:08 +00:00
|
|
|
describe("Attributes sub tab tests", () => {
|
|
|
|
it("Goes to create attribute page", () => {
|
|
|
|
getUserProfileTab();
|
|
|
|
getAttributesTab();
|
|
|
|
clickCreateAttributeButton();
|
|
|
|
cy.get("p").should("have.text", "Create attribute");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe("Attribute groups sub tab tests", () => {
|
|
|
|
it("Deletes an attributes group", () => {
|
2022-01-07 12:56:27 +00:00
|
|
|
cy.wrap(null).then(() =>
|
|
|
|
adminClient.patchUserProfile(realmName, {
|
|
|
|
groups: [{ name: "Test" }],
|
|
|
|
})
|
|
|
|
);
|
|
|
|
|
2022-02-16 11:39:08 +00:00
|
|
|
getUserProfileTab();
|
|
|
|
getAttributesGroupTab();
|
2022-01-07 12:56:27 +00:00
|
|
|
listingPage.deleteItem("Test");
|
|
|
|
modalUtils.confirmModal();
|
|
|
|
listingPage.itemExist("Test", false);
|
|
|
|
});
|
|
|
|
});
|
2022-02-16 11:39:08 +00:00
|
|
|
|
|
|
|
describe("Json Editor sub tab tests", () => {
|
|
|
|
it("Goes to Json Editor tab", () => {
|
|
|
|
getUserProfileTab();
|
|
|
|
getJsonEditorTab();
|
|
|
|
});
|
|
|
|
});
|
2022-01-07 12:56:27 +00:00
|
|
|
});
|