keycloak-scim/cypress/support/pages/admin_console/manage/users/CreateUserPage.ts
Eugenia 28f1fdfda4
Users: Adds user details tab and save/update functionality (#426)
* userDetails tab done, save function wip

* userDetails update working

* add cypress test

* fix default value

* PR feedback from Erik
2021-03-11 21:23:08 +01:00

58 lines
1.3 KiB
TypeScript

export default class CreateUserPage {
usernameInput: string;
usersEmptyState: string;
emptyStateCreateUserBtn: string;
searchPgCreateUserBtn: string;
addUserBtn: string;
saveBtn: string;
cancelBtn: string;
constructor() {
this.usernameInput = "#kc-username";
this.usersEmptyState = "empty-state";
this.emptyStateCreateUserBtn = "empty-primary-action";
this.searchPgCreateUserBtn = "create-new-user";
this.addUserBtn = "add-user";
this.saveBtn = "create-user";
this.cancelBtn = "cancel-create-user";
}
//#region General Settings
createUser(username: string) {
cy.get(this.usernameInput).clear();
if (username) {
cy.get(this.usernameInput).type(username);
}
return this;
}
goToCreateUser() {
cy.wait(100);
cy.get("body").then((body) => {
if (body.find("[data-testid=empty-state]").length > 0) {
cy.getId(this.emptyStateCreateUserBtn).click();
} else if (body.find("[data-testid=search-users-title]").length > 0) {
cy.getId(this.searchPgCreateUserBtn).click();
} else {
cy.getId(this.addUserBtn).click();
}
});
return this;
}
save() {
cy.getId(this.saveBtn).click();
return this;
}
cancel() {
cy.getId(this.cancelBtn).click();
return this;
}
}