diff --git a/src/org/labkey/test/tests/SampleTypeFolderExportImportTest.java b/src/org/labkey/test/tests/SampleTypeFolderExportImportTest.java index 3739f2eee2..622cbe137d 100644 --- a/src/org/labkey/test/tests/SampleTypeFolderExportImportTest.java +++ b/src/org/labkey/test/tests/SampleTypeFolderExportImportTest.java @@ -43,6 +43,7 @@ import org.labkey.test.params.FieldDefinition; import org.labkey.test.params.experiment.DataClassDefinition; import org.labkey.test.params.experiment.SampleTypeDefinition; +import org.labkey.test.util.ArtifactCollector; import org.labkey.test.util.DataRegionTable; import org.labkey.test.util.LogMethod; import org.labkey.test.util.PortalHelper; @@ -546,7 +547,7 @@ public void testExportImportSampleTypesWithAssayRuns() throws Exception { String subfolder = "samplesWithAssayRunsFolder"; String subfolderPath = getProjectName() + "/" + subfolder; - String testSamples = "testSamples"; + String testSamples = "testSamplesWithFiles"; String assayName = "testAssay"; String importFolder = "assaySamplesImportFolder"; @@ -557,7 +558,7 @@ public void testExportImportSampleTypesWithAssayRuns() throws Exception // create a test sampleType List testFields = SampleTypeAPIHelper.sampleTypeTestFields(true); SampleTypeDefinition testSampleType = new SampleTypeDefinition(testSamples).setFields(testFields) - .addParentAlias("SelfParent"); // to derive from samles in the current type + .addParentAlias("SelfParent"); // to derive from samples in the current type TestDataGenerator parentDgen = SampleTypeAPIHelper.createEmptySampleType(subfolderPath, testSampleType); parentDgen.addCustomRow(Map.of("Name", "sample1", "intColumn", 1, "decimalColumn", 1.1, "stringColumn", "one")); @@ -572,14 +573,23 @@ public void testExportImportSampleTypesWithAssayRuns() throws Exception portalHelper.addWebPart("Experiment Runs"); portalHelper.addWebPart("Assay List"); - // upload a file for a sample's file field + log(String.format("Upload a file '%s' to a sample's file field.", SAMPLE_TXT_FILE.getName())); clickAndWait(Locator.linkWithText(testSamples)); DataRegionTable sourceSamplesTable = new SampleTypeHelper(this).getSamplesDataRegionTable(); sourceSamplesTable.clickEditRow(1); waitForElementToBeVisible(Locator.tagWithAttribute("input", "type", "file")); setFormElement(Locator.tagWithAttribute("input", "type", "file"), SAMPLE_TXT_FILE); + // setFormElement doesn't check that the form element is set. + // Because this test uses random field names, we should validate that the file was actually uploaded. If the + // file is missing later in the test, we can be sure it was present at this point. + Assert.assertTrue("File not uploaded to 'add new' form.", + waitFor(()->!getFormElement(Locator.tagWithAttribute("input", "type", "file")).isEmpty(), 1_500)); clickAndWait(Locator.lkButton("Submit")); + waitForElementToBeVisible(Locator.linkContainingText(SAMPLE_TXT_FILE.getName())); + + new ArtifactCollector(this).dumpPageSnapshot("File_Attached_Proof"); + goToProjectFolder(getProjectName(), subfolder); // now define an assay that references it @@ -644,14 +654,26 @@ public void testExportImportSampleTypesWithAssayRuns() throws Exception exportData.add(dataTable.getRowDataAsMap(i)); } - // now export the current folder and import it to importProject + log("Now export the current folder and import it to importProject."); goToFolderManagement() .goToExportTab(); - Checkbox checkbox = new Checkbox(Locator.tagWithText("label", ExportFolderPage.EXPERIMENTS_AND_RUNS) - .precedingSibling("input").waitForElement(getDriver(), WAIT_FOR_JAVASCRIPT)); - new Checkbox(Locator.tagWithText("label", "Files").precedingSibling("input").findElement(getDriver())).check(); - checkbox.check(); + new Checkbox(Locator.tagWithText("label", ExportFolderPage.EXPERIMENTS_AND_RUNS) + .precedingSibling("input").waitForElement(getDriver(), WAIT_FOR_JAVASCRIPT)).check(); + + new Checkbox(Locator.tagWithText("label", "Files") + .precedingSibling("input").waitForElement(getDriver(), WAIT_FOR_JAVASCRIPT)).check(); + + Assert.assertTrue("Experiment and Runs not checked for export.", + new Checkbox(Locator.tagWithText("label", ExportFolderPage.EXPERIMENTS_AND_RUNS) + .precedingSibling("input").waitForElement(getDriver(), WAIT_FOR_JAVASCRIPT)).isChecked()); + + Assert.assertTrue("Files not checked for export.", + new Checkbox(Locator.tagWithText("label", "Files").precedingSibling("input").findElement(getDriver())) + .isChecked()); + + log("'Experiment and Runs' & 'Files' are selected for export."); + File exportedFolderFile = doAndWaitForDownload(()->findButton("Export").click()); goToProjectFolder(IMPORT_PROJECT_NAME, importFolder); diff --git a/src/org/labkey/test/tests/list/ListTest.java b/src/org/labkey/test/tests/list/ListTest.java index 9c5404850b..16feaf1b84 100644 --- a/src/org/labkey/test/tests/list/ListTest.java +++ b/src/org/labkey/test/tests/list/ListTest.java @@ -535,6 +535,7 @@ public void testLongName() checker().verifyEquals("Default value not as expected ", "42", updatePage.getTextInputValue(fieldWithDefault)); updatePage.submit(); } + /* Issue 51572: Bug with creating a new list by uploading a csv file in "UTF-8 with BOM" format */ @Test @@ -580,7 +581,7 @@ public void testCustomViews() setUpList(getProjectName()); goToProjectHome(); - clickAndWait(Locator.linkWithText(LIST_NAME_COLORS)); + waitAndClickAndWait(Locator.linkWithText(LIST_NAME_COLORS)); log("Test Sort and Filter in Data View"); DataRegionTable region = new DataRegionTable("query", getDriver()); @@ -595,7 +596,7 @@ public void testCustomViews() log("Test Customize View"); // Re-navigate to the list to clear filters and sorts clickTab("List"); - clickAndWait(Locator.linkWithText(LIST_NAME_COLORS)); + waitAndClickAndWait(Locator.linkWithText(LIST_NAME_COLORS)); _customizeViewsHelper.openCustomizeViewPanel(); _customizeViewsHelper.removeColumn(_listColGood.getName()); _customizeViewsHelper.addFilter(_listColGood.getName(), "Is Less Than", "10"); @@ -660,10 +661,19 @@ public void testCustomViews() log("Test list history"); clickAndWait(Locator.linkWithText("manage lists")); - clickAndWait(Locator.linkWithText("view history")); - checker().wrapAssertion(()->assertTextPresent(":History")); - checker().wrapAssertion(()->assertTextPresent("record was modified", 2)); // An existing list record was modified + DataRegionTable drt = new DataRegionTable.DataRegionFinder(getDriver()).find(); + drt.setFilter("Name", "Equals", LIST_NAME_COLORS); + waitFor(()->drt.getDataRowCount()==1, + String.format("DataRegion table did not filter to list %s", LIST_NAME_COLORS), 2_500); + waitAndClickAndWait(Locator.linkWithText("view history")); + // Wait for the header to load on the page. + waitForElementToBeVisible(Locator.tagContainingText("h3", ":History")); + + checker().verifyTrue("DataRegions didn't load.", + waitFor(()->new DataRegionTable.DataRegionFinder(getDriver()).findAll().size() == 2, 3_000)); + + checker().wrapAssertion(()->assertTextPresent("record was modified", 2)); // An existing list record was modified checker().wrapAssertion(()->assertTextPresent(" was created. The column(s) of domain ", 1));// Create domain and update columns combined into a single event checker().wrapAssertion(()->assertTextPresent(" were modified.", 7)); // The column(s) of LIST_NAME_COLORS domain were modified checker().wrapAssertion(()->assertTextPresent("The descriptor of domain", 1)); // The description LIST_NAME_COLORS domain were modified @@ -674,13 +684,16 @@ public void testCustomViews() checker().wrapAssertion(()->assertEquals("details Links", 6/*List Events*/ + 8/*Domain Audit*/, DataRegionTable.detailsLinkLocator().findElements(getDriver()).size())); checker().wrapAssertion(()->assertEquals("Project Links", 17, DataRegionTable.Locators.table().append(Locator.linkWithText(PROJECT_VERIFY)).findElements(getDriver()).size())); checker().wrapAssertion(()->assertEquals("List Links", 17, DataRegionTable.Locators.table().append(Locator.linkWithText(LIST_NAME_COLORS)).findElements(getDriver()).size())); + checker().screenShotIfNewError("List_History_Error"); + DataRegionTable dataRegionTable = new DataRegionTable("query", getDriver()); dataRegionTable.clickRowDetails(0); checker().wrapAssertion(()->assertTextPresent("List Item Details")); checker().wrapAssertion(()->assertTextNotPresent("No details available for this event.", "Unable to find the audit history detail for this event")); + checker().screenShotIfNewError("History_Detail_Error"); clickButton("Done"); - clickAndWait(Locator.linkWithText(PROJECT_VERIFY).index(3)); + waitAndClickAndWait(Locator.linkWithText(PROJECT_VERIFY).index(3)); log("Test single list web part"); new PortalHelper(this).addWebPart("List - Single");