diff --git a/cypress/integration/realm_settings_tabs_test.spec.ts b/cypress/integration/realm_settings_tabs_test.spec.ts index dc4031105c..5cd59f43ca 100644 --- a/cypress/integration/realm_settings_tabs_test.spec.ts +++ b/cypress/integration/realm_settings_tabs_test.spec.ts @@ -31,9 +31,22 @@ describe("Realm settings tabs tests", () => { sidebarPage.goToRealmSettings(); realmSettingsPage.toggleSwitch(realmSettingsPage.managedAccessSwitch); realmSettingsPage.save(realmSettingsPage.generalSaveBtn); - masthead.checkNotificationMessage("Realm successfully updated"); + masthead.checkNotificationMessage("Realm successfully updated", true); realmSettingsPage.toggleSwitch(realmSettingsPage.managedAccessSwitch); realmSettingsPage.save(realmSettingsPage.generalSaveBtn); + masthead.checkNotificationMessage("Realm successfully updated", true); + + // Enable realm + realmSettingsPage.toggleSwitch(`${realmName}-switch`); + masthead.checkNotificationMessage("Realm successfully updated", true); + + // Disable realm + realmSettingsPage.toggleSwitch(`${realmName}-switch`); + realmSettingsPage.disableRealm(); + masthead.checkNotificationMessage("Realm successfully updated", true); + + // Re-enable realm + realmSettingsPage.toggleSwitch(`${realmName}-switch`); masthead.checkNotificationMessage("Realm successfully updated"); }); diff --git a/cypress/support/pages/admin_console/manage/realm_settings/RealmSettingsPage.ts b/cypress/support/pages/admin_console/manage/realm_settings/RealmSettingsPage.ts index bbf0f99aa2..af3d7f0c47 100644 --- a/cypress/support/pages/admin_console/manage/realm_settings/RealmSettingsPage.ts +++ b/cypress/support/pages/admin_console/manage/realm_settings/RealmSettingsPage.ts @@ -170,8 +170,8 @@ export default class RealmSettingsPage { private alertMessage = ".pf-c-alert__title"; private moreDrpDwn = ".pf-c-dropdown__toggle.pf-m-plain"; private moreDrpDwnItems = ".pf-c-dropdown__menu-item"; - private deleteDialogTitle = ".pf-c-modal-box__title-text"; - private deleteDialogBodyText = ".pf-c-modal-box__body"; + private modalDialogTitle = ".pf-c-modal-box__title-text"; + private modalDialogBodyText = ".pf-c-modal-box__body"; private deleteDialogCancelBtn = "#modal-cancel"; private jsonEditorSaveBtn = "jsonEditor-saveBtn"; private jsonEditorSavePoliciesBtn = "jsonEditor-policies-saveBtn"; @@ -228,6 +228,13 @@ export default class RealmSettingsPage { this.realmName = realmName; } + disableRealm() { + cy.get(this.modalDialogTitle).contains("Disable realm?"); + cy.get(this.modalDialogBodyText).contains( + "User and clients can't access the realm if it's disabled. Are you sure you want to continue?" + ); + cy.findByTestId(this.modalConfirm).contains("Disable").click(); + } selectLoginThemeType(themeType: string) { cy.get(this.selectLoginTheme).click(); cy.get(this.loginThemeList).contains(themeType).click(); @@ -736,8 +743,8 @@ export default class RealmSettingsPage { shouldCancelDeletingExecutor() { cy.get(this.clientProfileTwo).click(); cy.get('svg[class*="kc-executor-trash-icon"]').click(); - cy.get(this.deleteDialogTitle).contains("Delete executor?"); - cy.get(this.deleteDialogBodyText).contains( + cy.get(this.modalDialogTitle).contains("Delete executor?"); + cy.get(this.modalDialogBodyText).contains( "The action will permanently delete secure-ciba-signed-authn-req. This cannot be undone." ); cy.findByTestId(this.modalConfirm).contains("Delete"); @@ -813,8 +820,8 @@ export default class RealmSettingsPage { shouldDeleteExecutor() { cy.get(this.clientProfileTwo).click(); cy.get('svg[class*="kc-executor-trash-icon"]').click(); - cy.get(this.deleteDialogTitle).contains("Delete executor?"); - cy.get(this.deleteDialogBodyText).contains( + cy.get(this.modalDialogTitle).contains("Delete executor?"); + cy.get(this.modalDialogBodyText).contains( "The action will permanently delete secure-ciba-signed-authn-req. This cannot be undone." ); cy.findByTestId(this.modalConfirm).contains("Delete"); @@ -1026,8 +1033,8 @@ export default class RealmSettingsPage { shouldDeleteClientScopesCondition() { cy.get(this.clientPolicy).click(); cy.findByTestId(this.deleteClientScopesConditionBtn).click(); - cy.get(this.deleteDialogTitle).contains("Delete condition?"); - cy.get(this.deleteDialogBodyText).contains( + cy.get(this.modalDialogTitle).contains("Delete condition?"); + cy.get(this.modalDialogBodyText).contains( "This action will permanently delete client-scopes. This cannot be undone." ); cy.findByTestId(this.modalConfirm).contains("Delete"); diff --git a/src/components/view-header/ViewHeader.tsx b/src/components/view-header/ViewHeader.tsx index 55a03ab406..116da2537f 100644 --- a/src/components/view-header/ViewHeader.tsx +++ b/src/components/view-header/ViewHeader.tsx @@ -120,6 +120,7 @@ export const ViewHeader = ({