From ab8e7093deb9e710394ee82704a7bdf246771a44 Mon Sep 17 00:00:00 2001 From: Adam Rauch Date: Mon, 3 Aug 2026 15:58:41 -0700 Subject: [PATCH 1/3] Fix intermittent SAML re-auth test failure (#3140) ## Rationale `SAMLReauthTest.testReauthWithBadPassword()` was failing intermittently --- src/org/labkey/test/pages/test/TestReauthPage.java | 12 +++++++++++- src/org/labkey/test/tests/AbstractReauthTest.java | 8 +++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/org/labkey/test/pages/test/TestReauthPage.java b/src/org/labkey/test/pages/test/TestReauthPage.java index f32afc79a8..3a2564a50b 100644 --- a/src/org/labkey/test/pages/test/TestReauthPage.java +++ b/src/org/labkey/test/pages/test/TestReauthPage.java @@ -23,6 +23,7 @@ import org.labkey.test.pages.LabKeyPage; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.ui.ExpectedConditions; import java.util.Map; import java.util.Optional; @@ -56,7 +57,16 @@ public String getDescription() public void clickReauth() { - clickAndWait(elementCache().reauthLink); + WebElement link = elementCache().reauthLink; + + shortWait().until( + ExpectedConditions.attributeContains( + link, + "href", + "returnUrl" + ) + ); + clickAndWait(link); clearCache(); } diff --git a/src/org/labkey/test/tests/AbstractReauthTest.java b/src/org/labkey/test/tests/AbstractReauthTest.java index 6fd6883d55..777f50a159 100644 --- a/src/org/labkey/test/tests/AbstractReauthTest.java +++ b/src/org/labkey/test/tests/AbstractReauthTest.java @@ -20,6 +20,7 @@ import org.junit.Test; import org.labkey.test.BaseWebDriverTest; import org.labkey.test.Locator; +import org.labkey.test.WebTestHelper; import org.labkey.test.pages.test.TestReauthPage; import java.util.Arrays; @@ -122,12 +123,17 @@ private void signInAs(User user) signOut(); clickSignIn(); authenticate(user.email, user.password); + // An IdP's SAML POST-binding page auto-submits to LabKey, so the browser can still be on the IdP + // origin here. getCurrentUser() copies only the cookies visible to the current URL, which excludes + // LabKey's session cookie, so wait for the browser to land back on LabKey before checking the user. + waitFor(() -> getDriver().getCurrentUrl().startsWith(WebTestHelper.getBaseURL()), + "Browser didn't return to LabKey after authenticating", WAIT_FOR_PAGE); assertSignedInAs(user); } private void assertSignedInAs(User user) { - if (!waitFor(() -> getCurrentUser().equals(user.email), 1_000)) + if (!waitFor(() -> getCurrentUser().equals(user.email), WAIT_FOR_PAGE)) assertEquals("Signed in as", user.email, getCurrentUser()); } From 46f196e50eaa499cd163ddb8485a452df1fe44d5 Mon Sep 17 00:00:00 2001 From: Cory Nathe Date: Tue, 4 Aug 2026 07:36:29 -0500 Subject: [PATCH 2/3] GitHub Issue #159: AssayExportImportTest fix to use assay designer UI to add transform script (#3139) ## Rationale The changes for this issue https://github.com/LabKey/internal-issues/issues/159 require that assay transform scripts live in the LabKey container's `@scripts` directory. This PR fixes the AssayExportImportTest to upload the script to the expected location using the assay designer UI. ## Related Pull Requests - https://github.com/LabKey/platform/pull/7895 ## Changes - AssayExportImportTest to upload transform script to @script dir using assay designer UI --- .../labkey/test/tests/AssayExportImportTest.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/org/labkey/test/tests/AssayExportImportTest.java b/src/org/labkey/test/tests/AssayExportImportTest.java index eddb39b2a1..05bf4b5416 100644 --- a/src/org/labkey/test/tests/AssayExportImportTest.java +++ b/src/org/labkey/test/tests/AssayExportImportTest.java @@ -166,7 +166,6 @@ private Integer createSimpleProjectAndAssay(String projectName, String assayName Connection cn = createDefaultConnection(); Protocol protocol = new GetProtocolCommand("General").execute(cn, projectName).getProtocol(); protocol.setName(assayName); - protocol.setProtocolTransformScripts(List.of(new File(SAMPLE_DATA_LOCATION, PERL_SCRIPT).getAbsolutePath())); protocol.setSaveScriptFiles(true); protocol.setEditableResults(true); protocol.setEditableRuns(true); @@ -199,7 +198,17 @@ private Integer createSimpleProjectAndAssay(String projectName, String assayName resultsFields.add(new FieldDefinition("resultFileField", ColumnType.File)); domains.get("Data Fields").setFields(resultsFields); - return new SaveProtocolCommand(protocol).execute(cn, projectName).getProtocol().getProtocolId(); + Integer protocolId = new SaveProtocolCommand(protocol).execute(cn, projectName).getProtocol().getProtocolId(); + + // GitHub Issue #159: The transform script must live in the assay's "@scripts" directory, so add it through the + // designer's file upload rather than setting an absolute path on the protocol via the API. + log("Add the transform script '" + PERL_SCRIPT + "' to the assay design using the designer's file upload."); + goToProjectHome(projectName); + ReactAssayDesignerPage assayDesignerPage = ReactAssayDesignerPage.beginAt(this, projectName, protocolId, "General", getURL().toString()); + assayDesignerPage.addTransformScript(new File(SAMPLE_DATA_LOCATION, PERL_SCRIPT)); + assayDesignerPage.clickFinish(); + + return protocolId; } public void addNewField(String projectName, String assayName, FieldDefinition newField) From 1d09fb3801a8c6077be9916919ee8b1b81b2711a Mon Sep 17 00:00:00 2001 From: Trey Chadick Date: Tue, 4 Aug 2026 12:46:53 -0700 Subject: [PATCH 3/3] Enable CSP enforcement between tests (#3137) --- src/org/labkey/test/TestScrubber.java | 10 ++++++++++ src/org/labkey/test/tests/CrawlerTest.java | 1 + 2 files changed, 11 insertions(+) diff --git a/src/org/labkey/test/TestScrubber.java b/src/org/labkey/test/TestScrubber.java index b7abbfcb88..e3efd60a97 100644 --- a/src/org/labkey/test/TestScrubber.java +++ b/src/org/labkey/test/TestScrubber.java @@ -28,6 +28,7 @@ import org.labkey.test.util.LogMethod; import org.labkey.test.util.PipelineToolsHelper; import org.labkey.test.util.TestLogger; +import org.labkey.test.util.core.admin.CspConfigHelper; import org.labkey.test.util.core.login.DbLoginUtils; import org.labkey.test.util.login.AuthenticationAPIUtils; import org.openqa.selenium.WebDriverException; @@ -171,6 +172,15 @@ public void cleanSiteSettings() TestLogger.error("Failed to disable pipeline triggers after test", e); } + try + { + new CspConfigHelper(this::createDefaultConnection).setEnforceCsp(true); + } + catch (NullPointerException e) + { + TestLogger.error("Failed to enable CSP enforcement after test", e); + } + } @LogMethod(quiet = true) diff --git a/src/org/labkey/test/tests/CrawlerTest.java b/src/org/labkey/test/tests/CrawlerTest.java index 3ee8d37ec9..e45f32752b 100644 --- a/src/org/labkey/test/tests/CrawlerTest.java +++ b/src/org/labkey/test/tests/CrawlerTest.java @@ -59,6 +59,7 @@ protected void doCleanup(boolean afterTest) { super.doCleanup(afterTest); _userHelper.deleteUsers(afterTest, USER); + _cspConfigHelper.setEnforceCsp(true); } @BeforeClass