From fd595b562d6125e4c8e1ac378acde42231f785d9 Mon Sep 17 00:00:00 2001 From: Binal Patel Date: Wed, 10 Jan 2024 13:26:49 -0800 Subject: [PATCH 1/3] Test updates related to Death notification --- .../test/tests/wnprc_ehr/WNPRC_EHRTest.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/WNPRC_EHR/test/src/org/labkey/test/tests/wnprc_ehr/WNPRC_EHRTest.java b/WNPRC_EHR/test/src/org/labkey/test/tests/wnprc_ehr/WNPRC_EHRTest.java index ddef7c9ea..7eab8c325 100644 --- a/WNPRC_EHR/test/src/org/labkey/test/tests/wnprc_ehr/WNPRC_EHRTest.java +++ b/WNPRC_EHR/test/src/org/labkey/test/tests/wnprc_ehr/WNPRC_EHRTest.java @@ -244,7 +244,7 @@ public static void doSetup() throws Exception initTest.checkUpdateProgramIncomeAccount(); - initTest.checkJavaNotificationsFunctionality(); + initTest.enableDeathNotification(); } private void uploadBillingDataAndVerify() throws Exception @@ -3002,6 +3002,9 @@ private void checkUpdateProgramIncomeAccount() throws UnhandledAlertException @Test public void testJavaDeathNotification() throws UnhandledAlertException { + + log("Started testJavaDeathNotification."); + //Navigates to the Necropsies table. beginAt(buildURL("project", getContainerPath(), "begin")); beginAt("/ehr/" + getContainerPath() + "/datasets.view"); @@ -3031,10 +3034,15 @@ public void testJavaDeathNotification() throws UnhandledAlertException { assertTextPresent("Necropsy Case Number:", necropsyCaseNumber); assertTextPresent("Date of Necropsy:", necropsyDate); assertTextPresent("Grant #:", necropsyAccount); + + log("Completed testJavaDeathNotification."); } @Test public void testJavaPrenatalDeathNotification() throws UnhandledAlertException { + + log("Started testJavaPrenatalDeathNotification."); + //Navigates to the "Enter Prenatal Death" page. beginAt(buildURL("project", getContainerPath(), "begin")); waitAndClickAndWait(Locator.tagContainingText("a", "Enter Data")); @@ -3051,9 +3059,11 @@ public void testJavaPrenatalDeathNotification() throws UnhandledAlertException { //Navigates to dumbster. goToModule("Dumbster"); assertTextPresent("Prenatal Death Notification: pd9876"); + + log("Completed testJavaPrenatalDeathNotification."); } - private void checkJavaNotificationsFunctionality() throws UnhandledAlertException { + private void enableDeathNotification() throws UnhandledAlertException { log("Starting checkJavaNotificationsFunctionality."); //Navigates to home to get a fresh start. beginAt(buildURL("project", getContainerPath(), "begin")); @@ -3079,14 +3089,6 @@ private void checkJavaNotificationsFunctionality() throws UnhandledAlertExceptio //Enables dumbster. _containerHelper.enableModules(Arrays.asList("Dumbster")); - - log("Started testJavaDeathNotification."); - testJavaDeathNotification(); - log("Completed testJavaDeathNotification."); - - log("Started testJavaPrenatalDeathNotification."); - testJavaPrenatalDeathNotification(); - log("Completed testJavaPrenatalDeathNotification."); } @Test From b8268bd54345b1297d62d8d01c1d83725aa4a851 Mon Sep 17 00:00:00 2001 From: Binal Patel Date: Wed, 10 Jan 2024 13:36:27 -0800 Subject: [PATCH 2/3] NotificationService.get().isServiceEnabled() check is not needed, it won't be enabled in this case - see LDKController.SetNotificationSettingsAction, starting line 519 (container 'EHR' is not the root so setServiceEnabled() won't be reached, hence, NotificationService.get().isServiceEnabled() will always return false). NotificationService.get().isActive() is a sufficient check. --- .../src/org/labkey/wnprc_ehr/TriggerScriptHelper.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/WNPRC_EHR/src/org/labkey/wnprc_ehr/TriggerScriptHelper.java b/WNPRC_EHR/src/org/labkey/wnprc_ehr/TriggerScriptHelper.java index aa77a0978..31bb84853 100644 --- a/WNPRC_EHR/src/org/labkey/wnprc_ehr/TriggerScriptHelper.java +++ b/WNPRC_EHR/src/org/labkey/wnprc_ehr/TriggerScriptHelper.java @@ -185,8 +185,7 @@ public Map getExtraContext() public void sendDeathNotification(final List ids, String hostName) { Module ehr = ModuleLoader.getInstance().getModule("EHR"); - //Verifies 'Notification Service' is enabled before sending notification. - if (NotificationService.get().isServiceEnabled()){ + //Sends original Death Notification. //Remove this if-else when new notification is approved. if (NotificationService.get().isActive(new DeathNotification(), container)) { @@ -211,10 +210,6 @@ public void sendDeathNotification(final List ids, String hostName) { else { _log.info("Death Notification Revamp is not enabled, will not send death notification"); } - } - else if (!NotificationService.get().isServiceEnabled()) { - _log.info("Notification service is not enabled, will not send death notification"); - } } public void sendPregnancyNotification(final List ids, final List objectids) { From a59b4b82d7f1cbd6fbcd7117166f4699e6b41c65 Mon Sep 17 00:00:00 2001 From: Binal Patel Date: Wed, 10 Jan 2024 13:48:49 -0800 Subject: [PATCH 3/3] Test updates --- .../src/org/labkey/test/tests/wnprc_ehr/WNPRC_EHRTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/WNPRC_EHR/test/src/org/labkey/test/tests/wnprc_ehr/WNPRC_EHRTest.java b/WNPRC_EHR/test/src/org/labkey/test/tests/wnprc_ehr/WNPRC_EHRTest.java index 7eab8c325..4d5edec84 100644 --- a/WNPRC_EHR/test/src/org/labkey/test/tests/wnprc_ehr/WNPRC_EHRTest.java +++ b/WNPRC_EHR/test/src/org/labkey/test/tests/wnprc_ehr/WNPRC_EHRTest.java @@ -244,7 +244,7 @@ public static void doSetup() throws Exception initTest.checkUpdateProgramIncomeAccount(); - initTest.enableDeathNotification(); + initTest.deathNotificationSetup(); } private void uploadBillingDataAndVerify() throws Exception @@ -3063,7 +3063,7 @@ public void testJavaPrenatalDeathNotification() throws UnhandledAlertException { log("Completed testJavaPrenatalDeathNotification."); } - private void enableDeathNotification() throws UnhandledAlertException { + private void deathNotificationSetup() throws UnhandledAlertException { log("Starting checkJavaNotificationsFunctionality."); //Navigates to home to get a fresh start. beginAt(buildURL("project", getContainerPath(), "begin")); @@ -3076,7 +3076,7 @@ private void enableDeathNotification() throws UnhandledAlertException { notificationAdminPage.setNotificationUserAndReplyEmail(DATA_ADMIN_USER); //Enables all notification that we will be testing. - notificationAdminPage.enableBillingNotification("status_org.labkey.wnprc_ehr.notification.DeathNotificationRevamp"); + notificationAdminPage.enableDeathNotification("status_org.labkey.wnprc_ehr.notification.DeathNotificationRevamp"); //Adds notification recipients. // notificationAdminPage.addManageUsers("org.labkey.wnprc_ehr.notification.DeathNotification", "EHR Administrators");