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 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 });

View file

@ -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;
}

View file

@ -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
>
<PasswordInput
data-testid="passwordField"
name="password"
aria-label="password"
ref={register({ required: true })}
@ -522,6 +523,7 @@ export const UserCredentials = ({ user }: UserCredentialsProps) => {
isRequired
>
<PasswordInput
data-testid="passwordConfirmationField"
name="passwordConfirmation"
aria-label="passwordConfirm"
ref={register({ required: true })}

View file

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