Skip to content

Commit e4c9a9a

Browse files
Issue 975: Don't include sample types from other folders when exporting (#2933)
1 parent a12ab93 commit e4c9a9a

1 file changed

Lines changed: 32 additions & 1 deletion

File tree

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

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,37 @@ public void testExportImportDerivedSamples() throws Exception
552552
}
553553
}
554554

555+
@Test
556+
public void testExportImportSampleTypesWithSubfolder()
557+
{
558+
String subfolder = "subfolderNoSampleType";
559+
String projectSampleType = "testSamplesWithSubfolder";
560+
String importProject = "testDupeTypeImportProject";
561+
562+
_containerHelper.createSubfolder(getProjectName(), subfolder);
563+
_containerHelper.deleteProject(importProject, false);
564+
_containerHelper.createProject(importProject);
565+
log("Create a sample type in the parent folder");
566+
List<FieldDefinition> testFields = SampleTypeAPIHelper.sampleTypeTestFields(false);
567+
SampleTypeDefinition testSampleType = new SampleTypeDefinition(projectSampleType).setFields(testFields);
568+
SampleTypeAPIHelper.createEmptySampleType(getProjectName(), testSampleType);
569+
570+
goToProjectHome();
571+
ExportFolderPage exportPage = goToFolderManagement()
572+
.goToExportTab();
573+
exportPage.includeSubfolders(true);
574+
File exportedFolderFile = exportPage.exportToBrowserAsZipFile();
575+
576+
goToProjectHome(importProject);
577+
importFolderFromZip(exportedFolderFile, false, 1);
578+
goToProjectFolder(importProject, subfolder);
579+
PortalHelper portalHelper = new PortalHelper(this);
580+
portalHelper.addWebPart("Sample Types");
581+
DataRegionTable table = DataRegionTable.DataRegion(getDriver()).withName("SampleSet").waitFor();
582+
List<String> typeNames = table.getColumnDataAsText("Name");
583+
checker().verifyEquals("Type names not as expected", List.of(projectSampleType), typeNames);
584+
}
585+
555586
@Test
556587
public void testExportImportSampleTypesWithAssayRuns() throws Exception
557588
{
@@ -650,7 +681,7 @@ public void testExportImportSampleTypesWithAssayRuns() throws Exception
650681
runRecords2.add(Map.of("sampleId", "sample2", "resultData", "less thing"));
651682
runRecords2.add(Map.of("sampleId", "sample3", "resultData", "the other other thing"));
652683

653-
ImportRunCommand importRunCommand2 = new ImportRunCommand(protocolId, runRecords1);
684+
ImportRunCommand importRunCommand2 = new ImportRunCommand(protocolId, runRecords2);
654685
importRunCommand2.setName("secondRun");
655686
importRunCommand2.setBatchId(124);
656687
importRunCommand2.execute(createDefaultConnection(), subfolderPath);

0 commit comments

Comments
 (0)