Add realm actions tests

This commit is contained in:
Jenny 2022-03-14 06:16:23 -04:00 committed by GitHub
parent 5dba749b78
commit 7c4509e9bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 9 deletions

View file

@ -31,9 +31,22 @@ describe("Realm settings tabs tests", () => {
sidebarPage.goToRealmSettings(); sidebarPage.goToRealmSettings();
realmSettingsPage.toggleSwitch(realmSettingsPage.managedAccessSwitch); realmSettingsPage.toggleSwitch(realmSettingsPage.managedAccessSwitch);
realmSettingsPage.save(realmSettingsPage.generalSaveBtn); realmSettingsPage.save(realmSettingsPage.generalSaveBtn);
masthead.checkNotificationMessage("Realm successfully updated"); masthead.checkNotificationMessage("Realm successfully updated", true);
realmSettingsPage.toggleSwitch(realmSettingsPage.managedAccessSwitch); realmSettingsPage.toggleSwitch(realmSettingsPage.managedAccessSwitch);
realmSettingsPage.save(realmSettingsPage.generalSaveBtn); 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"); masthead.checkNotificationMessage("Realm successfully updated");
}); });

View file

@ -170,8 +170,8 @@ export default class RealmSettingsPage {
private alertMessage = ".pf-c-alert__title"; private alertMessage = ".pf-c-alert__title";
private moreDrpDwn = ".pf-c-dropdown__toggle.pf-m-plain"; private moreDrpDwn = ".pf-c-dropdown__toggle.pf-m-plain";
private moreDrpDwnItems = ".pf-c-dropdown__menu-item"; private moreDrpDwnItems = ".pf-c-dropdown__menu-item";
private deleteDialogTitle = ".pf-c-modal-box__title-text"; private modalDialogTitle = ".pf-c-modal-box__title-text";
private deleteDialogBodyText = ".pf-c-modal-box__body"; private modalDialogBodyText = ".pf-c-modal-box__body";
private deleteDialogCancelBtn = "#modal-cancel"; private deleteDialogCancelBtn = "#modal-cancel";
private jsonEditorSaveBtn = "jsonEditor-saveBtn"; private jsonEditorSaveBtn = "jsonEditor-saveBtn";
private jsonEditorSavePoliciesBtn = "jsonEditor-policies-saveBtn"; private jsonEditorSavePoliciesBtn = "jsonEditor-policies-saveBtn";
@ -228,6 +228,13 @@ export default class RealmSettingsPage {
this.realmName = realmName; 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) { selectLoginThemeType(themeType: string) {
cy.get(this.selectLoginTheme).click(); cy.get(this.selectLoginTheme).click();
cy.get(this.loginThemeList).contains(themeType).click(); cy.get(this.loginThemeList).contains(themeType).click();
@ -736,8 +743,8 @@ export default class RealmSettingsPage {
shouldCancelDeletingExecutor() { shouldCancelDeletingExecutor() {
cy.get(this.clientProfileTwo).click(); cy.get(this.clientProfileTwo).click();
cy.get('svg[class*="kc-executor-trash-icon"]').click(); cy.get('svg[class*="kc-executor-trash-icon"]').click();
cy.get(this.deleteDialogTitle).contains("Delete executor?"); cy.get(this.modalDialogTitle).contains("Delete executor?");
cy.get(this.deleteDialogBodyText).contains( cy.get(this.modalDialogBodyText).contains(
"The action will permanently delete secure-ciba-signed-authn-req. This cannot be undone." "The action will permanently delete secure-ciba-signed-authn-req. This cannot be undone."
); );
cy.findByTestId(this.modalConfirm).contains("Delete"); cy.findByTestId(this.modalConfirm).contains("Delete");
@ -813,8 +820,8 @@ export default class RealmSettingsPage {
shouldDeleteExecutor() { shouldDeleteExecutor() {
cy.get(this.clientProfileTwo).click(); cy.get(this.clientProfileTwo).click();
cy.get('svg[class*="kc-executor-trash-icon"]').click(); cy.get('svg[class*="kc-executor-trash-icon"]').click();
cy.get(this.deleteDialogTitle).contains("Delete executor?"); cy.get(this.modalDialogTitle).contains("Delete executor?");
cy.get(this.deleteDialogBodyText).contains( cy.get(this.modalDialogBodyText).contains(
"The action will permanently delete secure-ciba-signed-authn-req. This cannot be undone." "The action will permanently delete secure-ciba-signed-authn-req. This cannot be undone."
); );
cy.findByTestId(this.modalConfirm).contains("Delete"); cy.findByTestId(this.modalConfirm).contains("Delete");
@ -1026,8 +1033,8 @@ export default class RealmSettingsPage {
shouldDeleteClientScopesCondition() { shouldDeleteClientScopesCondition() {
cy.get(this.clientPolicy).click(); cy.get(this.clientPolicy).click();
cy.findByTestId(this.deleteClientScopesConditionBtn).click(); cy.findByTestId(this.deleteClientScopesConditionBtn).click();
cy.get(this.deleteDialogTitle).contains("Delete condition?"); cy.get(this.modalDialogTitle).contains("Delete condition?");
cy.get(this.deleteDialogBodyText).contains( cy.get(this.modalDialogBodyText).contains(
"This action will permanently delete client-scopes. This cannot be undone." "This action will permanently delete client-scopes. This cannot be undone."
); );
cy.findByTestId(this.modalConfirm).contains("Delete"); cy.findByTestId(this.modalConfirm).contains("Delete");

View file

@ -120,6 +120,7 @@ export const ViewHeader = ({
<ToolbarItem> <ToolbarItem>
<Switch <Switch
id={`${titleKey}-switch`} id={`${titleKey}-switch`}
data-testid={`${titleKey}-switch`}
label={t("common:enabled")} label={t("common:enabled")}
labelOff={t("common:disabled")} labelOff={t("common:disabled")}
className="pf-u-mr-lg" className="pf-u-mr-lg"