2021-12-06 10:50:29 +00:00
|
|
|
import SidebarPage from "../support/pages/admin_console/SidebarPage";
|
|
|
|
import LoginPage from "../support/pages/LoginPage";
|
|
|
|
import RealmSettingsPage from "../support/pages/admin_console/manage/realm_settings/RealmSettingsPage";
|
2022-01-24 14:17:55 +00:00
|
|
|
import {
|
|
|
|
keycloakBefore,
|
|
|
|
keycloakBeforeEach,
|
|
|
|
} from "../support/util/keycloak_hooks";
|
2021-12-06 10:50:29 +00:00
|
|
|
import AdminClient from "../support/util/AdminClient";
|
2022-02-16 16:34:54 +00:00
|
|
|
import ModalUtils from "../support/util/ModalUtils";
|
|
|
|
import Masthead from "../support/pages/admin_console/Masthead";
|
2021-12-06 10:50:29 +00:00
|
|
|
|
|
|
|
const loginPage = new LoginPage();
|
|
|
|
const sidebarPage = new SidebarPage();
|
2022-02-16 16:34:54 +00:00
|
|
|
const modalUtils = new ModalUtils();
|
|
|
|
const masthead = new Masthead();
|
2021-12-06 10:50:29 +00:00
|
|
|
|
|
|
|
describe("Realm settings client profiles tab tests", () => {
|
2022-02-16 16:34:54 +00:00
|
|
|
const profileName = "Test";
|
|
|
|
const editedProfileName = "Edit";
|
2021-12-06 10:50:29 +00:00
|
|
|
const realmName = "Realm_" + (Math.random() + 1).toString(36).substring(7);
|
2022-01-24 14:17:55 +00:00
|
|
|
const realmSettingsPage = new RealmSettingsPage(realmName);
|
2021-12-06 10:50:29 +00:00
|
|
|
|
|
|
|
beforeEach(() => {
|
2022-01-24 14:17:55 +00:00
|
|
|
keycloakBeforeEach();
|
2022-02-16 16:34:54 +00:00
|
|
|
sidebarPage.waitForPageLoad().goToRealm(realmName).goToRealmSettings();
|
|
|
|
realmSettingsPage.goToClientPoliciesTab().goToClientProfilesList();
|
2021-12-06 10:50:29 +00:00
|
|
|
});
|
|
|
|
|
2022-01-24 14:17:55 +00:00
|
|
|
before(() => {
|
|
|
|
keycloakBefore();
|
|
|
|
new AdminClient().createRealm(realmName);
|
|
|
|
loginPage.logIn();
|
2021-12-06 10:50:29 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
after(async () => {
|
|
|
|
await new AdminClient().deleteRealm(realmName);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Go to client policies profiles tab", () => {
|
|
|
|
realmSettingsPage.shouldDisplayProfilesTab();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Check new client form is displaying", () => {
|
|
|
|
realmSettingsPage.shouldDisplayNewClientProfileForm();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Complete new client form and cancel", () => {
|
2022-02-16 16:34:54 +00:00
|
|
|
realmSettingsPage
|
|
|
|
.createClientProfile(profileName, "Test Description")
|
|
|
|
.cancelClientProfileCreation()
|
|
|
|
.checkElementNotInList(profileName);
|
2021-12-06 10:50:29 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it("Complete new client form and submit", () => {
|
2022-02-16 16:34:54 +00:00
|
|
|
const url = `/auth/admin/realms/${realmName}/client-policies/profiles`;
|
|
|
|
cy.intercept("PUT", url).as("save");
|
|
|
|
realmSettingsPage
|
|
|
|
.createClientProfile(profileName, "Test Description")
|
|
|
|
.saveClientProfileCreation();
|
|
|
|
cy.wait("@save");
|
|
|
|
masthead.checkNotificationMessage("New client profile created");
|
2021-12-06 10:50:29 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it("Should perform client profile search by profile name", () => {
|
2022-02-16 16:34:54 +00:00
|
|
|
realmSettingsPage.searchClientProfile(profileName);
|
2021-12-06 10:50:29 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it("Check navigating between Form View and JSON editor", () => {
|
|
|
|
realmSettingsPage.shouldNavigateBetweenFormAndJSONView();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Check saving changed JSON profiles", () => {
|
|
|
|
realmSettingsPage.shouldSaveChangedJSONProfiles();
|
2022-02-16 16:34:54 +00:00
|
|
|
realmSettingsPage.deleteClientPolicyItemFromTable(profileName);
|
|
|
|
modalUtils.confirmModal();
|
|
|
|
masthead.checkNotificationMessage("Client profile deleted");
|
|
|
|
realmSettingsPage.checkElementNotInList(profileName);
|
2021-12-06 10:50:29 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it("Should not create duplicate client profile", () => {
|
2022-02-16 16:34:54 +00:00
|
|
|
const url = `/auth/admin/realms/${realmName}/client-policies/profiles`;
|
|
|
|
cy.intercept("PUT", url).as("save");
|
|
|
|
realmSettingsPage
|
|
|
|
.createClientProfile(profileName, "Test Description")
|
|
|
|
.saveClientProfileCreation();
|
|
|
|
cy.wait("@save");
|
|
|
|
|
2021-12-06 10:50:29 +00:00
|
|
|
sidebarPage.goToRealmSettings();
|
2022-02-16 16:34:54 +00:00
|
|
|
realmSettingsPage.goToClientPoliciesTab().goToClientProfilesList();
|
|
|
|
|
|
|
|
sidebarPage.waitForPageLoad();
|
|
|
|
realmSettingsPage
|
|
|
|
.createClientProfile(profileName, "Test Description")
|
|
|
|
.saveClientProfileCreation();
|
|
|
|
cy.wait("@save");
|
|
|
|
masthead.checkNotificationMessage(
|
|
|
|
"Could not create client profile: 'proposed client profile name duplicated.'"
|
|
|
|
);
|
2021-12-06 10:50:29 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it("Should edit client profile", () => {
|
|
|
|
realmSettingsPage.shouldEditClientProfile();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Should check that edited client profile is now listed", () => {
|
|
|
|
sidebarPage.goToRealmSettings();
|
2022-02-16 16:34:54 +00:00
|
|
|
realmSettingsPage
|
|
|
|
.goToClientPoliciesTab()
|
|
|
|
.goToClientProfilesList()
|
|
|
|
.shouldCheckEditedClientProfileListed();
|
2021-12-06 10:50:29 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it("Should show error when client profile left blank", () => {
|
|
|
|
realmSettingsPage.shouldShowErrorWhenNameBlank();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Should revert back to the previous profile name", () => {
|
|
|
|
realmSettingsPage.shouldReloadClientProfileEdits();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Should not have executors configured by default", () => {
|
|
|
|
realmSettingsPage.shouldNotHaveExecutorsConfigured();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Should cancel adding a new executor to a client profile", () => {
|
|
|
|
realmSettingsPage.shouldCancelAddingExecutor();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Should add a new executor to a client profile", () => {
|
|
|
|
realmSettingsPage.shouldAddExecutor();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Should cancel deleting executor from a client profile", () => {
|
|
|
|
realmSettingsPage.shouldCancelDeletingExecutor();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Should cancel editing executor", () => {
|
2022-02-16 16:34:54 +00:00
|
|
|
realmSettingsPage.openProfileDetails(editedProfileName).editExecutor(4000);
|
|
|
|
sidebarPage.waitForPageLoad();
|
|
|
|
realmSettingsPage
|
|
|
|
.cancelEditingExecutor()
|
|
|
|
.checkExecutorNotInList()
|
|
|
|
.editExecutor()
|
|
|
|
.checkAvailablePeriodExecutor(3600);
|
2021-12-06 10:50:29 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it("Should edit executor", () => {
|
2022-02-16 16:34:54 +00:00
|
|
|
realmSettingsPage
|
|
|
|
.openProfileDetails(editedProfileName)
|
|
|
|
.editExecutor(4000)
|
|
|
|
.saveExecutor();
|
|
|
|
masthead.checkNotificationMessage("Executor updated successfully");
|
|
|
|
realmSettingsPage.editExecutor();
|
|
|
|
// TODO: UNCOMMENT LINE WHEN ISSUE 2037 IS FIXED
|
|
|
|
//.checkAvailablePeriodExecutor(4000);
|
2021-12-06 10:50:29 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it("Should delete executor from a client profile", () => {
|
|
|
|
realmSettingsPage.shouldDeleteExecutor();
|
|
|
|
});
|
|
|
|
|
2022-02-16 16:34:54 +00:00
|
|
|
it("Check cancelling the client profile deletion", () => {
|
|
|
|
realmSettingsPage.deleteClientPolicyItemFromTable(editedProfileName);
|
|
|
|
modalUtils
|
|
|
|
.checkModalMessage(
|
|
|
|
"This action will permanently delete the profile " +
|
|
|
|
editedProfileName +
|
|
|
|
". This cannot be undone."
|
|
|
|
)
|
|
|
|
.cancelModal();
|
|
|
|
realmSettingsPage.checkElementInList(editedProfileName);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Check deleting the client profile", () => {
|
|
|
|
realmSettingsPage.deleteClientPolicyItemFromTable(editedProfileName);
|
|
|
|
modalUtils.confirmModal();
|
|
|
|
masthead.checkNotificationMessage("Client profile deleted");
|
|
|
|
sidebarPage.waitForPageLoad();
|
|
|
|
realmSettingsPage.checkElementNotInList(editedProfileName);
|
2021-12-06 10:50:29 +00:00
|
|
|
});
|
|
|
|
});
|