From 64deaa5fb74672f11e36ac7d0f9d5390844d5cc2 Mon Sep 17 00:00:00 2001 From: Aboullos <61687012+Aboullos@users.noreply.github.com> Date: Tue, 21 Jun 2022 14:15:29 +0200 Subject: [PATCH] Fix error message and update and add tests (#2807) * Fix user-fed-password-policy-error-message * Add test for error messages * Remove only function * Change switch toggle * Modify toggle * Add save action * Set error messages to constant * Remove alert and message changes --- cypress/e2e/realm_test.spec.ts | 6 ++---- cypress/e2e/user_fed_ldap_test.spec.ts | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/cypress/e2e/realm_test.spec.ts b/cypress/e2e/realm_test.spec.ts index 29fb0b77cd..681f48d12b 100644 --- a/cypress/e2e/realm_test.spec.ts +++ b/cypress/e2e/realm_test.spec.ts @@ -86,9 +86,8 @@ describe("Realm tests", () => { cy.findByText("Delete").click(); modalUtils.confirmModal(); masthead.checkNotificationMessage("The realm has been deleted"); - }); - it("Should update realms on delete", () => { + // Show current realms sidebarPage.showCurrentRealms(2); }); @@ -109,9 +108,8 @@ describe("Realm tests", () => { masthead.checkNotificationMessage("Realm created"); cy.wait(["@fetch"]); - }); - it("Should show current realms", () => { + // Show current realms sidebarPage.showCurrentRealms(4); }); diff --git a/cypress/e2e/user_fed_ldap_test.spec.ts b/cypress/e2e/user_fed_ldap_test.spec.ts index 7d46da6308..1ef4e91146 100644 --- a/cypress/e2e/user_fed_ldap_test.spec.ts +++ b/cypress/e2e/user_fed_ldap_test.spec.ts @@ -88,6 +88,10 @@ const deletedSuccessMessage = "The user federation provider has been deleted."; const deleteModalTitle = "Delete user federation provider?"; const disableModalTitle = "Disable user federation provider?"; const nonWritableFailMessage = "User federation provider could not be saved:"; +const validatePasswordPolicyFailMessage = + "User federation provider could not be saved: Validate Password Policy is applicable only with WRITABLE edit mode"; +const userImportingDisabledFailMessage = + "User federation provider could not be saved: Can not disable Importing users when LDAP provider mode is UNSYNCED"; const ldapTestSuccessMsg = "Successfully connected to LDAP"; const ldapTestFailMsg = @@ -427,8 +431,19 @@ describe("User Federation LDAP tests", () => { providersPage.clickExistingCard(firstLdapName); providersPage.fillSelect(providersPage.ldapEditModeInput, editModeUnsynced); + + providersPage.toggleSwitch(providersPage.importUsers); + + providersPage.save(provider); + masthead.checkNotificationMessage(validatePasswordPolicyFailMessage); + providersPage.toggleSwitch(providersPage.importUsers); providersPage.toggleSwitch(providersPage.validatePwPolicySwitch); + providersPage.save(provider); + + masthead.checkNotificationMessage(userImportingDisabledFailMessage); + + providersPage.toggleSwitch(providersPage.importUsers); providersPage.save(provider); masthead.checkNotificationMessage(savedSuccessMessage);