Skip to content

Commit

Permalink
made suggestions from the code rabbit
Browse files Browse the repository at this point in the history
  • Loading branch information
AnveshNalimela committed Nov 26, 2024
1 parent 92fde8b commit e735efa
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 22 deletions.
10 changes: 5 additions & 5 deletions cypress/e2e/users_spec/UsersCreation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe("User Creation", () => {
const email = "[email protected]";
const password = "Test@123";
const qualification = "MBBS";
const experince = "2";
const experience = "2";
const regNo = "123456789";
const newUserFirstName = "cypress test";
const newUserLastName = "staff user";
Expand Down Expand Up @@ -108,7 +108,7 @@ describe("User Creation", () => {
userProfilePage.typeEmail(email);
userProfilePage.clearWorkingHours();
userProfilePage.typeWorkingHours(weeklyWorkingHrs);
userProfilePage.typedate_of_birth(dob);
userProfilePage.typeDateOfBirth(dob);
cy.intercept("PATCH", "/api/v1/users/*").as("updateUser");
cy.clickSubmitButton(updateBtn);
cy.wait("@updateUser").its("response.statusCode").should("eq", 200);
Expand Down Expand Up @@ -148,10 +148,10 @@ describe("User Creation", () => {
userCreationPage.typeConfirmPassword(password);
userCreationPage.selectHomeFacility(homeFacility);
userPage.typeInPhoneNumber(phone_number);
userProfilePage.typedate_of_birth(newUserDob);
userProfilePage.typeDateOfBirth(newUserDob);
userCreationPage.selectUserType(role);
userProfilePage.typeQualification(qualification);
userProfilePage.typeDoctorYoE(experince);
userProfilePage.typeDoctorYoE(experience);
userProfilePage.typeMedicalCouncilRegistration(regNo);
userPage.typeInFirstName(newUserFirstName);
userPage.typeInLastName(newUserLastName);
Expand All @@ -171,7 +171,7 @@ describe("User Creation", () => {
cy.verifyContentPresence("#district", [district]);
cy.verifyContentPresence("#home_facility", [homeFacility]);
cy.verifyContentPresence("#qualification", [qualification]);
cy.verifyContentPresence("#doctor-experience", [experince]);
cy.verifyContentPresence("#doctor-experience", [experience]);
cy.verifyContentPresence("#medical-council-registration", [regNo]);
});

Expand Down
8 changes: 4 additions & 4 deletions cypress/e2e/users_spec/UsersProfile.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe("Manage User Profile", () => {
it("Set Dob, Gender, Email, Phone and Working Hours for a user and verify its reflection in user profile", () => {
userProfilePage.clickEditProfileButton();

userProfilePage.typedate_of_birth(date_of_birth);
userProfilePage.typeDateOfBirth(date_of_birth);
userProfilePage.selectGender(gender);
userProfilePage.typeEmail(email);
userProfilePage.typePhoneNumber(phone);
Expand All @@ -46,11 +46,11 @@ describe("Manage User Profile", () => {

cy.verifyNotification("Details updated successfully");

userProfilePage.assertdate_of_birth("01/01/1999");
userProfilePage.assertDateOfBirth("01/01/1999");
userProfilePage.assertGender(gender);
userProfilePage.assertEmail(email);
userProfilePage.assertPhone(phone);
userProfilePage.assertWhatsApp(phone);
userProfilePage.assertPhoneNumber(phone);
userProfilePage.assertAltPhoneNumber(phone);
userProfilePage.assertWorkingHours(workinghours);
});

Expand Down
23 changes: 10 additions & 13 deletions cypress/pageobject/Users/UserProfilePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export default class UserProfilePage {
cy.get("#submit").click();
}

typedate_of_birth(date_of_birth: string) {
cy.clickAndTypeDate("#date_of_birth", date_of_birth);
typeDateOfBirth(dob: string) {
cy.clickAndTypeDate("#date_of_birth", dob);
}

clearPhoneNumber() {
Expand Down Expand Up @@ -49,8 +49,8 @@ export default class UserProfilePage {
cy.get("#altPhoneNumber").click().clear().type(phone);
}

typeWorkingHours(workinghours: string) {
cy.get("#weekly_working_hours").click().clear().type(workinghours);
typeWorkingHours(workingHours: string) {
cy.get("#weekly_working_hours").click().clear().type(workingHours);
}

typeQualification = (qualification: string) => {
Expand All @@ -68,11 +68,8 @@ export default class UserProfilePage {
.type(medicalCouncilRegistration);
};

assertdate_of_birth(date_of_birth: string) {
cy.get("#date_of_birth-profile-details").should(
"contain.text",
date_of_birth,
);
assertDateOfBirth(dob: string) {
cy.get("#date_of_birth-profile-details").should("contain.text", dob);
}

assertGender(gender: string) {
Expand All @@ -83,18 +80,18 @@ export default class UserProfilePage {
cy.get("#emailid-profile-details").should("contain.text", email);
}

assertPhone(phone: string) {
assertPhoneNumber(phone: string) {
cy.get("#contactno-profile-details").should("contain.text", phone);
}

assertWhatsApp(phone: string) {
assertAltPhoneNumber(phone: string) {
cy.get("#whatsapp-profile-details").should("contain.text", phone);
}

assertWorkingHours(workinghours: string) {
assertWorkingHours(workingHours: string) {
cy.get("#averageworkinghour-profile-details").should(
"contain.text",
workinghours,
workingHours,
);
}
}

0 comments on commit e735efa

Please sign in to comment.