Skip to content

Commit

Permalink
Merge pull request #1137 from manishjha-04/accessionfix
Browse files Browse the repository at this point in the history
minorFix QA
  • Loading branch information
mozzy11 authored Jun 25, 2024
2 parents f4f9458 + a873d7f commit b0f3b14
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 3 deletions.
5 changes: 4 additions & 1 deletion frontend/cypress/e2e/orderEntity.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ describe("Order Entity", function () {
orderEntityPage.clickNextButton();
});

it("Should click generate Lab Order Number and store it in a fixture", function () {
it("Should do a validation check for labNo and then click generate Lab Order Number and store it in a fixture", function () {
cy.fixture("Order").then((order) => {
orderEntityPage.validateAcessionNumber(order.invalidLabNo);
});
orderEntityPage.generateLabOrderNumber();
cy.get("#labNo").then(($input) => {
const generatedOrderNumber = $input.val();
Expand Down
18 changes: 18 additions & 0 deletions frontend/cypress/e2e/patientEntry.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,24 @@ describe("Patient Search", function () {
cy.wait(200).reload();
});

it("should search patient By Lab Number", function () {
cy.fixture("Patient").then((patient) => {
patientPage.searchPatientBylabNo(patient.labNo);
cy.intercept(
"GET",
`**/rest/patient-search-results?*labNumber=${patient.labNo}*`,
).as("getPatientSearch");
patientPage.clickSearchPatientButton();
cy.wait("@getPatientSearch").then((interception) => {
const responseBody = interception.response.body;
console.log(responseBody);
expect(responseBody.patientSearchResults).to.be.an("array").that.is
.empty;
});
});
cy.wait(200).reload();
});

it("should search patient By PatientId", function () {
cy.wait(1000);
cy.fixture("Patient").then((patient) => {
Expand Down
3 changes: 2 additions & 1 deletion frontend/cypress/fixtures/Order.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
"firstName": "Optimus",
"lastName": "Prime"
},
"labNo": ""
"labNo": "",
"invalidLabNo":"DEV0124000000000000"
}
3 changes: 2 additions & 1 deletion frontend/cypress/fixtures/Patient.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"subjectNumber": "001202782410",
"nationalId": "UG-23SLHD7DBD",
"DOB": "12/05/2001",
"gender": "Male"
"gender": "Male",
"labNo":"DEV01240000000000001"
}
13 changes: 13 additions & 0 deletions frontend/cypress/pages/OrderEntityPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@ class OrderEntityPage {
).click();
}


validateAcessionNumber(order){
cy.intercept("GET", `**/rest/SampleEntryAccessionNumberValidation**`).as(
"accessionNoValidation",
);
cy.get("#labNo").type(order, { delay: 300 });

cy.wait("@accessionNoValidation").then((interception) => {
const responseBody = interception.response.body;
console.log(responseBody);
expect(responseBody.status).to.be.false;
});
}
enterSiteName(siteName) {
cy.enterText("input#siteName", siteName);
}
Expand Down
6 changes: 6 additions & 0 deletions frontend/cypress/pages/PatientEntryPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class PatientEntryPage {
personContactPrimaryPhone = "input#patientContact\\.person\\.primaryPhone";
personContactEmail = "input#patientContact\\.person\\.email";
patientIdSelector = "input#patientId";
labNoSelector="#labNumber";
city = "input#city";
primaryPhone = "input#primaryPhone";
dateOfBirth = "input#date-picker-default-id";
Expand Down Expand Up @@ -92,6 +93,11 @@ class PatientEntryPage {
cy.enterText(this.patientIdSelector, PID);
}

searchPatientBylabNo(labNo){
cy.enterText(this. labNoSelector, labNo);

}

getPatientSearchResultsTable() {
return cy.getElement(
".cds--data-table.cds--data-table--lg.cds--data-table--sort > tbody",
Expand Down

0 comments on commit b0f3b14

Please sign in to comment.