keycloak-scim/cypress/support/pages/admin_console/manage/users/CreateUserPage.ts

72 lines
1.5 KiB
TypeScript
Raw Normal View History

2021-03-04 14:26:21 +00:00
export default class CreateUserPage {
usernameInput: string;
usersEmptyState: string;
emptyStateCreateUserBtn: string;
searchPgCreateUserBtn: string;
addUserBtn: string;
2021-04-20 12:22:36 +00:00
joinGroupsBtn: string;
joinBtn: string;
2021-03-04 14:26:21 +00:00
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";
2021-04-20 12:22:36 +00:00
this.joinGroupsBtn = "join-groups-button";
this.joinBtn = "users:join-button";
this.saveBtn = "create-user";
this.cancelBtn = "cancel-create-user";
2021-03-04 14:26:21 +00:00
}
//#region General Settings
createUser(username: string) {
2021-03-04 14:26:21 +00:00
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 });
}
});
2021-03-04 14:26:21 +00:00
return this;
}
2021-04-20 12:22:36 +00:00
toggleAddGroupModal() {
cy.findByTestId(this.joinGroupsBtn).click();
2021-04-20 12:22:36 +00:00
return this;
}
joinGroups() {
cy.findByTestId(this.joinBtn).click();
2021-04-20 12:22:36 +00:00
return this;
}
2021-03-04 14:26:21 +00:00
save() {
cy.findByTestId(this.saveBtn).click();
2021-03-04 14:26:21 +00:00
return this;
}
cancel() {
cy.findByTestId(this.cancelBtn).click();
2021-03-04 14:26:21 +00:00
return this;
}
}