-
Notifications
You must be signed in to change notification settings - Fork 196
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 #1171 from manishjha-04/reportnce
E2E Coverage for Report NCE
- Loading branch information
Showing
6 changed files
with
132 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import LoginPage from "../pages/LoginPage"; | ||
import HomePage from "../pages/HomePage"; | ||
import NonConform from "../pages/NonConformPage"; | ||
|
||
let homePage = null; | ||
let loginPage = null; | ||
let nonConform = null; | ||
|
||
before("login", () => { | ||
loginPage = new LoginPage(); | ||
loginPage.visit(); | ||
}); | ||
|
||
describe("Report Non-Conforming Event", function () { | ||
beforeEach("navigate to Report Non-Conforming Event Page", function () { | ||
homePage = loginPage.goToHomePage(); | ||
nonConform = homePage.goToReportNCE(); | ||
}); | ||
|
||
it("User visits Report Non-Conforming Event Page", function () { | ||
nonConform | ||
.getReportNonConformTitle() | ||
.should("contain.text", "Report Non-Conforming Event (NCE)"); | ||
}); | ||
|
||
it("Should Search by Last Name and Validate the results", function () { | ||
cy.fixture("Patient").then((patient) => { | ||
nonConform.selectSearchType("Last Name"); | ||
nonConform.enterSearchField(patient.lastName); | ||
nonConform.clickSearchButton(); | ||
cy.fixture("EnteredOrder").then((order) => { | ||
nonConform.validateSearchResult(order.labNo); | ||
}); | ||
}); | ||
}); | ||
|
||
it("Should Search by First Name and Validate the results", function () { | ||
cy.fixture("Patient").then((patient) => { | ||
nonConform.selectSearchType("First Name"); | ||
nonConform.enterSearchField(patient.firstName); | ||
nonConform.clickSearchButton(); | ||
cy.fixture("EnteredOrder").then((order) => { | ||
nonConform.validateSearchResult(order.labNo); | ||
}); | ||
}); | ||
}); | ||
|
||
it("Should Search by PatientID and Validate the results", function () { | ||
cy.fixture("Patient").then((patient) => { | ||
nonConform.selectSearchType("Patient Identification Code"); | ||
nonConform.enterSearchField(patient.nationalId); | ||
nonConform.clickSearchButton(); | ||
cy.fixture("EnteredOrder").then((order) => { | ||
nonConform.validateSearchResult(order.labNo); | ||
}); | ||
}); | ||
}); | ||
|
||
it("Should Search by Lab Number and Submit the NCE Reporting Form", function () { | ||
cy.fixture("EnteredOrder").then((order) => { | ||
nonConform.selectSearchType("Lab Number"); | ||
nonConform.enterSearchField(order.labNo); | ||
nonConform.clickSearchButton(); | ||
nonConform.validateSearchResult(order.labNo); | ||
nonConform.clickCheckbox(); | ||
nonConform.clickGoToNceFormButton(); | ||
}); | ||
|
||
cy.fixture("NonConform").then((nonConformData) => { | ||
nonConform.enterStartDate(nonConformData.dateOfEvent); | ||
nonConform.submitForm(); | ||
}); | ||
}); | ||
}); |
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,3 @@ | ||
{ | ||
"dateOfEvent":"10/07/2024" | ||
} |
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,40 @@ | ||
class NonConform { | ||
getReportNonConformTitle() { | ||
return cy.get("h2"); | ||
} | ||
|
||
selectSearchType(type) { | ||
cy.get('#type').select(type); | ||
} | ||
|
||
enterSearchField(value) { | ||
cy.get('#field\\.name').type(value); | ||
} | ||
|
||
clickSearchButton() { | ||
cy.get(':nth-child(4) > .cds--btn').click(); | ||
} | ||
|
||
validateSearchResult(expectedValue) { | ||
cy.get('tbody > tr > :nth-child(2)').invoke('text').should('eq', expectedValue); | ||
} | ||
|
||
clickCheckbox() { | ||
cy.get('.cds--checkbox-label').click(); | ||
} | ||
|
||
clickGoToNceFormButton() { | ||
cy.get(':nth-child(2) > :nth-child(2) > .cds--btn').click(); | ||
} | ||
|
||
enterStartDate(date) { | ||
cy.get('.cds--date-picker-input__wrapper > #startDate').type(date); | ||
} | ||
|
||
submitForm() { | ||
cy.get(':nth-child(16) > .cds--btn').click(); | ||
} | ||
} | ||
|
||
export default NonConform; | ||
|
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