2022-12-07 15:28:28 +00:00
|
|
|
import PartialExportModal from "../support/pages/admin-ui/configure/realm_settings/PartialExportModal";
|
|
|
|
import RealmSettings from "../support/pages/admin-ui/configure/realm_settings/RealmSettings";
|
|
|
|
import SidebarPage from "../support/pages/admin-ui/SidebarPage";
|
2021-10-29 02:50:25 +00:00
|
|
|
import LoginPage from "../support/pages/LoginPage";
|
2022-02-24 10:31:46 +00:00
|
|
|
import adminClient from "../support/util/AdminClient";
|
2022-01-07 07:27:58 +00:00
|
|
|
import { keycloakBefore } from "../support/util/keycloak_hooks";
|
2021-10-29 02:50:25 +00:00
|
|
|
|
|
|
|
describe("Partial realm export", () => {
|
2022-02-16 16:34:54 +00:00
|
|
|
const REALM_NAME = "Partial-export-test-realm";
|
2021-10-29 02:50:25 +00:00
|
|
|
|
2022-02-24 10:31:46 +00:00
|
|
|
before(() => adminClient.createRealm(REALM_NAME));
|
2024-02-19 01:09:22 +00:00
|
|
|
|
2022-02-24 10:31:46 +00:00
|
|
|
after(() => adminClient.deleteRealm(REALM_NAME));
|
2021-10-29 02:50:25 +00:00
|
|
|
|
|
|
|
const loginPage = new LoginPage();
|
|
|
|
const sidebarPage = new SidebarPage();
|
|
|
|
const modal = new PartialExportModal();
|
|
|
|
const realmSettings = new RealmSettings();
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
loginPage.logIn();
|
2023-02-10 10:10:35 +00:00
|
|
|
keycloakBefore();
|
2022-02-16 16:34:54 +00:00
|
|
|
sidebarPage.goToRealm(REALM_NAME).goToRealmSettings();
|
2021-10-29 02:50:25 +00:00
|
|
|
realmSettings.clickActionMenu();
|
|
|
|
modal.open();
|
|
|
|
});
|
|
|
|
|
2022-02-16 16:34:54 +00:00
|
|
|
it("Closes the dialog", () => {
|
2021-10-29 02:50:25 +00:00
|
|
|
modal.cancelButton().click();
|
|
|
|
modal.exportButton().should("not.exist");
|
|
|
|
});
|
|
|
|
|
2022-02-16 16:34:54 +00:00
|
|
|
it("Shows a warning message", () => {
|
2021-10-29 02:50:25 +00:00
|
|
|
modal.warningMessage().should("not.exist");
|
|
|
|
|
|
|
|
modal.includeGroupsAndRolesSwitch().click({ force: true });
|
|
|
|
modal.warningMessage().should("exist");
|
|
|
|
modal.includeGroupsAndRolesSwitch().click({ force: true });
|
|
|
|
modal.warningMessage().should("not.exist");
|
|
|
|
|
|
|
|
modal.includeClientsSwitch().click({ force: true });
|
|
|
|
modal.warningMessage().should("exist");
|
|
|
|
modal.includeClientsSwitch().click({ force: true });
|
|
|
|
modal.warningMessage().should("not.exist");
|
|
|
|
});
|
|
|
|
|
2022-02-16 16:34:54 +00:00
|
|
|
it("Exports the realm", () => {
|
2021-10-29 02:50:25 +00:00
|
|
|
modal.includeGroupsAndRolesSwitch().click({ force: true });
|
2023-12-12 10:42:39 +00:00
|
|
|
modal.includeClientsSwitch().click({ force: true });
|
2021-10-29 02:50:25 +00:00
|
|
|
modal.exportButton().click();
|
|
|
|
cy.readFile(
|
2023-07-11 14:03:21 +00:00
|
|
|
Cypress.config("downloadsFolder") + "/realm-export.json",
|
2021-10-29 02:50:25 +00:00
|
|
|
).should("exist");
|
|
|
|
modal.exportButton().should("not.exist");
|
|
|
|
});
|
|
|
|
});
|