Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/org/labkey/test/components/ChartTypeDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,15 @@ public ChartTypeDialog setYAxis(String columnName, boolean hasExistingSelection)

public ChartTypeDialog setYAxisSide(int measureIndex, YAxisSide side)
{
WebElement measureEl = elementCache().Y_FIELD_DISPLAY.index(measureIndex).findElement(this);
if (!measureEl.getAttribute("class").contains("selected"))
{
Locator.byClass("field-selection-text").findElement(measureEl).click();
}
Locator measureLoc = elementCache().Y_FIELD_DISPLAY.index(measureIndex);
// A click that lands while the dialog is still rendering doesn't select the measure, so retry it
WebDriverWrapper.waitFor(() -> {
WebElement el = measureLoc.findElement(this);
if (!el.getAttribute("class").contains("x4-item-selected"))
Locator.byClass("field-selection-text").findElement(el).click();
return WebDriverWrapper.waitFor(() -> measureLoc.findElement(this).getAttribute("class").contains("x4-item-selected"), 1_000);
}, "Y axis measure " + measureIndex + " was not selected", 5_000);
WebElement measureEl = measureLoc.findElement(this);
WebElement arrow = Locator.tagWithClass("i", "fa-arrow-circle-" + side.name().toLowerCase()).waitForElement(measureEl, 5_000);
WebDriverWait quickWait = new WebDriverWait(getWrapper().getDriver(), Duration.ofSeconds(4));
quickWait.until(ExpectedConditions.visibilityOf(arrow));
Expand Down
16 changes: 16 additions & 0 deletions src/org/labkey/test/util/exp/SampleTypeAPIHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.junit.Assert;
import org.labkey.remoteapi.CommandException;
import org.labkey.remoteapi.Connection;
import org.labkey.remoteapi.query.ContainerFilter;
import org.labkey.remoteapi.query.Filter;
import org.labkey.remoteapi.query.SelectRowsCommand;
import org.labkey.remoteapi.query.SelectRowsResponse;
Expand Down Expand Up @@ -201,6 +202,21 @@ public static Map<String, Integer> getRowIdsForSamples(String containerPath, Str
return rowIds;
}

/**
* Row ids of sample types named {@code sampleTypeName} visible from {@code containerPath} under CurrentPlusProjectAndShared.
*/
public static List<Integer> getSampleTypeRowIds(String containerPath, String sampleTypeName) throws IOException, CommandException
{
SelectRowsCommand cmd = new SelectRowsCommand("exp", "SampleSets");
cmd.setColumns(List.of("RowId"));
cmd.addFilter("Name", sampleTypeName, Filter.Operator.EQUAL);
cmd.setContainerFilter(ContainerFilter.CurrentPlusProjectAndShared);

return cmd.execute(WebTestHelper.getRemoteApiConnection(), containerPath).getRows().stream()
.map(row -> Integer.parseInt(row.get("RowId").toString()))
.toList();
}

/**
* Get sample state IDs defined in the specified project/folder. Useful for updating sample status via API
* @param containerPath Path to the project/folder where the sample statuses are defined (typically project)
Expand Down
Loading