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
38 changes: 30 additions & 8 deletions src/org/labkey/test/tests/SampleTypeFolderExportImportTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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";

Expand All @@ -557,7 +558,7 @@ public void testExportImportSampleTypesWithAssayRuns() throws Exception
// create a test sampleType
List<FieldDefinition> 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for fixing that


TestDataGenerator parentDgen = SampleTypeAPIHelper.createEmptySampleType(subfolderPath, testSampleType);
parentDgen.addCustomRow(Map.of("Name", "sample1", "intColumn", 1, "decimalColumn", 1.1, "stringColumn", "one"));
Expand All @@ -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
Expand Down Expand Up @@ -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);
Expand Down
25 changes: 19 additions & 6 deletions src/org/labkey/test/tests/list/ListTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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());
Expand All @@ -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");
Expand Down Expand Up @@ -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
Expand All @@ -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");
Expand Down