Fix broken Cypress tests (#1802)

This commit is contained in:
Jon Koops 2022-01-03 08:11:07 +01:00 committed by GitHub
parent f57d5edb32
commit acaff98e10
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 13 deletions

View file

@ -45,7 +45,8 @@ export default class ProviderPage {
private ldapAttNameInput = "ldap.attribute.name"; private ldapAttNameInput = "ldap.attribute.name";
private ldapAttValueInput = "ldap.attribute.value"; private ldapAttValueInput = "ldap.attribute.value";
private groupInput = "group"; private groupInput = "group";
private ldapDnInput = "roles.dn"; private ldapGroupsDnInput = "groups.dn";
private ldapRolesDnInput = "roles.dn";
// mapper types // mapper types
private msadUserAcctMapper = "msad-user-account-control-mapper"; private msadUserAcctMapper = "msad-user-account-control-mapper";
@ -254,11 +255,11 @@ export default class ProviderPage {
cy.findByTestId(this.groupInput).type(this.groupName); cy.findByTestId(this.groupInput).type(this.groupName);
break; break;
case this.groupLdapMapper: case this.groupLdapMapper:
cy.findByTestId(this.ldapDnInput).type(ldapDnValue); cy.findByTestId(this.ldapGroupsDnInput).type(ldapDnValue);
break; break;
case this.roleLdapMapper: case this.roleLdapMapper:
cy.findByTestId(this.ldapDnInput).type(ldapDnValue); cy.findByTestId(this.ldapRolesDnInput).type(ldapDnValue);
// cy select clientID dropdown and choose clientName (var) // cy select clientID dropdown and choose clientName (var)
cy.get(this.clientIdSelect).click(); cy.get(this.clientIdSelect).click();
cy.get("button").contains(this.clientName).click({ force: true }); cy.get("button").contains(this.clientName).click({ force: true });

View file

@ -7,10 +7,8 @@ export default class CredentialsPage {
private readonly credentialResetModal = "credential-reset-modal"; private readonly credentialResetModal = "credential-reset-modal";
private readonly resetModalActionsToggleBtn = private readonly resetModalActionsToggleBtn =
"[data-testid=credential-reset-modal] #actions"; "[data-testid=credential-reset-modal] #actions";
private readonly passwordField = private readonly passwordField = "passwordField";
".kc-password > .pf-c-input-group > .pf-c-form-control"; private readonly passwordConfirmationField = "passwordConfirmationField";
private readonly passwordConfirmationField =
".kc-passwordConfirmation > .pf-c-input-group > .pf-c-form-control";
private readonly resetActions = [ private readonly resetActions = [
"VERIFY_EMAIL-option", "VERIFY_EMAIL-option",
"UPDATE_PROFILE-option", "UPDATE_PROFILE-option",
@ -62,8 +60,8 @@ export default class CredentialsPage {
} }
fillPasswordForm() { fillPasswordForm() {
cy.get(this.passwordField).type("test"); cy.findByTestId(this.passwordField).type("test");
cy.get(this.passwordConfirmationField).type("test"); cy.findByTestId(this.passwordConfirmationField).type("test");
return this; return this;
} }

View file

@ -445,8 +445,8 @@ export const UserCredentials = ({ user }: UserCredentialsProps) => {
width={600} width={600}
title={ title={
isResetPassword isResetPassword
? `${t("resetPasswordFor")} ${user.username}` ? t("resetPasswordFor", { username: user.username })
: `${t("setPasswordFor")} ${user.username}` : t("setPasswordFor", { username: user.username })
} }
isOpen isOpen
onClose={() => { onClose={() => {
@ -500,6 +500,7 @@ export const UserCredentials = ({ user }: UserCredentialsProps) => {
isRequired isRequired
> >
<PasswordInput <PasswordInput
data-testid="passwordField"
name="password" name="password"
aria-label="password" aria-label="password"
ref={register({ required: true })} ref={register({ required: true })}
@ -522,6 +523,7 @@ export const UserCredentials = ({ user }: UserCredentialsProps) => {
isRequired isRequired
> >
<PasswordInput <PasswordInput
data-testid="passwordConfirmationField"
name="passwordConfirmation" name="passwordConfirmation"
aria-label="passwordConfirm" aria-label="passwordConfirm"
ref={register({ required: true })} ref={register({ required: true })}

View file

@ -121,7 +121,7 @@ export default {
noCredentialsText: noCredentialsText:
"This user does not have any credentials. You can set password for this user.", "This user does not have any credentials. You can set password for this user.",
setPassword: "Set password", setPassword: "Set password",
setPasswordFor: "Set password for ", setPasswordFor: "Set password for {{username}}",
save: "Save", save: "Save",
cancel: "Cancel", cancel: "Cancel",
savePasswordSuccess: "The password has been set successfully.", savePasswordSuccess: "The password has been set successfully.",
@ -146,7 +146,7 @@ export default {
deleteCredentialsSuccess: "The credentials has been deleted successfully.", deleteCredentialsSuccess: "The credentials has been deleted successfully.",
deleteCredentialsError: "Error deleting users credentials: {{error}}", deleteCredentialsError: "Error deleting users credentials: {{error}}",
deleteBtn: "Delete", deleteBtn: "Delete",
resetPasswordFor: "Reset password for ", resetPasswordFor: "Reset password for {{username}}",
resetPasswordConfirm: "Reset password?", resetPasswordConfirm: "Reset password?",
resetPasswordConfirmText: resetPasswordConfirmText:
"Are you sure you want to reset the password for the user", "Are you sure you want to reset the password for the user",