2021-04-19 11:41:07 +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";
|
2021-06-08 05:29:56 +00:00
|
|
|
import Masthead from "../support/pages/admin_console/Masthead";
|
|
|
|
import ModalUtils from "../support/util/ModalUtils";
|
2021-04-19 11:41:07 +00:00
|
|
|
import { keycloakBefore } from "../support/util/keycloak_before";
|
2021-05-06 05:31:40 +00:00
|
|
|
import AdminClient from "../support/util/AdminClient";
|
2021-06-08 05:29:56 +00:00
|
|
|
import ListingPage from "../support/pages/admin_console/ListingPage";
|
2021-04-19 11:41:07 +00:00
|
|
|
|
2021-06-03 18:31:47 +00:00
|
|
|
const loginPage = new LoginPage();
|
|
|
|
const sidebarPage = new SidebarPage();
|
2021-06-08 05:29:56 +00:00
|
|
|
const masthead = new Masthead();
|
|
|
|
const modalUtils = new ModalUtils();
|
2021-06-03 18:31:47 +00:00
|
|
|
const realmSettingsPage = new RealmSettingsPage();
|
|
|
|
|
|
|
|
describe("Realm settings", () => {
|
|
|
|
const realmName = "Realm_" + (Math.random() + 1).toString(36).substring(7);
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
keycloakBefore();
|
|
|
|
loginPage.logIn();
|
|
|
|
sidebarPage.goToRealm(realmName);
|
|
|
|
});
|
|
|
|
|
|
|
|
before(async () => {
|
|
|
|
await new AdminClient().createRealm(realmName);
|
|
|
|
});
|
|
|
|
|
2021-06-08 05:29:56 +00:00
|
|
|
after(async () => {
|
|
|
|
await new AdminClient().deleteRealm(realmName);
|
|
|
|
});
|
2021-06-03 18:31:47 +00:00
|
|
|
|
2021-06-08 15:45:37 +00:00
|
|
|
const goToKeys = () => {
|
|
|
|
const keysUrl = "/auth/admin/realms/master/keys";
|
|
|
|
cy.intercept(keysUrl).as("keysFetch");
|
|
|
|
cy.getId("rs-keys-tab").click();
|
|
|
|
cy.wait(10000);
|
|
|
|
cy.getId("rs-keys-list-tab").click();
|
|
|
|
|
|
|
|
return this;
|
|
|
|
};
|
|
|
|
|
|
|
|
it("Go to general tab", function () {
|
2021-06-03 18:31:47 +00:00
|
|
|
sidebarPage.goToRealmSettings();
|
|
|
|
realmSettingsPage.toggleSwitch(realmSettingsPage.managedAccessSwitch);
|
|
|
|
realmSettingsPage.save(realmSettingsPage.generalSaveBtn);
|
|
|
|
realmSettingsPage.toggleSwitch(realmSettingsPage.managedAccessSwitch);
|
|
|
|
realmSettingsPage.save(realmSettingsPage.generalSaveBtn);
|
|
|
|
});
|
|
|
|
|
2021-06-08 05:29:56 +00:00
|
|
|
it("Go to login tab", () => {
|
2021-06-03 18:31:47 +00:00
|
|
|
sidebarPage.goToRealmSettings();
|
|
|
|
cy.getId("rs-login-tab").click();
|
|
|
|
realmSettingsPage.toggleSwitch(realmSettingsPage.userRegSwitch);
|
|
|
|
realmSettingsPage.toggleSwitch(realmSettingsPage.forgotPwdSwitch);
|
|
|
|
realmSettingsPage.toggleSwitch(realmSettingsPage.rememberMeSwitch);
|
|
|
|
realmSettingsPage.toggleSwitch(realmSettingsPage.verifyEmailSwitch);
|
|
|
|
});
|
|
|
|
|
2021-06-08 05:29:56 +00:00
|
|
|
it("Go to email tab", () => {
|
2021-06-03 18:31:47 +00:00
|
|
|
sidebarPage.goToRealmSettings();
|
|
|
|
cy.getId("rs-email-tab").click();
|
|
|
|
|
|
|
|
cy.wait(1000);
|
|
|
|
|
|
|
|
realmSettingsPage.addSenderEmail("example@example.com");
|
|
|
|
|
|
|
|
realmSettingsPage.toggleCheck(realmSettingsPage.enableSslCheck);
|
|
|
|
realmSettingsPage.toggleCheck(realmSettingsPage.enableStartTlsCheck);
|
|
|
|
|
|
|
|
realmSettingsPage.save(realmSettingsPage.emailSaveBtn);
|
2021-06-22 12:48:12 +00:00
|
|
|
|
2021-06-22 17:16:35 +00:00
|
|
|
realmSettingsPage.fillHostField("localhost");
|
2021-06-22 18:49:41 +00:00
|
|
|
cy.getId(realmSettingsPage.testConnectionButton).click();
|
2021-06-22 12:48:12 +00:00
|
|
|
|
2021-06-10 20:00:14 +00:00
|
|
|
masthead.checkNotificationMessage("Error! Failed to send email.");
|
2021-06-03 18:31:47 +00:00
|
|
|
});
|
|
|
|
|
2021-06-08 05:29:56 +00:00
|
|
|
it("Go to themes tab", () => {
|
2021-06-03 18:31:47 +00:00
|
|
|
cy.wait(5000);
|
|
|
|
sidebarPage.goToRealmSettings();
|
|
|
|
cy.getId("rs-themes-tab").click();
|
|
|
|
realmSettingsPage.selectLoginThemeType("keycloak");
|
|
|
|
realmSettingsPage.selectAccountThemeType("keycloak");
|
|
|
|
realmSettingsPage.selectAdminThemeType("base");
|
|
|
|
realmSettingsPage.selectEmailThemeType("base");
|
|
|
|
|
|
|
|
realmSettingsPage.saveThemes();
|
|
|
|
});
|
|
|
|
|
2021-06-08 05:29:56 +00:00
|
|
|
describe("Events tab", () => {
|
|
|
|
const listingPage = new ListingPage();
|
|
|
|
|
|
|
|
it("Enable user events", () => {
|
|
|
|
sidebarPage.goToRealmSettings();
|
|
|
|
cy.getId("rs-realm-events-tab").click();
|
|
|
|
|
|
|
|
cy.wait(5000);
|
|
|
|
realmSettingsPage
|
|
|
|
.toggleSwitch(realmSettingsPage.enableEvents)
|
|
|
|
.save(realmSettingsPage.eventsUserSave);
|
|
|
|
masthead.checkNotificationMessage("Successfully saved configuration");
|
|
|
|
|
|
|
|
realmSettingsPage.clearEvents("user");
|
|
|
|
|
|
|
|
modalUtils
|
|
|
|
.checkModalMessage(
|
|
|
|
"If you clear all events of this realm, all records will be permanently cleared in the database"
|
|
|
|
)
|
|
|
|
.confirmModal();
|
|
|
|
|
|
|
|
masthead.checkNotificationMessage("The user events have been cleared");
|
|
|
|
|
|
|
|
const events = ["Client info", "Client info error"];
|
|
|
|
|
|
|
|
cy.intercept("GET", `/auth/admin/realms/${realmName}/events/config`).as(
|
|
|
|
"fetchConfig"
|
|
|
|
);
|
|
|
|
realmSettingsPage.addUserEvents(events).clickAdd();
|
|
|
|
masthead.checkNotificationMessage("Successfully saved configuration");
|
|
|
|
cy.wait(["@fetchConfig"]);
|
|
|
|
cy.get(".pf-c-spinner__tail-ball").should("not.exist");
|
|
|
|
|
|
|
|
for (const event of events) {
|
|
|
|
listingPage.searchItem(event, false).itemExist(event);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Go to keys tab", () => {
|
2021-06-03 18:31:47 +00:00
|
|
|
cy.wait(5000);
|
|
|
|
|
|
|
|
sidebarPage.goToRealmSettings();
|
|
|
|
|
|
|
|
cy.getId("rs-keys-tab").click();
|
|
|
|
});
|
|
|
|
|
2021-06-08 05:29:56 +00:00
|
|
|
it("add Providers", () => {
|
2021-06-03 18:31:47 +00:00
|
|
|
cy.wait(5000);
|
|
|
|
sidebarPage.goToRealmSettings();
|
|
|
|
|
|
|
|
cy.getId("rs-keys-tab").click();
|
|
|
|
|
|
|
|
cy.wait(10000);
|
|
|
|
|
|
|
|
cy.getId("rs-providers-tab").click();
|
|
|
|
|
|
|
|
realmSettingsPage.toggleAddProviderDropdown();
|
|
|
|
|
|
|
|
cy.getId("option-aes-generated").click();
|
|
|
|
realmSettingsPage.enterConsoleDisplayName("test_aes-generated");
|
|
|
|
realmSettingsPage.addProvider();
|
|
|
|
|
|
|
|
realmSettingsPage.toggleAddProviderDropdown();
|
|
|
|
|
|
|
|
cy.getId("option-ecdsa-generated").click();
|
|
|
|
realmSettingsPage.enterConsoleDisplayName("test_ecdsa-generated");
|
|
|
|
realmSettingsPage.addProvider();
|
|
|
|
|
|
|
|
realmSettingsPage.toggleAddProviderDropdown();
|
|
|
|
|
|
|
|
cy.getId("option-hmac-generated").click();
|
|
|
|
realmSettingsPage.enterConsoleDisplayName("test_hmac-generated");
|
|
|
|
realmSettingsPage.addProvider();
|
|
|
|
|
|
|
|
realmSettingsPage.toggleAddProviderDropdown();
|
|
|
|
|
|
|
|
cy.getId("option-rsa-generated").click();
|
|
|
|
realmSettingsPage.enterConsoleDisplayName("test_rsa-generated");
|
|
|
|
realmSettingsPage.addProvider();
|
2021-04-19 11:41:07 +00:00
|
|
|
});
|
2021-06-08 15:45:37 +00:00
|
|
|
|
2021-06-16 11:35:03 +00:00
|
|
|
it("Test keys", () => {
|
2021-06-08 15:45:37 +00:00
|
|
|
sidebarPage.goToRealmSettings();
|
|
|
|
goToKeys();
|
|
|
|
|
|
|
|
realmSettingsPage.testSelectFilter();
|
|
|
|
});
|
2021-04-19 11:41:07 +00:00
|
|
|
});
|