Skip to content

Commit 9b3a639

Browse files
committed
AssayTest case for GitHub Issue #688 to verify sample lookup createdBy resolved value
1 parent 1736ab8 commit 9b3a639

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

study/test/src/org/labkey/test/tests/study/AssayTest.java

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,6 @@ public void testSampleFieldUpdate()
279279
clickAndWait(Locator.linkWithText("view results"));
280280
assertElementPresent("Sample lookup failed for: OS_1", new Locator.LinkLocator("OS_1"), 1);
281281

282-
283282
log("Edit assay design and change Sample field to point to created Sample Type");
284283
goToManageAssays();
285284
clickAndWait(Locator.LinkLocator.linkWithText(SAMPLE_FIELD_TEST_ASSAY));
@@ -294,10 +293,21 @@ public void testSampleFieldUpdate()
294293
importAssayData(SAMPLE_FIELD_TEST_ASSAY, TEST_RUN2, "SampleField\nS_1");
295294
goToManageAssays().clickAndWait(Locator.linkWithText(SAMPLE_FIELD_TEST_ASSAY));
296295
clickAndWait(Locator.linkWithText("view results"));
297-
// assertElementPresent("Sample lookup failed for: OS_1", new Locator.LinkLocator("OS_1"), 1); //TODO this becomes the RowId "<123>" after change. Issue #40047
298-
296+
DataRegionTable table = new DataRegionTable("Data", getDriver());
297+
List<String> sampleFieldValues = table.getColumnDataAsText("SampleField");
298+
assertTrue("First sample should not resolve to sample type", sampleFieldValues.get(0).startsWith("<"));
299+
assertEquals("Second sample should resolve to sample type", "S_1", sampleFieldValues.get(1));
299300
assertElementPresent("Sample lookup failed for: S_1", new Locator.LinkLocator("S_1"), 1);
300301

302+
log("GitHub Issue #688: verify sample lookup to createdBy");
303+
_customizeViewsHelper.openCustomizeViewPanel();
304+
_customizeViewsHelper.addColumn("SampleField/CreatedBy");
305+
_customizeViewsHelper.applyCustomView();
306+
table = new DataRegionTable("Data", getDriver());
307+
List<String> createdByValues = table.getColumnDataAsText("SampleField/CreatedBy");
308+
assertEquals("First sample should not have a createdBy since it doesn't resolve", " ", createdByValues.get(0));
309+
assertEquals("Second sample should have a createdBy since it resolves to a sample type", getCurrentUserName(), createdByValues.get(1));
310+
301311
log("Edit assay design and change Sample field to point back to 'All Samples'");
302312
goToManageAssays();
303313
clickAndWait(Locator.LinkLocator.linkWithText(SAMPLE_FIELD_TEST_ASSAY));
@@ -319,6 +329,10 @@ public void testSampleFieldUpdate()
319329
assertElementPresent("Sample lookup failed for: S_2", new Locator.LinkLocator("S_2"), 1);
320330
assertElementPresent("Sample lookup failed for: OS_2", new Locator.LinkLocator("OS_2"), 1);
321331

332+
log("GitHub Issue #688: verify sample lookup to createdBy");
333+
table = new DataRegionTable("Data", getDriver());
334+
for (int i = 0; i < table.getDataRowCount(); i++)
335+
assertEquals("Row " + i + " should have current user as createdBy since they all resolve to samples", getCurrentUserName(), table.getDataAsText(i, "SampleField/CreatedBy"));
322336
}
323337

324338
private void importAssayData(String assayName, String runName, String runDataStr)

0 commit comments

Comments
 (0)