Skip to content

Commit

Permalink
made suggested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sidpg123 committed Dec 17, 2024
1 parent 0dbf1e2 commit 045f375
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/patient_spec/PatientVolunteer.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe("Assign a volunteer to a patient - Multiple Tests", () => {

it("should unassign volunteer successfully", () => {
patientDetailsPage.clickAssignOrReassignVolunteer();
patientDetailsPage.unassignAndPrepareForReassignment();
patientDetailsPage.unassignVolunteer();
patientDetailsPage.verifyBannerIsRemovedAfterUnassign();
});

Expand Down
16 changes: 6 additions & 10 deletions cypress/pageobject/Patient/PatientDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,16 @@ export class PatientDetailsPage {

clickAssignOrReassignVolunteer() {
cy.get("#assign-volunteer")
.scrollIntoView()
.should("be.visible")
.should("be.enabled")
.invoke("text")
.then((text) => {
if (text.includes("Assign to a Volunteer")) {
cy.verifyAndClickElement(
"#assign-volunteer",
"Assign to a Volunteer",
);
this.clickAssignToVolunteer();
} else if (text.includes("Reassign Volunteer")) {
cy.verifyAndClickElement("#assign-volunteer", "Reassign Volunteer");
this.clickReassignToVolunteer();
} else {
throw new Error("Expected button text not found.");
throw new Error(
`Button text must be either "Assign to a Volunteer" or "Reassign Volunteer", but found: "${text}"`,
);
}
});
}
Expand All @@ -34,7 +30,7 @@ export class PatientDetailsPage {
cy.verifyContentPresence("#assigned-volunteer", [volunteerName]);
}

unassignAndPrepareForReassignment() {
unassignVolunteer() {
cy.get("#clear-button").should("be.visible").click();
cy.get("#dropdown-toggle").should("be.visible").click();
cy.clickSubmitButton("Unassign");
Expand Down

0 comments on commit 045f375

Please sign in to comment.