-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1223 from manishjha-04/batchOrder
E2E Coverage For Batch Order Entry
- Loading branch information
Showing
7 changed files
with
220 additions
and
2 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
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 |
---|---|---|
@@ -0,0 +1,112 @@ | ||
import LoginPage from "../pages/LoginPage"; | ||
|
||
let homePage = null; | ||
let loginPage = null; | ||
let batchOrder = null; | ||
|
||
const navigateToBatchOrderEntryPage = () => { | ||
homePage = loginPage.goToHomePage(); | ||
batchOrder = homePage.goToBatchOrderEntry(); | ||
}; | ||
|
||
before(() => { | ||
cy.fixture("BatchOrder").as("batchOrderData"); | ||
}); | ||
|
||
before("login", () => { | ||
loginPage = new LoginPage(); | ||
loginPage.visit(); | ||
}); | ||
|
||
describe("Batch Order Entry On Demand", function () { | ||
before("navigate to Batch Order Entry Page", function () { | ||
navigateToBatchOrderEntryPage(); | ||
}); | ||
|
||
it("User visits Batch Order Entry Setup Page", function () { | ||
batchOrder.visitSetupPage(); | ||
batchOrder.checkNextButtonDisabled(); | ||
}); | ||
|
||
it("Should Select Form And Samples", function () { | ||
cy.fixture("BatchOrder").then((batchOrderData) => { | ||
batchOrder.selectForm(batchOrderData.formTypeRoutine); | ||
batchOrder.selectSampleType(batchOrderData.sampleType); | ||
batchOrder.selectPanel(3); | ||
}); | ||
}); | ||
|
||
it("Should Select Methods, Site Name and Move to Next Page", function () { | ||
cy.fixture("BatchOrder").then((batchOrderData) => { | ||
batchOrder.selectMethod(batchOrderData.methodOnDemand); | ||
batchOrder.checkFacilityCheckbox(); | ||
batchOrder.enterSiteName(batchOrderData.siteName); | ||
batchOrder.checkNextButtonEnabled(); | ||
}); | ||
}); | ||
|
||
it("Should Visit Batch Order Entry Page", function () { | ||
batchOrder.visitBatchOrderEntryPage(); | ||
}); | ||
|
||
it("Should Validate Fields And Generate BarCode", function () { | ||
cy.fixture("BatchOrder").then((batchOrderData) => { | ||
batchOrder.validateField("#tag-54", batchOrderData.sampleType); | ||
batchOrder.validateField("#tag-56", batchOrderData.panel); | ||
batchOrder.validateField("#tag-58", batchOrderData.facility); | ||
batchOrder.checkNextLabel().should("be.disabled"); | ||
batchOrder.clickGenerateAndSaveBarcode(); | ||
batchOrder.checkNextLabel().should("be.visible"); | ||
}); | ||
}); | ||
}); | ||
|
||
describe("Batch Order Entry Pre Printed", function () { | ||
before("navigate to Batch Order Entry Page", function () { | ||
navigateToBatchOrderEntryPage(); | ||
}); | ||
|
||
it("User visits Batch Order Entry Setup Page", function () { | ||
batchOrder.visitSetupPage(); | ||
batchOrder.checkNextButtonDisabled(); | ||
}); | ||
|
||
it("Should Select Form And Samples", function () { | ||
cy.fixture("BatchOrder").then((batchOrderData) => { | ||
batchOrder.selectForm(batchOrderData.formTypeRoutine); | ||
batchOrder.selectSampleType(batchOrderData.sampleType); | ||
batchOrder.selectPanel(3); | ||
}); | ||
}); | ||
|
||
it("Should Select Methods, Site Name and Move to Next Page", function () { | ||
cy.fixture("BatchOrder").then((batchOrderData) => { | ||
batchOrder.selectMethod(batchOrderData.methodPrePrinted); | ||
batchOrder.checkFacilityCheckbox(); | ||
batchOrder.checkPatientCheckbox(); | ||
batchOrder.enterSiteName(batchOrderData.siteName); | ||
batchOrder.checkNextButtonEnabled(); | ||
}); | ||
}); | ||
|
||
it("Should Visit Batch Order Entry Page", function () { | ||
batchOrder.visitBatchOrderEntryPage(); | ||
}); | ||
|
||
it("Should Validate Fields", function () { | ||
cy.fixture("BatchOrder").then((batchOrderData) => { | ||
batchOrder.validateField("#tag-58", batchOrderData.sampleType); | ||
batchOrder.validateField("#tag-60", batchOrderData.panel); | ||
batchOrder.validateField("#tag-62", batchOrderData.facility); | ||
}); | ||
}); | ||
|
||
it("Should Search For Patient And Generate Barcode", function () { | ||
batchOrder.selectPatientGender(2); | ||
batchOrder.clickSearchPatient(); | ||
batchOrder.selectPatient(1); | ||
|
||
batchOrder.clickGenerateButton(); | ||
batchOrder.saveOrder(); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"formTypeRoutine": "Routine", | ||
"sampleType": "Serum", | ||
"methodOnDemand": "On Demand", | ||
"methodPrePrinted": "Pre-Printed", | ||
"siteName": "CAMES", | ||
"panel": "Western blot HIV", | ||
"facility": "279 - CAMES MAN" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,86 @@ | ||
class BatchOrderEntry { | ||
visitSetupPage() { | ||
cy.get("h2").should("contain.text", "Batch Order Entry Setup"); | ||
} | ||
|
||
checkNextButtonDisabled() { | ||
cy.get(":nth-child(12) > .cds--btn").should("be.disabled"); | ||
} | ||
|
||
selectForm(formType) { | ||
cy.get("#form-dropdown").select(formType); | ||
} | ||
|
||
selectSampleType(sampleType) { | ||
cy.get("#selectSampleType").should("be.visible").select(sampleType); | ||
} | ||
|
||
selectPanel(panelIndex) { | ||
cy.get( | ||
`:nth-child(${panelIndex}) > :nth-child(5) > .cds--checkbox-label`, | ||
).click(); | ||
} | ||
|
||
checkNextLabel() { | ||
return cy.get(":nth-child(8) > .cds--btn"); | ||
} | ||
|
||
clickGenerateButton() { | ||
cy.get(":nth-child(2) > .cds--link").click(); | ||
} | ||
|
||
selectMethod(method) { | ||
cy.get("#method-dropdown").select(method); | ||
} | ||
|
||
checkFacilityCheckbox() { | ||
cy.get(":nth-child(5) > .cds--form-item > .cds--checkbox-label").click(); | ||
} | ||
|
||
checkPatientCheckbox() { | ||
cy.get(":nth-child(6) > .cds--form-item > .cds--checkbox-label").click(); | ||
} | ||
|
||
enterSiteName(siteName) { | ||
cy.get("#siteName").type(siteName); | ||
cy.get(".suggestion-active").should("be.visible").click(); | ||
} | ||
|
||
checkNextButtonEnabled() { | ||
cy.get(":nth-child(12) > .cds--btn").should("not.be.disabled").click(); | ||
} | ||
|
||
visitBatchOrderEntryPage() { | ||
cy.get("h2").should("contain.text", "Batch Order Entry"); | ||
} | ||
|
||
validateField(tagId, expectedText) { | ||
cy.get(tagId).should("contain.text", expectedText); | ||
} | ||
|
||
clickGenerateAndSaveBarcode() { | ||
cy.get(".cds--link > p").click(); | ||
} | ||
|
||
saveOrder() { | ||
cy.get(":nth-child(6) > .cds--btn").click(); | ||
} | ||
|
||
checkNextButtonVisible() { | ||
cy.get(":nth-child(8) > .cds--btn").should("be.visible"); | ||
} | ||
|
||
selectPatientGender(genderIndex) { | ||
cy.get(`:nth-child(${genderIndex}) > .cds--radio-button__label`).click(); // 2 for male, 3 for female | ||
} | ||
|
||
clickSearchPatient() { | ||
cy.get("#local_search").click(); | ||
} | ||
|
||
selectPatient(rowIndex) { | ||
cy.get(`tbody > :nth-child(${rowIndex}) > :nth-child(1)`).click(); | ||
} | ||
} | ||
|
||
export default BatchOrderEntry; |
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