Skip to content

Commit

Permalink
fixing cypress tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SwanandBhuskute committed Nov 23, 2024
1 parent a8950c3 commit 0d2e876
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 14 deletions.
6 changes: 4 additions & 2 deletions cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,10 @@ describe("Patient Consultation in multiple combination", () => {
cy.clickSubmitButton("Create Consultation");
cy.verifyNotification("Consultation created successfully");
// verify the data and death report
cy.get("#consultation-buttons").should("be.visible");
cy.contains("#consultation-buttons", "EXPIRED").should("exist");
patientConsultationPage.verifyTextInConsultation(
"#consultation-buttons",
"EXPIRED",
);
patientConsultationPage.clickPatientDetails();
patientDeathReport.clickDeathReport();
patientDeathReport.verifyDeathReportAutofill(
Expand Down
1 change: 0 additions & 1 deletion cypress/e2e/patient_spec/PatientRegistration.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ describe("Patient Creation with consultation", () => {
patientPage.createPatient();
patientPage.selectFacility(patientFacility);
patientPage.patientformvisibility();
cy.get("div:contains('Age')").scrollIntoView().should("be.visible").click();
// Patient Details page
patientPage.typePatientPhoneNumber(phone_number);
patientPage.checkPhoneNumberIsEmergencyNumber();
Expand Down
8 changes: 0 additions & 8 deletions cypress/e2e/sample_test_spec/SampleTestRequest.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ describe("Sample Test", () => {
patientConsultationPage.verifyPatientDetailsResponse();
// Visit SampleRequest Page
sampleTestPage.visitSampleRequestPage();
// Wait for necessary APIs
cy.intercept("GET", "/api/sample-test-status").as("sampleTestStatus");
// Fill Sample Test Request Form
sampleTestPage.selectSampleType(sampleTestType);
sampleTestPage.selectIcmrCategory(icmrCategory);
Expand All @@ -62,12 +60,6 @@ describe("Sample Test", () => {
cy.clickSubmitButton("Confirm your request to send sample for testing");
sampleTestPage.verifySampleTestReq();
cy.verifyNotification("Sample test created successfully");
// Wait for status element to load
cy.wait("@sampleTestStatus");
cy.get("#sample-test-status", { timeout: 20000 })
.should("exist")
.and("contain.text", sampleTestStatus);

// Check the updated request history
sampleTestPage.checkRequestHistory(
sampleTestStatus,
Expand Down
2 changes: 1 addition & 1 deletion cypress/pageobject/Patient/PatientConsultation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class PatientConsultationPage {

verifyTextInConsultation(selector: string, text: string) {
cy.get(selector).scrollIntoView();
cy.get(selector).contains(text).should("be.visible");
cy.get(selector).contains(text, { timeout: 20000 }).should("be.visible");
}

typeReferringFacility(referringFacility: string) {
Expand Down
4 changes: 3 additions & 1 deletion cypress/pageobject/Patient/PatientCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ export class PatientPage {
cy.intercept("GET", "**/api/v1/facility/**").as("getFacilities");
cy.get("#add-patient-details").should("be.visible");
cy.get("#add-patient-details").click();
cy.wait("@getFacilities").its("response.statusCode").should("eq", 200);
cy.wait("@getFacilities", { timeout: 20000 })
.its("response.statusCode")
.should("eq", 200);
}

visitPatient(patientName: string) {
Expand Down
2 changes: 1 addition & 1 deletion cypress/pageobject/Sample/SampleTestCreate.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export class SampleTestPage {
visitSampleRequestPage(): void {
cy.verifyAndClickElement("#sample-request-btn", "Request Sample Test");
cy.url().should("include", "/sample-test");
cy.url().should("include", "/sample-test", { timeout: 20000 });
}

selectSampleType(option: string): void {
Expand Down

0 comments on commit 0d2e876

Please sign in to comment.