keycloak-scim/cypress/support/pages/admin_console/manage/users/CreateUserPage.ts
Jenny baf2380d1e
Cypress tests: users (#2148)
* add users tests

* delete multiple users from list test

* users from search bar

* remove unnecessary its

* fix group test

* force add group click
2022-02-28 18:48:52 +01:00

71 lines
1.5 KiB
TypeScript

export default class CreateUserPage {
usernameInput: string;
usersEmptyState: string;
emptyStateCreateUserBtn: string;
searchPgCreateUserBtn: string;
addUserBtn: string;
joinGroupsBtn: string;
joinBtn: string;
saveBtn: string;
cancelBtn: string;
constructor() {
this.usernameInput = "#kc-username";
this.usersEmptyState = "empty-state";
this.emptyStateCreateUserBtn = "no-users-found-empty-action";
this.searchPgCreateUserBtn = "create-new-user";
this.addUserBtn = "add-user";
this.joinGroupsBtn = "join-groups-button";
this.joinBtn = "users:join-button";
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.get("body").then((body) => {
if (body.find("[data-testid=search-users-title]").length > 0) {
cy.findByTestId(this.searchPgCreateUserBtn).click({ force: true });
} else {
cy.findByTestId(this.addUserBtn).click({ force: true });
}
});
return this;
}
toggleAddGroupModal() {
cy.findByTestId(this.joinGroupsBtn).click();
return this;
}
joinGroups() {
cy.findByTestId(this.joinBtn).click();
return this;
}
save() {
cy.findByTestId(this.saveBtn).click();
return this;
}
cancel() {
cy.findByTestId(this.cancelBtn).click();
return this;
}
}