Skip to content

Commit cdde1fb

Browse files
Wait for the DataRegions on the list test.
Validate file has been uploaded on the form.
1 parent 21a935b commit cdde1fb

2 files changed

Lines changed: 18 additions & 5 deletions

File tree

src/org/labkey/test/tests/SampleTypeFolderExportImportTest.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ public void testExportImportSampleTypesWithAssayRuns() throws Exception
557557
// create a test sampleType
558558
List<FieldDefinition> testFields = SampleTypeAPIHelper.sampleTypeTestFields(true);
559559
SampleTypeDefinition testSampleType = new SampleTypeDefinition(testSamples).setFields(testFields)
560-
.addParentAlias("SelfParent"); // to derive from samles in the current type
560+
.addParentAlias("SelfParent"); // to derive from samples in the current type
561561

562562
TestDataGenerator parentDgen = SampleTypeAPIHelper.createEmptySampleType(subfolderPath, testSampleType);
563563
parentDgen.addCustomRow(Map.of("Name", "sample1", "intColumn", 1, "decimalColumn", 1.1, "stringColumn", "one"));
@@ -578,6 +578,11 @@ public void testExportImportSampleTypesWithAssayRuns() throws Exception
578578
sourceSamplesTable.clickEditRow(1);
579579
waitForElementToBeVisible(Locator.tagWithAttribute("input", "type", "file"));
580580
setFormElement(Locator.tagWithAttribute("input", "type", "file"), SAMPLE_TXT_FILE);
581+
// setFormElement doesn't check that the form element is set.
582+
// Because this test uses random field names, we should validate that the file was actually uploaded. If the
583+
// file is missing later in the test, we can be sure it was present at this point.
584+
Assert.assertFalse("File not uploaded.",
585+
getFormElement(Locator.tagWithAttribute("input", "type", "file")).isEmpty());
581586
clickAndWait(Locator.lkButton("Submit"));
582587

583588
goToProjectFolder(getProjectName(), subfolder);

src/org/labkey/test/tests/list/ListTest.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -660,10 +660,15 @@ public void testCustomViews()
660660

661661
log("Test list history");
662662
clickAndWait(Locator.linkWithText("manage lists"));
663-
clickAndWait(Locator.linkWithText("view history"));
664-
checker().wrapAssertion(()->assertTextPresent(":History"));
665-
checker().wrapAssertion(()->assertTextPresent("record was modified", 2)); // An existing list record was modified
663+
waitAndClickAndWait(Locator.linkWithText("view history"));
664+
665+
// Wait for the header to load on the page.
666+
waitForElementToBeVisible(Locator.tagContainingText("h3", ":History"));
667+
668+
checker().verifyTrue("DataRegions didn't load.",
669+
waitFor(()->new DataRegionTable.DataRegionFinder(getDriver()).findAll().size() == 2, 3_000));
666670

671+
checker().wrapAssertion(()->assertTextPresent("record was modified", 2)); // An existing list record was modified
667672
checker().wrapAssertion(()->assertTextPresent(" was created. The column(s) of domain ", 1));// Create domain and update columns combined into a single event
668673
checker().wrapAssertion(()->assertTextPresent(" were modified.", 7)); // The column(s) of LIST_NAME_COLORS domain were modified
669674
checker().wrapAssertion(()->assertTextPresent("The descriptor of domain", 1)); // The description LIST_NAME_COLORS domain were modified
@@ -674,13 +679,16 @@ public void testCustomViews()
674679
checker().wrapAssertion(()->assertEquals("details Links", 6/*List Events*/ + 8/*Domain Audit*/, DataRegionTable.detailsLinkLocator().findElements(getDriver()).size()));
675680
checker().wrapAssertion(()->assertEquals("Project Links", 17, DataRegionTable.Locators.table().append(Locator.linkWithText(PROJECT_VERIFY)).findElements(getDriver()).size()));
676681
checker().wrapAssertion(()->assertEquals("List Links", 17, DataRegionTable.Locators.table().append(Locator.linkWithText(LIST_NAME_COLORS)).findElements(getDriver()).size()));
682+
checker().screenShotIfNewError("List_History_Error");
683+
677684
DataRegionTable dataRegionTable = new DataRegionTable("query", getDriver());
678685
dataRegionTable.clickRowDetails(0);
679686
checker().wrapAssertion(()->assertTextPresent("List Item Details"));
680687
checker().wrapAssertion(()->assertTextNotPresent("No details available for this event.", "Unable to find the audit history detail for this event"));
688+
checker().screenShotIfNewError("History_Detail_Error");
681689

682690
clickButton("Done");
683-
clickAndWait(Locator.linkWithText(PROJECT_VERIFY).index(3));
691+
waitAndClickAndWait(Locator.linkWithText(PROJECT_VERIFY).index(3));
684692

685693
log("Test single list web part");
686694
new PortalHelper(this).addWebPart("List - Single");

0 commit comments

Comments
 (0)