From c162eca3c1418e852f28769e041ebffb7e4bd619 Mon Sep 17 00:00:00 2001 From: labkey-danield Date: Tue, 30 Sep 2025 10:13:19 -0700 Subject: [PATCH 1/5] Use json when calling the API. --- .../test/util/exp/SampleTypeAPIHelper.java | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/org/labkey/test/util/exp/SampleTypeAPIHelper.java b/src/org/labkey/test/util/exp/SampleTypeAPIHelper.java index 8c6eaf7784..e0e687eb7e 100644 --- a/src/org/labkey/test/util/exp/SampleTypeAPIHelper.java +++ b/src/org/labkey/test/util/exp/SampleTypeAPIHelper.java @@ -19,6 +19,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.NoSuchElementException; @@ -133,10 +134,29 @@ public static Map getSortedRowIdToSamplesMap(String containerPa public static Map getRowIdsForSamples(String containerPath, String sampleTypeName, List sampleNames) throws IOException, CommandException { + // Use json for the value parameter of the filter. This allows for tricky characters like ";" to be passed to the API. + StringBuilder json = new StringBuilder("{json:["); + + Iterator iterator = sampleNames.iterator(); + + while (iterator.hasNext()) { + String sampleName = iterator.next(); + + json.append("\""); + json.append(sampleName.replace("\"", "\\\"")); + json.append("\""); + + if (iterator.hasNext()) { + json.append(", "); + } else { + json.append("]}"); + } + } + Connection connection = WebTestHelper.getRemoteApiConnection(); SelectRowsCommand cmd = new SelectRowsCommand("samples", sampleTypeName); cmd.setColumns(Arrays.asList("RowId", "Name")); - cmd.addFilter("Name", String.join(";", sampleNames), Filter.Operator.IN); + cmd.addFilter("Name", json, Filter.Operator.IN); SelectRowsResponse response = cmd.execute(connection, containerPath); From 9a19f30ff1d5015850d98732d35171f08e34c985 Mon Sep 17 00:00:00 2001 From: labkey-danield Date: Tue, 30 Sep 2025 12:01:30 -0700 Subject: [PATCH 2/5] Catch ' -' at the end of the domain name as an invalid name. --- src/org/labkey/test/util/TestDataGenerator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/org/labkey/test/util/TestDataGenerator.java b/src/org/labkey/test/util/TestDataGenerator.java index f6ea32b532..3333634e5e 100644 --- a/src/org/labkey/test/util/TestDataGenerator.java +++ b/src/org/labkey/test/util/TestDataGenerator.java @@ -703,7 +703,7 @@ private static boolean isNameInvalidLocal(DomainKind domainKind, @Nullable Rando return true; if (!Character.isLetterOrDigit(domainName.name().charAt(0))) return true; // domain needs to start with alphanumeric char - if (Pattern.matches("(.*\\s--[^ ].*)|(.*\\s-[^- ].*)", domainName.name())) + if (Pattern.matches("(.*\\s--[^ ].*)|(.*\\s-.*)", domainName.name())) return true; // domain name must not contain space followed by dash. (command like: Issue 49161) int maxLength = switch (domainKind) From bbb792e2c54e3bf5ec7bfc6e6ccae74bb90a3fc0 Mon Sep 17 00:00:00 2001 From: labkey-danield Date: Tue, 30 Sep 2025 18:47:48 -0700 Subject: [PATCH 3/5] More logging. Simpler selectors. --- src/org/labkey/test/components/ui/grids/QueryGrid.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/org/labkey/test/components/ui/grids/QueryGrid.java b/src/org/labkey/test/components/ui/grids/QueryGrid.java index 9775a4666d..e8c3f04b41 100644 --- a/src/org/labkey/test/components/ui/grids/QueryGrid.java +++ b/src/org/labkey/test/components/ui/grids/QueryGrid.java @@ -317,7 +317,7 @@ public QueryGrid selectAllRows() public boolean hasItemsSelected() { - return Locator.tagWithClass("span", "selection-status__count").existsIn(elementCache()); + return Locator.byClass("selection-status__count").existsIn(elementCache()); } public String getSelectionStatusCount() @@ -764,8 +764,8 @@ protected class ElementCache extends ResponsiveGrid.ElementCache final Locator.XPathLocator selectionStatusContainerLoc = Locator.tagWithClass("div", "selection-status"); final Locator selectAllBtnLoc = selectionStatusContainerLoc.append(Locator.tagWithClass("span", "selection-status__select-all") .child(Locator.buttonContainingText("Select all"))); - final Locator clearBtnLoc = selectionStatusContainerLoc.append(Locator.tagWithClass("span", "selection-status__clear-all") - .child(Locator.tagContainingText("button", "Clear"))); + final Locator clearBtnLoc = selectionStatusContainerLoc.append(Locator.byClass("selection-status__clear-all") + .child(Locator.tag("button"))); final WebElement filterStatusPanel = Locator.css("div.grid-panel__filter-status").findWhenNeeded(this); From 3813599b3d9c69783396725bd84ce1a5a86a0c6b Mon Sep 17 00:00:00 2001 From: labkey-danield Date: Wed, 1 Oct 2025 12:13:20 -0700 Subject: [PATCH 4/5] Assert that QueryGrid.clearAllSelections works. Use a valid domain name in SMSampleTypeDesignerTest.testParentAndSourceAliasOptions Change the order of clearing the filters and selections in SMProMoveAssayRunsTest.configureGrid --- src/org/labkey/test/components/ui/grids/QueryGrid.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/org/labkey/test/components/ui/grids/QueryGrid.java b/src/org/labkey/test/components/ui/grids/QueryGrid.java index e8c3f04b41..f67124827f 100644 --- a/src/org/labkey/test/components/ui/grids/QueryGrid.java +++ b/src/org/labkey/test/components/ui/grids/QueryGrid.java @@ -273,7 +273,7 @@ public QueryGrid clearFilters() doAndWaitForUpdate(obValue::remove); } - Assert.assertEquals("not all of the filter values were cleared", 0, elementCache().getFilterStatusFilterValues().size()); + Assert.assertEquals("Not all of the filter values were cleared.", 0, elementCache().getFilterStatusFilterValues().size()); return this; } @@ -343,6 +343,8 @@ public QueryGrid clearAllSelections() } } + Assert.assertFalse("Did not successfully clear all the selected items in the grid.", hasItemsSelected()); + return this; } From 0527284ef9b68d4236634cddf6e6956da9061d42 Mon Sep 17 00:00:00 2001 From: labkey-danield Date: Wed, 1 Oct 2025 17:45:52 -0700 Subject: [PATCH 5/5] Implementing code review feedback. Dismissing banner messages after moving assay runs. Using EscapeUtil.toJSONStr to build json string. Added BannerHelper.dismissAllBannerMessages --- src/org/labkey/test/util/exp/SampleTypeAPIHelper.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/org/labkey/test/util/exp/SampleTypeAPIHelper.java b/src/org/labkey/test/util/exp/SampleTypeAPIHelper.java index e0e687eb7e..93629ccd0c 100644 --- a/src/org/labkey/test/util/exp/SampleTypeAPIHelper.java +++ b/src/org/labkey/test/util/exp/SampleTypeAPIHelper.java @@ -13,6 +13,7 @@ import org.labkey.test.params.experiment.SampleTypeDefinition; import org.labkey.test.util.DomainUtils; import org.labkey.test.util.DomainUtils.DomainKind; +import org.labkey.test.util.EscapeUtil; import org.labkey.test.util.TestDataGenerator; import java.io.IOException; @@ -141,11 +142,7 @@ public static Map getRowIdsForSamples(String containerPath, Str while (iterator.hasNext()) { String sampleName = iterator.next(); - - json.append("\""); - json.append(sampleName.replace("\"", "\\\"")); - json.append("\""); - + json.append(EscapeUtil.toJSONStr(sampleName)); if (iterator.hasNext()) { json.append(", "); } else {