forked from I-TECH-UW/OpenELIS-Global-2
-
Notifications
You must be signed in to change notification settings - Fork 0
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 I-TECH-UW#946 from manishjha-04/cypressmodifypatient
Test Coverage: Modify Order Page
- Loading branch information
Showing
12 changed files
with
226 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,7 @@ | |
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
yarn-error.log* | ||
|
||
/cypress/videos/ | ||
cypress/screenshots/ |
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
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,137 @@ | ||
import LoginPage from "../pages/LoginPage"; | ||
import PatientEntryPage from "../pages/PatientEntryPage"; | ||
|
||
let homePage = null; | ||
let loginPage = null; | ||
let modifyOrderPage = null; | ||
let patientPage = new PatientEntryPage(); | ||
|
||
before("login", () => { | ||
loginPage = new LoginPage(); | ||
loginPage.visit(); | ||
}); | ||
|
||
describe("Modify Order search by accession Number", function () { | ||
|
||
it("User Visits Home Page and goes to Modify Order Page ", function () { | ||
homePage = loginPage.goToHomePage(); | ||
modifyOrderPage = homePage.goToModifyOrderPage(); | ||
}); | ||
|
||
it("User searches with accession number", () => { | ||
cy.fixture("Order").then((order) => { | ||
modifyOrderPage.enterAccessionNo(order.labNo); | ||
}); | ||
modifyOrderPage.clickSubmitButton(); | ||
}); | ||
|
||
it("should check for program selection button and go to next page ", function () { | ||
modifyOrderPage.checkProgramButton(); | ||
modifyOrderPage.clickNextButton(); | ||
}); | ||
|
||
it("should be able to record", function () { | ||
modifyOrderPage.assignValues(); | ||
}); | ||
|
||
it("User should click next to go add order page and submit the order", function () { | ||
modifyOrderPage.clickNextButton(); | ||
cy.wait(1000); | ||
modifyOrderPage.clickNextButton(); | ||
}); | ||
|
||
it("should be able to print barcode", function () { | ||
cy.window().then((win) => { | ||
cy.spy(win, "open").as("windowOpen"); | ||
}); | ||
modifyOrderPage.clickPrintBarcodeButton(); | ||
cy.get("@windowOpen").should( | ||
"be.calledWithMatch", | ||
"/api/OpenELIS-Global/LabelMakerServlet?labNo=", | ||
); | ||
}); | ||
}); | ||
|
||
describe("Modify Order search by patient ", function () { | ||
it("User Visits Home Page and goes to Modify Order Page ", function () { | ||
homePage = loginPage.goToHomePage(); | ||
modifyOrderPage = homePage.goToModifyOrderPage(); | ||
}); | ||
|
||
it("Should search Patient By First and LastName", function () { | ||
cy.wait(1000); | ||
cy.fixture("Patient").then((patient) => { | ||
patientPage.searchPatientByFirstAndLastName( | ||
patient.firstName, | ||
patient.lastName, | ||
); | ||
patientPage.getFirstName().should("have.value", patient.firstName); | ||
patientPage.getLastName().should("have.value", patient.lastName); | ||
|
||
patientPage.getLastName().should("not.have.value", patient.inValidName); | ||
|
||
modifyOrderPage.clickSearchPatientButton(); | ||
patientPage.validatePatientSearchTable( | ||
patient.firstName, | ||
patient.inValidName, | ||
); | ||
}); | ||
cy.wait(200).reload(); | ||
}); | ||
|
||
it("Should be able to search patients By gender", function () { | ||
cy.wait(1000); | ||
patientPage.getMaleGenderRadioButton().should("be.visible"); | ||
patientPage.getMaleGenderRadioButton().click(); | ||
cy.wait(200); | ||
modifyOrderPage.clickSearchPatientButton(); | ||
cy.fixture("Patient").then((patient) => { | ||
patientPage.validatePatientByGender("M"); | ||
}); | ||
cy.wait(200).reload(); | ||
}); | ||
|
||
it("should search patient By PatientId", function () { | ||
cy.wait(1000); | ||
cy.fixture("Patient").then((patient) => { | ||
patientPage.searchPatientByPatientId(patient.nationalId); | ||
modifyOrderPage.clickSearchPatientButton(); | ||
patientPage.validatePatientSearchTable( | ||
patient.firstName, | ||
patient.inValidName, | ||
); | ||
}); | ||
}); | ||
|
||
it("Should be able to search by respective patient ", function () { | ||
cy.wait(1000); | ||
modifyOrderPage.clickRespectivePatient(); | ||
}); | ||
it("should check for program selection button and go to next page ", function () { | ||
cy.wait(1000); | ||
modifyOrderPage.checkProgramButton(); | ||
modifyOrderPage.clickNextButton(); | ||
}); | ||
|
||
it("should be able to record", function () { | ||
cy.wait(1000); | ||
modifyOrderPage.assignValues(); | ||
}); | ||
|
||
it("User should click next to go add order page and submit the order", function () { | ||
modifyOrderPage.clickNextButton(); | ||
cy.wait(1000); | ||
modifyOrderPage.clickNextButton(); | ||
}); | ||
|
||
it("should be able to print barcode", function () { | ||
cy.window().then((win) => { | ||
cy.spy(win, "open").as("windowOpen"); | ||
}); | ||
modifyOrderPage.clickPrintBarcodeButton(); | ||
cy.get("@windowOpen").should( | ||
"be.calledWithMatch", | ||
"/api/OpenELIS-Global/LabelMakerServlet?labNo=", | ||
); | ||
}); | ||
}); |
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
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,44 @@ | ||
class ModifyOrderPage { | ||
|
||
constructor() { | ||
} | ||
|
||
visit() { | ||
cy.visit('/FindOrder'); | ||
} | ||
|
||
enterAccessionNo(accessionNo) { | ||
cy.enterText('.cds--text-input.cds--text-input--md.cds--text__input', accessionNo); | ||
} | ||
|
||
clickSubmitButton() { | ||
return cy.getElement('div[class=\'cds--lg:col-span-2 cds--css-grid-column\'] button[type=\'submit\']').should('be.visible').click(); | ||
|
||
} | ||
|
||
clickNextButton(){ | ||
return cy.get('.forwardButton').should('be.visible').click(); | ||
} | ||
|
||
|
||
checkProgramButton(){ | ||
return cy.get('#additionalQuestionsSelect').should("be.disabled"); | ||
} | ||
|
||
assignValues() { | ||
cy.get(':nth-child(1) > :nth-child(4) > .cds--form-item > .cds--checkbox-label').click(); | ||
} | ||
|
||
clickPrintBarcodeButton(){ | ||
return cy.get('.orderEntrySuccessMsg > :nth-child(3) > .cds--btn').click(); | ||
} | ||
clickSearchPatientButton(){ | ||
return cy.get('.searchActionButtons > .cds--btn--primary').click(); | ||
} | ||
|
||
clickRespectivePatient(){ | ||
return cy.get(':nth-child(1) > :nth-child(1) > .cds--radio-button-wrapper > .cds--radio-button__label > .cds--radio-button__appearance').click(); | ||
} | ||
} | ||
|
||
export default ModifyOrderPage; |
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