Skip to content

Commit

Permalink
Fixed the cypress failure in users form (ohcnetwork#10101)
Browse files Browse the repository at this point in the history
  • Loading branch information
nihal467 authored Jan 22, 2025
1 parent 5a566b3 commit f718088
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions cypress/e2e/users_spec/user_creation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ describe("User Creation", () => {
email: `${generateUsername(firstName)}@test.com`,
phoneNumber: generatePhoneNumber(),
userType: "Doctor",
gender: "Male",
state: "Kerala",
district: "Ernakulam",
localBody: "Aluva",
Expand Down
7 changes: 7 additions & 0 deletions cypress/pageObject/Users/UserCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export interface UserData {
district?: string;
localBody?: string;
ward?: string;
gender?: string;
}

export class UserCreation {
Expand Down Expand Up @@ -107,6 +108,11 @@ export class UserCreation {
return this;
}

selectGender(gender: string) {
cy.clickAndSelectOption('[data-cy="gender-select"]', gender);
return this;
}

fillUserDetails(userData: UserData & { confirmPassword?: string }) {
if (userData.userType) this.selectUserType(userData.userType);
if (userData.firstName) this.fillFirstName(userData.firstName);
Expand All @@ -118,6 +124,7 @@ export class UserCreation {
}
if (userData.email) this.fillEmail(userData.email);
if (userData.phoneNumber) this.fillPhoneNumber(userData.phoneNumber);
if (userData.gender) this.selectGender(userData.gender);
if (userData.state) this.selectState(userData.state);
if (userData.district) this.selectDistrict(userData.district);
if (userData.localBody) this.selectLocalBody(userData.localBody);
Expand Down

0 comments on commit f718088

Please sign in to comment.