Skip to content

Commit 126baf6

Browse files
Merge 26.7 to 26.10
2 parents d699ae2 + e82420f commit 126baf6

3 files changed

Lines changed: 108 additions & 7 deletions

File tree

‎src/org/labkey/test/components/pipeline/PipelineTriggerWizard.java‎

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,12 @@ public static PipelineTriggerWizard beginAt(WebDriverWrapper driver, String cont
6464

6565
public static PipelineTriggerWizard beginAt(WebDriverWrapper driver, String containerPath, String pipelineTask)
6666
{
67-
driver.beginAt(WebTestHelper.buildURL("pipeline", containerPath, "createPipelineTrigger", Map.of("pipelineTask", pipelineTask)));
67+
return beginAt(driver, containerPath, Map.of("pipelineTask", pipelineTask));
68+
}
69+
70+
public static PipelineTriggerWizard beginAt(WebDriverWrapper driver, String containerPath, Map<String, ?> params)
71+
{
72+
driver.beginAt(WebTestHelper.buildURL("pipeline", containerPath, "createPipelineTrigger", params));
6873
return new PipelineTriggerWizard(driver.getDriver());
6974
}
7075

@@ -156,6 +161,11 @@ public PipelineTriggerWizard goToConfiguration()
156161
return this;
157162
}
158163

164+
public String getLocation()
165+
{
166+
return elementCache().locationInput.get();
167+
}
168+
159169
public PipelineTriggerWizard setLocation(String value)
160170
{
161171
elementCache().locationInput.set(value);
@@ -223,6 +233,12 @@ public PipelineTriggerWizard setCopy(String value)
223233
return this;
224234
}
225235

236+
public String getParameterFunction()
237+
{
238+
showAdvanced();
239+
return elementCache().paramFunctionInput.get();
240+
}
241+
226242
public PipelineTriggerWizard setParameterFunction(String function)
227243
{
228244
showAdvanced();
@@ -231,6 +247,13 @@ public PipelineTriggerWizard setParameterFunction(String function)
231247
return this;
232248
}
233249

250+
public boolean isParameterFunctionPresent()
251+
{
252+
showAdvanced();
253+
getWrapper().shortWait().until(ExpectedConditions.visibilityOf(elementCache().addCustomParam));
254+
return elementCache().paramFunctionInput.getComponentElement().isDisplayed();
255+
}
256+
234257
private void showAdvanced()
235258
{
236259
if (!Locator.byClass("advanced-settings").findWhenNeeded(this).isDisplayed())
@@ -310,9 +333,9 @@ protected class ElementCache extends Component<?>.ElementCache
310333
//details page elements
311334
Input nameInput = new Input(Locator.tagWithName("input", "name").findWhenNeeded(this), getDriver());
312335
Input descriptionInput = new Input(Locator.tagWithName("textarea", "description").findWhenNeeded(this), getDriver());
313-
OptionSelect typeSelect = new OptionSelect(Locator.tagWithName("select", "type").findWhenNeeded(this));
314-
OptionSelect taskSelect = new OptionSelect(Locator.tagWithName("select", "pipelineId").findWhenNeeded(this));
315-
OptionSelect usernameInput = new OptionSelect(Locator.tagWithName("select", "username").findWhenNeeded(this));
336+
OptionSelect<OptionSelect.SelectOption> typeSelect = new OptionSelect<>(Locator.tagWithName("select", "type").findWhenNeeded(this));
337+
OptionSelect<OptionSelect.SelectOption> taskSelect = new OptionSelect<>(Locator.tagWithName("select", "pipelineId").findWhenNeeded(this));
338+
OptionSelect<OptionSelect.SelectOption> usernameInput = new OptionSelect<>(Locator.tagWithName("select", "username").findWhenNeeded(this));
316339
Input assayProviderInput = new Input(Locator.tagWithName("input", "assay provider").findWhenNeeded(this), getDriver());
317340
Checkbox enabledCheckbox = new Checkbox(Locator.tagWithName("input", "enabled").findWhenNeeded(this));
318341
//configuration page elements
@@ -323,12 +346,12 @@ protected class ElementCache extends Component<?>.ElementCache
323346
Input containerMoveInput = new Input(Locator.tagWithName("input", "moveContainer").findWhenNeeded(this), getDriver());
324347
Input subdirectoryMoveInput = new Input(Locator.tagWithName("input", "moveDirectory").findWhenNeeded(this), getDriver());
325348
Input copyInput = new Input(Locator.tagWithName("input", "copy").findWhenNeeded(this), getDriver());
326-
Input paramFunctionInput = new Input(Locator.tagWithName("textarea", "parameterFunction").findWhenNeeded(this), getDriver());
349+
Input paramFunctionInput = new Input(Locator.id("parameter-function").findWhenNeeded(this), getDriver());
327350
WebElement showAdvanced = Locator.byClass("custom-config__button").withText("Show Advanced Settings").findWhenNeeded(this);
328351
WebElement addCustomParam = Locator.byClass("custom-config__button").withText("Add Custom Parameter").findWhenNeeded(this);
329352
Input assayProtocolInput = new Input(Locator.tagWithName("input", "protocolName").findWhenNeeded(this), getDriver());
330353
Input configurationFileInput = new Input(Locator.name("configFileName").findWhenNeeded(this), getDriver());
331-
//navgiation elements
354+
//navigation elements
332355
WebElement detailsButton = Locator.linkContainingText("Details").findWhenNeeded(this);
333356
WebElement configurationButton = Locator.linkContainingText("Configuration").findWhenNeeded(this);
334357

‎src/org/labkey/test/tests/ClientAPITest.java‎

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.junit.Test;
2828
import org.junit.experimental.categories.Category;
2929
import org.labkey.remoteapi.CommandException;
30+
import org.labkey.remoteapi.CommandResponse;
3031
import org.labkey.remoteapi.Connection;
3132
import org.labkey.remoteapi.SimpleGetCommand;
3233
import org.labkey.remoteapi.SimplePostCommand;
@@ -83,6 +84,7 @@
8384
import static org.junit.Assert.assertEquals;
8485
import static org.junit.Assert.assertFalse;
8586
import static org.junit.Assert.assertNotNull;
87+
import static org.junit.Assert.assertNull;
8688
import static org.junit.Assert.assertThrows;
8789
import static org.junit.Assert.assertTrue;
8890
import static org.labkey.test.WebTestHelper.getHttpResponse;
@@ -1527,6 +1529,82 @@ protected HttpUriRequest getHttpRequest(Connection connection, String folderPath
15271529
}
15281530
}
15291531

1532+
private record CountCase(Map<String, Object> filters, int expectedCount) {}
1533+
1534+
private static final String MAX_ROWS_PARAM = "query.maxRows";
1535+
private static final String OFFSET_PARAM = "query.offset";
1536+
private static final String INCLUDE_TOTAL_COUNT_PARAM = "includeTotalCount";
1537+
private static final String INCLUDE_METADATA_PARAM = "includeMetadata";
1538+
1539+
// GH Issue 1607
1540+
@Test
1541+
public void testSelectRowsCountOnly() throws Exception
1542+
{
1543+
Connection cn = createDefaultConnection();
1544+
List<CountCase> countCases = List.of(
1545+
new CountCase(Map.of(), 7),
1546+
new CountCase(Map.of("query.Age~gt", 30), 5),
1547+
new CountCase(Map.of("query.FirstName~eq", "Nobody"), 0),
1548+
new CountCase(Map.of("query.Age~eq", "notANumber"), 0));
1549+
1550+
for (double apiVersion : List.of(8.3, 9.1, 17.1))
1551+
{
1552+
for (CountCase countCase : countCases)
1553+
{
1554+
String description = "apiVersion " + apiVersion + ", filters " + countCase.filters();
1555+
1556+
log("Verify count-only request: " + description);
1557+
CommandResponse countOnly = selectPeople(cn, apiVersion, countCase.filters(), Map.of(MAX_ROWS_PARAM, 0, INCLUDE_TOTAL_COUNT_PARAM, true));
1558+
assertEquals("Wrong count-only rowCount: " + description, countCase.expectedCount(), getRowCount(countOnly));
1559+
List<?> rows = countOnly.getProperty("rows");
1560+
assertTrue("Count-only request should return no rows: " + description, rows.isEmpty());
1561+
1562+
CommandResponse paged = selectPeople(cn, apiVersion, countCase.filters(), Map.of(MAX_ROWS_PARAM, 1));
1563+
assertEquals("Count-only rowCount should match paged rowCount: " + description, getRowCount(paged), getRowCount(countOnly));
1564+
1565+
log("Verify count-only request without metadata and with an offset: " + description);
1566+
CommandResponse noMetaData = selectPeople(cn, apiVersion, countCase.filters(), Map.of(MAX_ROWS_PARAM, 0, INCLUDE_TOTAL_COUNT_PARAM, true, INCLUDE_METADATA_PARAM, false, OFFSET_PARAM, 100));
1567+
assertEquals("Wrong count-only rowCount without metadata: " + description, countCase.expectedCount(), getRowCount(noMetaData));
1568+
assertNull("Count-only request with includeMetadata=false should not return metaData: " + description, noMetaData.getProperty("metaData"));
1569+
1570+
log("Verify maxRows=0 without an explicit includeTotalCount=true stays metadata only: " + description);
1571+
CommandResponse metaDataOnly = selectPeople(cn, apiVersion, countCase.filters(), Map.of(MAX_ROWS_PARAM, 0));
1572+
assertNull("Metadata-only request should not return rowCount: " + description, metaDataOnly.getProperty("rowCount"));
1573+
assertNotNull("Metadata-only request should return metaData: " + description, metaDataOnly.getProperty("metaData"));
1574+
metaDataOnly = selectPeople(cn, apiVersion, countCase.filters(), Map.of(MAX_ROWS_PARAM, 0, INCLUDE_TOTAL_COUNT_PARAM, false));
1575+
assertNull("includeTotalCount=false request should not return rowCount: " + description, metaDataOnly.getProperty("rowCount"));
1576+
}
1577+
}
1578+
1579+
log("Verify count-only request with a JSON body");
1580+
SimplePostCommand post = new SimplePostCommand("query", "selectRows.api");
1581+
post.setRequiredVersion(17.1);
1582+
post.setJsonObject(new JSONObject(Map.of("schemaName", "lists", "query.queryName", LIST_NAME,
1583+
"query.Age~gt", 30, MAX_ROWS_PARAM, 0, INCLUDE_TOTAL_COUNT_PARAM, true)));
1584+
CommandResponse postResponse = post.execute(cn, API_FOLDER_PATH);
1585+
assertEquals("Wrong count-only rowCount for JSON body", 5, getRowCount(postResponse));
1586+
List<?> postRows = postResponse.getProperty("rows");
1587+
assertTrue("Count-only JSON body request should return no rows", postRows.isEmpty());
1588+
}
1589+
1590+
private CommandResponse selectPeople(Connection cn, double apiVersion, Map<String, Object> filters, Map<String, Object> params) throws IOException, CommandException
1591+
{
1592+
Map<String, Object> allParams = new HashMap<>(filters);
1593+
allParams.putAll(params);
1594+
allParams.put("schemaName", "lists");
1595+
allParams.put("query.queryName", LIST_NAME);
1596+
1597+
SimpleGetCommand command = new SimpleGetCommand("query", "selectRows.api");
1598+
command.setRequiredVersion(apiVersion);
1599+
command.setParameters(allParams);
1600+
return command.execute(cn, API_FOLDER_PATH);
1601+
}
1602+
1603+
private int getRowCount(CommandResponse response)
1604+
{
1605+
return ((Number) response.getProperty("rowCount")).intValue();
1606+
}
1607+
15301608
@Test
15311609
public void suggestedColumnsInQueryDetailsTest() throws Exception
15321610
{

‎src/org/labkey/test/tests/assay/UploadLargeExcelAssayTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public void testUpload200kRows() throws Exception
141141
clickButton("Save and Finish");
142142

143143
var assayJobsPage2 = new AssayUploadJobsPage(getDriver());
144-
var pipelineDetailsPage2 = assayJobsPage2.clickJobStatus("200k take 2", 3 * getDefaultWaitForPage());
144+
var pipelineDetailsPage2 = assayJobsPage2.clickJobStatus("200k take 2", 7 * getDefaultWaitForPage());
145145
pipelineDetailsPage2.waitForComplete(12 * WebDriverWrapper.WAIT_FOR_PAGE);
146146

147147
var qPage = SourceQueryPage.beginAt(this, getProjectName(), "assay.General.large_assay_2", "Data");

0 commit comments

Comments
 (0)