From 5858ce445a7f9ee1e1a9175cee575b1b9643eb6c Mon Sep 17 00:00:00 2001 From: labkey-jeckels Date: Thu, 29 May 2025 16:19:04 -0700 Subject: [PATCH 1/3] Test coverage for Server JavaScript Console --- src/org/labkey/test/tests/TriggerScriptTest.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/org/labkey/test/tests/TriggerScriptTest.java b/src/org/labkey/test/tests/TriggerScriptTest.java index 0c726ef5f6..76734089e0 100644 --- a/src/org/labkey/test/tests/TriggerScriptTest.java +++ b/src/org/labkey/test/tests/TriggerScriptTest.java @@ -448,7 +448,21 @@ public void testDataClassIndividualTriggers() throws Exception GoToDataUI goToDataClass = () -> goTo("Data Classes", DATA_CLASSES_NAME); setupDataClass(); + + // Check to see that the logging shows up in the Server JavaScript Console + // It's normally accessed via the developer menu, but we can hit the URL directly to avoid dealing with the + // popup window in the test + + // Go to the log view to start capturing messages + beginAt("/admin-sessionLogging.view"); + goBack(); + doIndividualTriggerTest("query", goToDataClass, "Name", false, "Yes, Delete", false); + + beginAt("/admin-sessionLogging.view"); + waitForText("init got triggered with event: delete", + "exp.data: this is from the shared function", + "complete got triggered with event: delete"); } From ad4ba18195114f156e62331ebbb5756f90befa4d Mon Sep 17 00:00:00 2001 From: labkey-jeckels Date: Wed, 4 Jun 2025 16:50:44 -0700 Subject: [PATCH 2/3] Ensure we capture startup logging --- .../test/pages/core/admin/ShowAdminPage.java | 7 +++++++ src/org/labkey/test/tests/BasicTest.java | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/org/labkey/test/pages/core/admin/ShowAdminPage.java b/src/org/labkey/test/pages/core/admin/ShowAdminPage.java index a23ee09e45..9ba38a6290 100644 --- a/src/org/labkey/test/pages/core/admin/ShowAdminPage.java +++ b/src/org/labkey/test/pages/core/admin/ShowAdminPage.java @@ -240,6 +240,12 @@ public void clickCredits() clickAndWait(elementCache().creditsLink); } + public void clickViewPrimarySiteLogFile() + { + goToSettingsSection(); + clickAndWait(elementCache().viewPrimarySiteLogFileLink); + } + public void clickPostgresActivity() { goToSettingsSection(); @@ -296,6 +302,7 @@ protected class ElementCache extends LabKeyPage.ElementCache protected WebElement systemPropertiesLink = Locator.linkContainingText("system properties").findWhenNeeded(this); protected WebElement viewsAndScriptingLink = Locator.linkWithText("views and scripting").findWhenNeeded(this); protected WebElement creditsLink = Locator.linkWithText("credits").findWhenNeeded(this); + protected WebElement viewPrimarySiteLogFileLink = Locator.linkWithText("view primary site log file").findWhenNeeded(this); protected WebElement postgresActivityLink = Locator.linkWithText("postgres activity").findWhenNeeded(this); protected WebElement postgresLocksLink = Locator.linkWithText("postgres locks").findWhenNeeded(this); diff --git a/src/org/labkey/test/tests/BasicTest.java b/src/org/labkey/test/tests/BasicTest.java index 4773490d7d..e90f67adee 100644 --- a/src/org/labkey/test/tests/BasicTest.java +++ b/src/org/labkey/test/tests/BasicTest.java @@ -28,6 +28,7 @@ import org.labkey.test.categories.Git; import org.labkey.test.categories.Hosting; import org.labkey.test.categories.Smoke; +import org.labkey.test.pages.core.admin.ShowAdminPage; import org.labkey.test.util.Order; import java.util.List; @@ -61,6 +62,21 @@ public void testScripts() assertTextNotPresent("WARNING:"); } + @Test + public void testStartupLogging() + { + ShowAdminPage adminPage = goToAdminConsole(); + adminPage.clickViewPrimarySiteLogFile(); + + // Issue 52684: Ensure Log4J is capturing startup logging from: + assertTextPresent( + "Starting LabKeyServer using", // Our "embedded" code (the primary entry point) + "Starting Servlet engine", // Spring Boot and Tomcat + "Exploding module archives", // Our "bootstrap" code (extracts modules and sets up webapp classloading) + "LabKey-managed modules to ensure they're recent enough to upgrade" // Our code inside the webapp + ); + } + @Override public List getAssociatedModules() { From 32a095efc80d60375ee6381048f9649bec2337f0 Mon Sep 17 00:00:00 2001 From: labkey-jeckels Date: Fri, 6 Jun 2025 15:20:04 -0700 Subject: [PATCH 3/3] Switch to managing console window --- src/org/labkey/test/tests/TriggerScriptTest.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/org/labkey/test/tests/TriggerScriptTest.java b/src/org/labkey/test/tests/TriggerScriptTest.java index 76734089e0..5aa8e7b6e7 100644 --- a/src/org/labkey/test/tests/TriggerScriptTest.java +++ b/src/org/labkey/test/tests/TriggerScriptTest.java @@ -34,6 +34,7 @@ import org.labkey.test.WebTestHelper; import org.labkey.test.categories.Daily; import org.labkey.test.categories.Data; +import org.labkey.test.components.html.SiteNavBar; import org.labkey.test.pages.ImportDataPage; import org.labkey.test.params.FieldDefinition; import org.labkey.test.params.FieldDefinition.ColumnType; @@ -449,20 +450,21 @@ public void testDataClassIndividualTriggers() throws Exception setupDataClass(); - // Check to see that the logging shows up in the Server JavaScript Console - // It's normally accessed via the developer menu, but we can hit the URL directly to avoid dealing with the - // popup window in the test - // Go to the log view to start capturing messages - beginAt("/admin-sessionLogging.view"); - goBack(); + new SiteNavBar(getDriver()).clickAdminMenuItem(false, "Developer Links", "Server JavaScript Console"); + switchToWindow(1); + waitForText("Message"); + switchToMainWindow(); doIndividualTriggerTest("query", goToDataClass, "Name", false, "Yes, Delete", false); - beginAt("/admin-sessionLogging.view"); + // Go back to the console window + switchToWindow(1); waitForText("init got triggered with event: delete", "exp.data: this is from the shared function", "complete got triggered with event: delete"); + getDriver().close(); + switchToMainWindow(); }