2021-08-26 08:39:35 +00:00
|
|
|
import { RequiredActionAlias } from "@keycloak/keycloak-admin-client/lib/defs/requiredActionProviderRepresentation";
|
2021-03-11 20:23:08 +00:00
|
|
|
|
|
|
|
export default class UserDetailsPage {
|
2021-09-16 10:24:21 +00:00
|
|
|
saveBtn: string;
|
|
|
|
cancelBtn: string;
|
|
|
|
emailInput: string;
|
|
|
|
emailValue: string;
|
|
|
|
firstNameInput: string;
|
|
|
|
firstNameValue: string;
|
|
|
|
lastNameInput: string;
|
|
|
|
lastNameValue: string;
|
|
|
|
enabledSwitch: string;
|
|
|
|
enabledValue: boolean;
|
|
|
|
requiredUserActions: RequiredActionAlias[];
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
this.saveBtn = "save-user";
|
|
|
|
this.cancelBtn = "cancel-create-user";
|
|
|
|
this.emailInput = "email-input";
|
|
|
|
this.emailValue =
|
|
|
|
"example" +
|
|
|
|
"_" +
|
|
|
|
(Math.random() + 1).toString(36).substring(7) +
|
|
|
|
"@example.com";
|
|
|
|
this.firstNameInput = "firstName-input";
|
|
|
|
this.firstNameValue = "firstname";
|
|
|
|
this.lastNameInput = "lastName-input";
|
|
|
|
this.lastNameValue = "lastname";
|
|
|
|
this.enabledSwitch = "user-enabled-switch";
|
|
|
|
this.enabledValue = true;
|
|
|
|
this.requiredUserActions = [RequiredActionAlias.UPDATE_PASSWORD];
|
|
|
|
}
|
|
|
|
|
|
|
|
fillUserData() {
|
2021-09-17 13:23:34 +00:00
|
|
|
cy.findByTestId(this.emailInput).type(this.emailValue);
|
|
|
|
cy.findByTestId(this.firstNameInput).type(this.firstNameValue);
|
|
|
|
cy.findByTestId(this.lastNameInput).type(this.lastNameValue);
|
|
|
|
cy.findByTestId(this.enabledSwitch).check({ force: true });
|
2021-03-11 20:23:08 +00:00
|
|
|
|
2021-09-16 10:24:21 +00:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
save() {
|
2021-09-17 13:23:34 +00:00
|
|
|
cy.findByTestId(this.saveBtn).click();
|
2021-09-16 10:24:21 +00:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
cancel() {
|
2021-09-17 13:23:34 +00:00
|
|
|
cy.findByTestId(this.cancelBtn).click();
|
2021-09-16 10:24:21 +00:00
|
|
|
|
|
|
|
return this;
|
2021-03-11 20:23:08 +00:00
|
|
|
}
|
2021-09-16 10:24:21 +00:00
|
|
|
}
|