diff --git a/frontend/cypress/e2e/dashboard.cy.js b/frontend/cypress/e2e/dashboard.cy.js index 9612f2b30a..350b97956f 100644 --- a/frontend/cypress/e2e/dashboard.cy.js +++ b/frontend/cypress/e2e/dashboard.cy.js @@ -1,85 +1,93 @@ import LoginPage from "../pages/LoginPage"; +import DashBoardPage from "../pages/DashBoard"; let homePage = null; let loginPage = null; let dashboard = null; -before("login", () => { +before(() => { loginPage = new LoginPage(); loginPage.visit(); -}); -describe("Pathology Dashboard", function () { - it("User Visits Pathology Dashboard", function () { - homePage = loginPage.goToHomePage(); - dashboard = homePage.goToPathologyDashboard(); + dashboard = new DashBoardPage(); + homePage = loginPage.goToHomePage(); - dashboard.checkForHeader("Pathology"); - }); + cy.fixture("Order").as("dashBData"); +}); - it("User adds a new Pathology order", function () { - homePage.goToOrderPage(); - dashboard.addOrder("Histopathology"); +describe("Dashboard for the Home Page", function () { + it("User clicks search bar", function () { + dashboard.homeSearchBar(); }); - it("Check For Order", () => { - homePage.goToPathologyDashboard(); - dashboard.checkForHeader("Pathology"); - cy.fixture("DashBoard").then((order) => { - dashboard.validatePreStatus(order.labNo); + it("User types the patient to search and closes it", function () { + cy.fixture("Order").then((dashBData) => { + dashboard.searchBarInput(dashBData.searchName); }); + dashboard.homeSearchBar(); }); - it("Change The Status of Order and save it", () => { - dashboard.changeStatus("Completed"); - dashboard.enterDetails(); - dashboard.saveOrder(); + it("User interacts with the notifications icon", function () { + dashboard.notificationIcon(); + dashboard.notificationIconClose(); }); - it("Validate the Status of Order", () => { - cy.fixture("DashBoard").then((order) => { - // dashboard.validateOrderStatus(order.labNo, 4); + it("User interacts with the user icon", function () { + dashboard.userIcon(); + cy.fixture("Order").then((dashBData) => { + dashboard.userSelectsEng(dashBData.engLang); }); + dashboard.userIcon(); }); }); -describe("ImmunoChemistry Dashboard", function () { - it("User Visits ImmunoChemistry Dashboard", function () { - homePage = loginPage.goToHomePage(); - dashboard = homePage.goToImmunoChemistryDashboard(); - dashboard.checkForHeader("Immunohistochemistry"); - - // cy.fixture("DashBoard").then((order) => { - // dashboard.validatePreStatus(order.labNo); - - // }); +describe("Pathology Dashboard", function () { + it("User Visits the Dashboard", function () { + dashboard = homePage.goToPathology(); }); - it("User adds a new ImmunioChemistry order", function () { - homePage.goToOrderPage(); - dashboard.addOrder("Immunohistochemistry"); + it("User checks filters, selects cases and items per page", function () { + dashboard.checkFilters(); + cy.fixture("Order").then((dashBData) => { + dashboard.selectCases(dashBData.myCases); + dashboard.enterLabNumber(dashBData.labNumb); + dashboard.pageItems(dashBData.itemsPerPage); + }); }); +}); - it("Check For Order", () => { - homePage.goToImmunoChemistryDashboard(); - - dashboard.checkForHeader("Immunohistochemistry"); +describe("Immunohistochemistry Dashboard", function () { + it("User Visits the Dashboard", function () { + dashboard = homePage.goToImmunoChemistryDashboard(); + }); - cy.fixture("DashBoard").then((order) => { - dashboard.validatePreStatus(order.labNo); + it("User checks filters, selects cases and items per page", function () { + dashboard.checkFilters(); + cy.fixture("Order").then((dashBData) => { + dashboard.selectCompletedCases(dashBData.myCases2); + dashboard.enterLabNumber(dashBData.labNumb); + dashboard.pageItems(dashBData.itemsPerPage); }); }); +}); - it("Change The Status of Order and save it", () => { - dashboard.changeStatus("Completed"); - dashboard.selectPathologist("ELIS,Open"); - dashboard.saveOrder(); +describe("Cytology Dashboard", function () { + it("User Visits the Dashboard", function () { + dashboard = homePage.goToCytology(); }); - it("Validate the Status of Order", () => { - cy.fixture("DashBoard").then((order) => { - //TO DO : needs to be properly re-writen with proper selector - //dashboard.validateOrderStatus(order.labNo, 3); + it("User checks filters, selects cases and items per page", function () { + dashboard.checkFilters(); + cy.fixture("Order").then((dashBData) => { + dashboard.selectScreeningCases(dashBData.myCases3); + dashboard.enterLabNumber(dashBData.labNumb); + dashboard.pageItems(dashBData.itemsPerPage); }); }); }); + +describe("Back to home page", function () { + it("User navigates back to home page", function () { + dashboard = homePage.backToHomePage(); + }); +}); diff --git a/frontend/cypress/fixtures/Order.json b/frontend/cypress/fixtures/Order.json index 05213a9d4e..f10b1a005a 100644 --- a/frontend/cypress/fixtures/Order.json +++ b/frontend/cypress/fixtures/Order.json @@ -10,5 +10,12 @@ "lastName": "Prime" }, "labNo": "", - "invalidLabNo": "DEV0124000000000000" + "invalidLabNo": "DEV0124000000000000", + "labNumb": "REG-00000123", + "myCases": "Grossing", + "myCases2": "Completed", + "myCases3": "Screening", + "itemsPerPage": "30", + "searchName": "Smith", + "engLang": "English" } diff --git a/frontend/cypress/pages/DashBoard.js b/frontend/cypress/pages/DashBoard.js index 4ebee5f489..a21bc8e17d 100644 --- a/frontend/cypress/pages/DashBoard.js +++ b/frontend/cypress/pages/DashBoard.js @@ -1,81 +1,58 @@ class DashBoardPage { - addOrder(Program) { - cy.fixture("Order").then((order) => { - cy.get( - ":nth-child(2) > .cds--radio-button__label > .cds--radio-button__appearance", - ).click(); - cy.get("#local_search").click(); - cy.get( - "tbody > :nth-child(1) > :nth-child(1) > .cds--radio-button-wrapper > .cds--radio-button__label > .cds--radio-button__appearance", - ).click(); - cy.get(".forwardButton").click(); - cy.get("#additionalQuestionsSelect").select(Program); - cy.get(".forwardButton").click(); - cy.get("#sampleId_0").select("Serum"); - cy.get( - ".testPanels > .cds--col > :nth-child(5) > .cds--checkbox-label", - ).click(); - cy.get(".forwardButton").click(); - cy.get( - ":nth-child(2) > :nth-child(1) > :nth-child(2) > .cds--link", - ).click(); - cy.wait(1000); + constructor() {} - cy.get("#labNo") - .invoke("val") - .then((labNoValue) => { - if (labNoValue) { - const data = { labNo: labNoValue }; - cy.writeFile("cypress/fixtures/DashBoard.json", data); - } else { - cy.log("labNoValue is empty or undefined"); - } - }); + homeSearchBar() { + cy.get('[data-cy="header-global-action-search"]').click(); + } + searchBarInput(inputName) { + cy.get("#searchItem").type(inputName); + } - cy.get("#siteName").type(order.siteName); - cy.get("#requesterFirstName").type(order.requester.firstName); - cy.get("#requesterLastName").type(order.requester.firstName); - cy.get(".forwardButton").should("be.visible").click(); - }); + searchBarClose() { + cy.get('[data-cy="header-global-action-search"]').click(); } - checkForHeader(title) { - cy.get("section > h3").should("have.text", title); + notificationIcon() { + cy.get('[data-cy="header-global-action-notifications"]').click(); } - enterDetails() { - cy.get( - ":nth-child(14) > .gridBoundary > :nth-child(1) > .cds--form-item > .cds--text-area__wrapper > .cds--text-area", - ).type("Test"); - cy.get( - ":nth-child(2) > .cds--form-item > .cds--text-area__wrapper > .cds--text-area", - ).type("Test"); + notificationIconClose() { + cy.get("#close-slide-over").click(); } - validateOrderStatus(orderNumber, childIndex) { - cy.get(":nth-child(2) > .cds--link").click(); - cy.get(":nth-child(1) > .tile-value").should("have.text", "0"); - cy.get(`:nth-child(${childIndex}) > .tile-value`).should("have.text", "1"); - cy.get("#statusFilter").select("Completed"); - cy.get("tbody > tr > :nth-child(4)").should("have.text", "John"); + userIcon() { + cy.get('[data-cy="header-global-action-user"]').click(); } - validatePreStatus(order) { - cy.get(":nth-child(1) > .tile-value").should("have.text", "1"); - cy.get("tbody > tr > :nth-child(4)").should("have.text", "John"); - cy.get("tbody > tr > :nth-child(6)").click(); + userSelectsEng(engLang) { + cy.get("#selector").select(engLang); } - saveOrder() { - cy.get("#pathology_save2").click(); + userClosesIcon() { + cy.get('[data-cy="header-global-action-user"]').click(); } - changeStatus(status) { - cy.get("#status").select(status); + checkFilters() { + cy.get("#filterMyCases").check({ force: true }); + } + + selectCases(myCases) { + cy.get("#statusFilter").select(myCases); + } + + selectCompletedCases(myCases2) { + cy.get("#statusFilter").select(myCases2); + } + + selectScreeningCases(myCases3) { + cy.get("#statusFilter").select(myCases3); + } + enterLabNumber(labNumb) { + cy.get("#search-input-41").should("be.visible").type(labNumb); } - selectPathologist(pathologist) { - cy.get("#assignedPathologist").select(pathologist); + pageItems(itemsPerPage) { + cy.get("#cds-pagination-select-id-59").select(itemsPerPage); } } diff --git a/frontend/cypress/pages/HomePage.js b/frontend/cypress/pages/HomePage.js index 4d14e744a9..637170674f 100755 --- a/frontend/cypress/pages/HomePage.js +++ b/frontend/cypress/pages/HomePage.js @@ -180,7 +180,7 @@ class HomePage { return new StudyReportPage(); } - goToPathologyDashboard() { + goToPathology() { this.openNavigationMenu(); cy.get("#menu_pathology").click(); // Changed from menu_pathology_dropdown return new DashBoardPage(); @@ -192,6 +192,12 @@ class HomePage { return new DashBoardPage(); } + goToCytology() { + this.openNavigationMenu(); + cy.get("#menu_cytology").click(); + return new DashBoardPage(); + } + goToAdminPage() { this.openNavigationMenu(); cy.get("#menu_administration").click(); @@ -244,6 +250,11 @@ class HomePage { selectDelayedTurnAround() { cy.contains("a.cds--link", "Delayed Turn Around").click(); } + //This takes you from any page back to the home page + backToHomePage() { + this.openNavigationMenu(); + cy.get("#menu_home").click(); + } } export default HomePage; diff --git a/frontend/src/components/layout/Header.js b/frontend/src/components/layout/Header.js index a345dc8f43..8fb0a8c556 100644 --- a/frontend/src/components/layout/Header.js +++ b/frontend/src/components/layout/Header.js @@ -452,6 +452,7 @@ function OEHeader(props) { {!searchBar ? ( @@ -462,6 +463,7 @@ function OEHeader(props) {
{panelSwitchIcon()}