Skip to content
10 changes: 6 additions & 4 deletions src/org/labkey/test/components/ui/grids/QueryGrid.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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()
Expand All @@ -343,6 +343,8 @@ public QueryGrid clearAllSelections()
}
}

Assert.assertFalse("Did not successfully clear all the selected items in the grid.", hasItemsSelected());

return this;
}

Expand Down Expand Up @@ -764,8 +766,8 @@ protected class ElementCache extends ResponsiveGrid<QueryGrid>.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);

Expand Down
2 changes: 1 addition & 1 deletion src/org/labkey/test/util/TestDataGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
19 changes: 18 additions & 1 deletion src/org/labkey/test/util/exp/SampleTypeAPIHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -133,10 +135,25 @@ public static Map<Integer, String> getSortedRowIdToSamplesMap(String containerPa
public static Map<String, Integer> getRowIdsForSamples(String containerPath, String sampleTypeName, List<String> 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<String> 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);

Expand Down