-
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 branch 'develop' of github.com:I-TECH-UW/OpenELIS-Global-2 into…
… develop
- Loading branch information
Showing
28 changed files
with
1,343 additions
and
324 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import LoginPage from "../pages/LoginPage"; | ||
|
||
let homePage = null; | ||
let loginPage = null; | ||
let dashboard = null; | ||
|
||
before("login", () => { | ||
loginPage = new LoginPage(); | ||
loginPage.visit(); | ||
}); | ||
|
||
describe("Pathology Dashboard", function () { | ||
it("User Visits Pathology Dashboard", function () { | ||
homePage = loginPage.goToHomePage(); | ||
dashboard = homePage.goToPathologyDashboard(); | ||
|
||
dashboard.checkForHeader("Pathology"); | ||
}); | ||
|
||
it("User adds a new Pathology order", function () { | ||
homePage.goToOrderPage(); | ||
dashboard.addOrder("Histopathology"); | ||
}); | ||
it("Check For Order", () => { | ||
homePage.goToPathologyDashboard(); | ||
dashboard.checkForHeader("Pathology"); | ||
|
||
cy.fixture("DashBoard").then((order) => { | ||
dashboard.validatePreStatus(order.labNo); | ||
}); | ||
}); | ||
|
||
it("Change The Status of Order and save it", () => { | ||
dashboard.changeStatus("Completed"); | ||
dashboard.enterDetails(); | ||
dashboard.saveOrder(); | ||
}); | ||
|
||
it("Validate the Status of Order", () => { | ||
cy.fixture("DashBoard").then((order) => { | ||
dashboard.validateOrderStatus(order.labNo, 4); | ||
}); | ||
}); | ||
}); | ||
|
||
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); | ||
|
||
// }); | ||
}); | ||
|
||
it("User adds a new ImmunioChemistry order", function () { | ||
homePage.goToOrderPage(); | ||
dashboard.addOrder("Immunohistochemistry"); | ||
}); | ||
|
||
it("Check For Order", () => { | ||
homePage.goToImmunoChemistryDashboard(); | ||
|
||
dashboard.checkForHeader("Immunohistochemistry"); | ||
|
||
cy.fixture("DashBoard").then((order) => { | ||
dashboard.validatePreStatus(order.labNo); | ||
}); | ||
}); | ||
|
||
it("Change The Status of Order and save it", () => { | ||
dashboard.changeStatus("Completed"); | ||
dashboard.selectPathologist("ELIS,Open"); | ||
dashboard.saveOrder(); | ||
}); | ||
|
||
it("Validate the Status of Order", () => { | ||
cy.fixture("DashBoard").then((order) => { | ||
dashboard.validateOrderStatus(order.labNo, 3); | ||
}); | ||
}); | ||
}); |
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,82 @@ | ||
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); | ||
|
||
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"); | ||
} | ||
}); | ||
|
||
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(); | ||
}); | ||
} | ||
|
||
checkForHeader(title) { | ||
cy.get("section > h3").should("have.text", title); | ||
} | ||
|
||
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"); | ||
} | ||
|
||
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"); | ||
} | ||
|
||
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(); | ||
} | ||
|
||
saveOrder() { | ||
cy.get("#pathology_save2").click(); | ||
} | ||
|
||
changeStatus(status) { | ||
cy.get("#status").select(status); | ||
} | ||
|
||
selectPathologist(pathologist) { | ||
cy.get("#assignedPathologist").select(pathologist); | ||
} | ||
} | ||
|
||
export default DashBoardPage; |
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,85 @@ | ||
// Define a cache name for versioning your cache | ||
const CACHE_NAME = "my-cache-v1"; | ||
|
||
// Cache assets during the install phase | ||
self.addEventListener("install", (event) => { | ||
console.log("[Service Worker] Install"); | ||
event.waitUntil( | ||
caches | ||
.open(CACHE_NAME) | ||
.then((cache) => { | ||
return cache.addAll(["/", "/index.html", "/styles.css"]); | ||
}) | ||
.then(() => self.skipWaiting()), // Skip waiting to activate new service worker immediately | ||
); | ||
}); | ||
|
||
// Clean up old caches during the activate phase | ||
self.addEventListener("activate", (event) => { | ||
console.log("[Service Worker] Activate"); | ||
event.waitUntil( | ||
caches | ||
.keys() | ||
.then((cacheNames) => { | ||
return Promise.all( | ||
cacheNames.map((cacheName) => { | ||
if (cacheName !== CACHE_NAME) { | ||
console.log("[Service Worker] Deleting old cache:", cacheName); | ||
return caches.delete(cacheName); | ||
} | ||
}), | ||
); | ||
}) | ||
.then(() => self.clients.claim()), // Take control of all clients as soon as active | ||
); | ||
}); | ||
|
||
// Listen for push events and display notifications | ||
self.addEventListener("push", (event) => { | ||
console.log("[Service Worker] Push Received", event); | ||
if (event.data) { | ||
const data = event.data.json(); | ||
const notificationOptions = { | ||
body: data.body || "Message Received from OpenELIS", | ||
tag: data.external_id || "default-tag", | ||
icon: "images/openelis_logo.png", | ||
}; | ||
|
||
event.waitUntil( | ||
self.registration.showNotification( | ||
"OpenELIS Message Received", | ||
notificationOptions, | ||
), | ||
); | ||
} | ||
}); | ||
|
||
// Notification click event listener | ||
// self.addEventListener("notificationclick", (event) => { | ||
// console.log('Notification clicked'); | ||
// event.notification.close(); // Close the notification popout | ||
|
||
// event.waitUntil( | ||
// clients.matchAll({ type: 'window', includeUncontrolled: true }).then((clientList) => { | ||
// // Check if any client (tab or window) is already open | ||
// for (let i = 0; i < clientList.length; i++) { | ||
// const client = clientList[i]; | ||
// if (client.url === 'https://www.youtube.com/' && 'focus' in client) { | ||
// return client.focus(); | ||
// } | ||
// } | ||
|
||
// // If no client is open, open a new window | ||
// if (clients.openWindow) { | ||
// return clients.openWindow('https://www.youtube.com/'); | ||
// } | ||
// }) | ||
// ); | ||
// }); | ||
|
||
// Handle messages from clients | ||
self.addEventListener("message", (event) => { | ||
if (event.data && event.data.type === "SKIP_WAITING") { | ||
self.skipWaiting(); | ||
} | ||
}); |
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
Oops, something went wrong.