2021-10-29 02:50:25 +00:00
|
|
|
import PartialExportModal from "../support/pages/admin_console/configure/realm_settings/PartialExportModal";
|
|
|
|
import RealmSettings from "../support/pages/admin_console/configure/realm_settings/RealmSettings";
|
|
|
|
import SidebarPage from "../support/pages/admin_console/SidebarPage";
|
|
|
|
import LoginPage from "../support/pages/LoginPage";
|
|
|
|
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
|
|
|
const client = new AdminClient();
|
|
|
|
|
|
|
|
before(() => client.createRealm(REALM_NAME));
|
|
|
|
after(() => client.deleteRealm(REALM_NAME));
|
|
|
|
|
|
|
|
const loginPage = new LoginPage();
|
|
|
|
const sidebarPage = new SidebarPage();
|
|
|
|
const modal = new PartialExportModal();
|
|
|
|
const realmSettings = new RealmSettings();
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
keycloakBefore();
|
|
|
|
loginPage.logIn();
|
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 });
|
|
|
|
modal.includeGroupsAndRolesSwitch().click({ force: true });
|
|
|
|
modal.exportButton().click();
|
|
|
|
cy.readFile(
|
|
|
|
Cypress.config("downloadsFolder") + "/realm-export.json"
|
|
|
|
).should("exist");
|
|
|
|
modal.exportButton().should("not.exist");
|
|
|
|
});
|
|
|
|
});
|