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";
|
|
|
|
import Masthead from "../support/pages/admin_console/Masthead";
|
2022-01-07 07:27:58 +00:00
|
|
|
import { keycloakBefore } from "../support/util/keycloak_hooks";
|
2022-02-24 10:31:46 +00:00
|
|
|
import adminClient from "../support/util/AdminClient";
|
2021-12-06 10:50:29 +00:00
|
|
|
|
|
|
|
const loginPage = new LoginPage();
|
|
|
|
const sidebarPage = new SidebarPage();
|
|
|
|
const masthead = new Masthead();
|
|
|
|
const realmSettingsPage = new RealmSettingsPage();
|
|
|
|
|
|
|
|
describe("Realm settings tabs tests", () => {
|
|
|
|
const realmName = "Realm_" + (Math.random() + 1).toString(36).substring(7);
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
keycloakBefore();
|
|
|
|
loginPage.logIn();
|
|
|
|
sidebarPage.goToRealm(realmName);
|
|
|
|
});
|
|
|
|
|
|
|
|
before(async () => {
|
2022-02-24 10:31:46 +00:00
|
|
|
await adminClient.createRealm(realmName);
|
2021-12-06 10:50:29 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
after(async () => {
|
2022-02-24 10:31:46 +00:00
|
|
|
await adminClient.deleteRealm(realmName);
|
2021-12-06 10:50:29 +00:00
|
|
|
});
|
|
|
|
|
2022-01-03 15:00:03 +00:00
|
|
|
it("shows the 'user profile' tab if enabled", () => {
|
|
|
|
sidebarPage.goToRealmSettings();
|
|
|
|
cy.findByTestId(realmSettingsPage.userProfileTab).should("not.exist");
|
|
|
|
realmSettingsPage.toggleSwitch(realmSettingsPage.profileEnabledSwitch);
|
|
|
|
realmSettingsPage.save(realmSettingsPage.generalSaveBtn);
|
|
|
|
masthead.checkNotificationMessage("Realm successfully updated");
|
|
|
|
cy.findByTestId(realmSettingsPage.userProfileTab).should("exist");
|
|
|
|
});
|
|
|
|
|
2021-12-06 10:50:29 +00:00
|
|
|
it("Go to login tab", () => {
|
|
|
|
sidebarPage.goToRealmSettings();
|
|
|
|
cy.findByTestId("rs-login-tab").click();
|
|
|
|
realmSettingsPage.toggleSwitch(realmSettingsPage.userRegSwitch);
|
2022-03-28 15:34:07 +00:00
|
|
|
|
2021-12-06 10:50:29 +00:00
|
|
|
realmSettingsPage.toggleSwitch(realmSettingsPage.forgotPwdSwitch);
|
2022-03-28 15:34:07 +00:00
|
|
|
|
2021-12-06 10:50:29 +00:00
|
|
|
realmSettingsPage.toggleSwitch(realmSettingsPage.rememberMeSwitch);
|
|
|
|
|
2022-03-28 15:34:07 +00:00
|
|
|
realmSettingsPage.toggleSwitch(realmSettingsPage.loginWithEmailSwitch);
|
2021-12-06 10:50:29 +00:00
|
|
|
|
2022-03-28 15:34:07 +00:00
|
|
|
realmSettingsPage.toggleSwitch(realmSettingsPage.duplicateEmailsSwitch);
|
|
|
|
|
|
|
|
// Check values
|
2021-12-06 10:50:29 +00:00
|
|
|
cy.findByTestId(realmSettingsPage.userRegSwitch).should("have.value", "on");
|
|
|
|
cy.findByTestId(realmSettingsPage.forgotPwdSwitch).should(
|
|
|
|
"have.value",
|
|
|
|
"on"
|
|
|
|
);
|
|
|
|
cy.findByTestId(realmSettingsPage.rememberMeSwitch).should(
|
|
|
|
"have.value",
|
|
|
|
"on"
|
|
|
|
);
|
2022-03-28 15:34:07 +00:00
|
|
|
cy.findByTestId(realmSettingsPage.emailAsUsernameSwitch).should(
|
|
|
|
"have.value",
|
|
|
|
"off"
|
|
|
|
);
|
|
|
|
cy.findByTestId(realmSettingsPage.loginWithEmailSwitch).should(
|
|
|
|
"have.value",
|
|
|
|
"off"
|
|
|
|
);
|
|
|
|
|
|
|
|
cy.findByTestId(realmSettingsPage.duplicateEmailsSwitch).should(
|
|
|
|
"have.value",
|
|
|
|
"on"
|
|
|
|
);
|
|
|
|
|
|
|
|
cy.findByTestId(realmSettingsPage.verifyEmailSwitch).should(
|
|
|
|
"have.value",
|
|
|
|
"off"
|
|
|
|
);
|
2021-12-06 10:50:29 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it("Go to email tab", () => {
|
|
|
|
const msg: string = "Error! Failed to send email.";
|
|
|
|
sidebarPage.goToRealmSettings();
|
|
|
|
cy.findByTestId("rs-email-tab").click();
|
|
|
|
realmSettingsPage.addSenderEmail("example@example.com");
|
|
|
|
realmSettingsPage.toggleCheck(realmSettingsPage.enableSslCheck);
|
|
|
|
realmSettingsPage.toggleCheck(realmSettingsPage.enableStartTlsCheck);
|
|
|
|
realmSettingsPage.fillHostField("localhost");
|
|
|
|
cy.findByTestId(realmSettingsPage.testConnectionButton).click();
|
|
|
|
|
|
|
|
realmSettingsPage.fillEmailField(
|
|
|
|
"example" + (Math.random() + 1).toString(36).substring(7) + "@example.com"
|
|
|
|
);
|
|
|
|
cy.findByTestId(realmSettingsPage.modalTestConnectionButton).click();
|
|
|
|
masthead.checkNotificationMessage(msg, true);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Go to themes tab", () => {
|
|
|
|
sidebarPage.goToRealmSettings();
|
|
|
|
cy.findByTestId("rs-themes-tab").click();
|
|
|
|
|
|
|
|
realmSettingsPage.selectLoginThemeType("keycloak");
|
|
|
|
realmSettingsPage.selectAccountThemeType("keycloak");
|
|
|
|
realmSettingsPage.selectAdminThemeType("base");
|
|
|
|
realmSettingsPage.selectEmailThemeType("base");
|
|
|
|
|
|
|
|
realmSettingsPage.saveThemes();
|
|
|
|
});
|
|
|
|
});
|