diff --git a/src/org/labkey/test/components/ui/grids/QueryGrid.java b/src/org/labkey/test/components/ui/grids/QueryGrid.java index 9775a4666d..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; } @@ -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() @@ -343,6 +343,8 @@ public QueryGrid clearAllSelections() } } + Assert.assertFalse("Did not successfully clear all the selected items in the grid.", hasItemsSelected()); + return this; } @@ -764,8 +766,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); 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) diff --git a/src/org/labkey/test/util/exp/SampleTypeAPIHelper.java b/src/org/labkey/test/util/exp/SampleTypeAPIHelper.java index 8c6eaf7784..93629ccd0c 100644 --- a/src/org/labkey/test/util/exp/SampleTypeAPIHelper.java +++ b/src/org/labkey/test/util/exp/SampleTypeAPIHelper.java @@ -13,12 +13,14 @@ 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; 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 +135,25 @@ 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(EscapeUtil.toJSONStr(sampleName)); + 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);