From acaff98e103857c5cf3bc5d94247f68d92cfa1d6 Mon Sep 17 00:00:00 2001 From: Jon Koops Date: Mon, 3 Jan 2022 08:11:07 +0100 Subject: [PATCH] Fix broken Cypress tests (#1802) --- .../admin_console/manage/providers/ProviderPage.ts | 7 ++++--- .../admin_console/manage/users/CredentialsPage.ts | 10 ++++------ src/user/UserCredentials.tsx | 6 ++++-- src/user/messages.ts | 4 ++-- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/cypress/support/pages/admin_console/manage/providers/ProviderPage.ts b/cypress/support/pages/admin_console/manage/providers/ProviderPage.ts index 7be7a3328a..2c2b787e28 100644 --- a/cypress/support/pages/admin_console/manage/providers/ProviderPage.ts +++ b/cypress/support/pages/admin_console/manage/providers/ProviderPage.ts @@ -45,7 +45,8 @@ export default class ProviderPage { private ldapAttNameInput = "ldap.attribute.name"; private ldapAttValueInput = "ldap.attribute.value"; private groupInput = "group"; - private ldapDnInput = "roles.dn"; + private ldapGroupsDnInput = "groups.dn"; + private ldapRolesDnInput = "roles.dn"; // mapper types private msadUserAcctMapper = "msad-user-account-control-mapper"; @@ -254,11 +255,11 @@ export default class ProviderPage { cy.findByTestId(this.groupInput).type(this.groupName); break; case this.groupLdapMapper: - cy.findByTestId(this.ldapDnInput).type(ldapDnValue); + cy.findByTestId(this.ldapGroupsDnInput).type(ldapDnValue); break; case this.roleLdapMapper: - cy.findByTestId(this.ldapDnInput).type(ldapDnValue); + cy.findByTestId(this.ldapRolesDnInput).type(ldapDnValue); // cy select clientID dropdown and choose clientName (var) cy.get(this.clientIdSelect).click(); cy.get("button").contains(this.clientName).click({ force: true }); diff --git a/cypress/support/pages/admin_console/manage/users/CredentialsPage.ts b/cypress/support/pages/admin_console/manage/users/CredentialsPage.ts index 64e3edcf79..e71cd6cfab 100644 --- a/cypress/support/pages/admin_console/manage/users/CredentialsPage.ts +++ b/cypress/support/pages/admin_console/manage/users/CredentialsPage.ts @@ -7,10 +7,8 @@ export default class CredentialsPage { private readonly credentialResetModal = "credential-reset-modal"; private readonly resetModalActionsToggleBtn = "[data-testid=credential-reset-modal] #actions"; - private readonly passwordField = - ".kc-password > .pf-c-input-group > .pf-c-form-control"; - private readonly passwordConfirmationField = - ".kc-passwordConfirmation > .pf-c-input-group > .pf-c-form-control"; + private readonly passwordField = "passwordField"; + private readonly passwordConfirmationField = "passwordConfirmationField"; private readonly resetActions = [ "VERIFY_EMAIL-option", "UPDATE_PROFILE-option", @@ -62,8 +60,8 @@ export default class CredentialsPage { } fillPasswordForm() { - cy.get(this.passwordField).type("test"); - cy.get(this.passwordConfirmationField).type("test"); + cy.findByTestId(this.passwordField).type("test"); + cy.findByTestId(this.passwordConfirmationField).type("test"); return this; } diff --git a/src/user/UserCredentials.tsx b/src/user/UserCredentials.tsx index 045cdbf5ec..0d6e5b8b28 100644 --- a/src/user/UserCredentials.tsx +++ b/src/user/UserCredentials.tsx @@ -445,8 +445,8 @@ export const UserCredentials = ({ user }: UserCredentialsProps) => { width={600} title={ isResetPassword - ? `${t("resetPasswordFor")} ${user.username}` - : `${t("setPasswordFor")} ${user.username}` + ? t("resetPasswordFor", { username: user.username }) + : t("setPasswordFor", { username: user.username }) } isOpen onClose={() => { @@ -500,6 +500,7 @@ export const UserCredentials = ({ user }: UserCredentialsProps) => { isRequired > { isRequired >