keycloak-scim/cypress/integration/partial_export_test.spec.ts
Aboullos 5227115f05
Add Clients tests, fix notification message and stabilize tests (#1999)
* Add Clients tests and fix notification message

* Remove TODO message

* Add waits and refactor

* Refactor and fix tests in realm settings

* Fix lint

* Refactor, fix tests and add stability

* Refactor and stabilize tests

* Stabilize tests

* Fix Realm settings event test and stabilize

* Set confirmModal to always force click

* Add force click and wait

* Fix masthead test

* Modify cypress.json

* Modify realm dropdown selector

* Revert hook changes
2022-02-16 17:34:54 +01:00

56 lines
2 KiB
TypeScript

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";
import { keycloakBefore } from "../support/util/keycloak_hooks";
describe("Partial realm export", () => {
const REALM_NAME = "Partial-export-test-realm";
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();
sidebarPage.goToRealm(REALM_NAME).goToRealmSettings();
realmSettings.clickActionMenu();
modal.open();
});
it("Closes the dialog", () => {
modal.cancelButton().click();
modal.exportButton().should("not.exist");
});
it("Shows a warning message", () => {
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");
});
it("Exports the realm", () => {
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");
});
});