-
Notifications
You must be signed in to change notification settings - Fork 430
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add TestSuit to request for sample test
- Loading branch information
1 parent
36b1ceb
commit 66bfe4a
Showing
3 changed files
with
49 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,73 @@ | ||
export class SampleTestPage { | ||
sampleTestReportHistory = 0; | ||
patientName = ""; // to search patient in sample page | ||
patientName = ""; // to search for patient in sample page | ||
|
||
visitPatientPage() { | ||
cy.awaitUrl("/patients"); | ||
} | ||
|
||
visitPatientDashboardPage() { | ||
cy.wait(1000); | ||
cy.get(".patient-stable-ring").should("be.visible"); | ||
cy.get(".patient-stable-ring").first().click(); | ||
cy.get(".patient-stable-ring").first().scrollIntoView(); | ||
cy.get(".patient-stable-ring").should("be.visible").first().click(); | ||
cy.get("#patient-name") | ||
.invoke("text") | ||
.then((patientName) => { | ||
// Trim any excess whitespace | ||
this.patientName = patientName.trim(); | ||
}); | ||
cy.get("#patient-details").should("be.visible"); | ||
cy.get("#patient-details").click(); | ||
cy.get("#patient-details").should("be.visible").click(); | ||
} | ||
|
||
visitSampleRequestPage() { | ||
cy.get("body").then(($body) => { | ||
if ($body.find("#sample-test-history").length > 0) { | ||
cy.get("#sample-test-history") | ||
.its("length") | ||
.then((count) => { | ||
this.sampleTestReportHistory = count; | ||
}); | ||
} else { | ||
// Element does not exist, set to 0 | ||
this.sampleTestReportHistory = 0; | ||
} | ||
}); | ||
|
||
cy.get("#sample-request-btn").should("be.visible"); | ||
cy.get("#sample-request-btn").click(); | ||
cy.get("#sample-test-history").scrollIntoView(); | ||
cy.get("#sample-test-history") | ||
.its("length") | ||
.then((count) => { | ||
this.sampleTestReportHistory = count || 0; | ||
}); | ||
cy.get("#sample-request-btn").scrollIntoView(); | ||
cy.get("#sample-request-btn").should("be.visible").click(); | ||
} | ||
|
||
selectSampleType(option: string) { | ||
cy.get("#sample-type").should("be.visible"); | ||
cy.get("#sample-type").click(); | ||
cy.get("#sample-type").should("be.visible").click(); | ||
cy.get("[role='option']").contains(option).click(); | ||
} | ||
|
||
selectIcmrCategory(option: string) { | ||
cy.get("#icmr-category").should("be.visible"); | ||
cy.get("#icmr-category").click(); | ||
cy.get("#icmr-category").should("be.visible").click(); | ||
cy.get("[role='option']").contains(option).click(); | ||
} | ||
|
||
typeIcmrLabel(label: string) { | ||
cy.get("#icmr-label").should("be.visible"); | ||
cy.get("#icmr-label").type(label); | ||
cy.get("#icmr-label").should("be.visible").type(label); | ||
} | ||
|
||
submitForm() { | ||
cy.get("#sample-test-submit-btn").should("be.visible"); | ||
cy.get("#sample-test-submit-btn").click(); | ||
cy.get("#sample-test-submit-btn").scrollIntoView(); | ||
cy.get("#sample-test-submit-btn").should("be.visible").click(); | ||
} | ||
|
||
clickOnNotification() { | ||
cy.get(".pnotify-container").should("be.visible"); | ||
cy.get(".pnotify-container").click(); | ||
cy.get(".pnotify-container").should("be.visible").click(); | ||
} | ||
|
||
checkRequestHistory() { | ||
cy.get("#sample-test-history").scrollIntoView(); | ||
cy.get("#sample-test-history").should( | ||
"have.length", | ||
this.sampleTestReportHistory + 1, | ||
); | ||
} | ||
|
||
visitSamplePage() { | ||
cy.awaitUrl("/sample"); | ||
} | ||
|
||
searchPatientSample() { | ||
cy.get("#search_patient_name").should("be.visible").type(this.patientName); | ||
} | ||
|
||
patientSampleMustExist() { | ||
cy.get("#sample-card").should("be.visible"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters