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 ed43c9c commit a8950c3
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
6 changes: 2 additions & 4 deletions cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,8 @@ describe("Patient Consultation in multiple combination", () => {
cy.clickSubmitButton("Create Consultation");
cy.verifyNotification("Consultation created successfully");
// verify the data and death report
patientConsultationPage.verifyTextInConsultation(
"#consultation-buttons",
"EXPIRED",
);
cy.get("#consultation-buttons").should("be.visible");
cy.contains("#consultation-buttons", "EXPIRED").should("exist");
patientConsultationPage.clickPatientDetails();
patientDeathReport.clickDeathReport();
patientDeathReport.verifyDeathReportAutofill(
Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/patient_spec/PatientRegistration.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ 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: 8 additions & 0 deletions cypress/e2e/sample_test_spec/SampleTestRequest.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ 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 @@ -60,6 +62,12 @@ 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
8 changes: 5 additions & 3 deletions src/Utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -553,9 +553,11 @@ export const startCase = (str: string): string => {
.toLowerCase()
.replace(/\s+/g, " ")
.trim()
.split(" ")
.map((word) => (word ? word[0].toUpperCase() + word.slice(1) : ""))
.join(" ");
.split(/[\s.'-]+/)
.map((word) => {
return word ? word[0].toUpperCase() + word.slice(1) : "";
})
.join(" ");
};

// Converts a string to camelCase format, first word - lowercase and each subsequent word - uppercase letter, with no spaces.
Expand Down

0 comments on commit a8950c3

Please sign in to comment.