From 33daa59eebeffec511830ed21874aae7342e4654 Mon Sep 17 00:00:00 2001 From: labkey-susanh Date: Fri, 3 Apr 2026 10:10:30 -0700 Subject: [PATCH] Issue 975: Don't include sample types from other folders when exporting --- .../SampleTypeFolderExportImportTest.java | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/org/labkey/test/tests/SampleTypeFolderExportImportTest.java b/src/org/labkey/test/tests/SampleTypeFolderExportImportTest.java index a7c70fecfc..09c295aa77 100644 --- a/src/org/labkey/test/tests/SampleTypeFolderExportImportTest.java +++ b/src/org/labkey/test/tests/SampleTypeFolderExportImportTest.java @@ -552,6 +552,37 @@ public void testExportImportDerivedSamples() throws Exception } } + @Test + public void testExportImportSampleTypesWithSubfolder() + { + String subfolder = "subfolderNoSampleType"; + String projectSampleType = "testSamplesWithSubfolder"; + String importProject = "testDupeTypeImportProject"; + + _containerHelper.createSubfolder(getProjectName(), subfolder); + _containerHelper.deleteProject(importProject, false); + _containerHelper.createProject(importProject); + log("Create a sample type in the parent folder"); + List testFields = SampleTypeAPIHelper.sampleTypeTestFields(false); + SampleTypeDefinition testSampleType = new SampleTypeDefinition(projectSampleType).setFields(testFields); + SampleTypeAPIHelper.createEmptySampleType(getProjectName(), testSampleType); + + goToProjectHome(); + ExportFolderPage exportPage = goToFolderManagement() + .goToExportTab(); + exportPage.includeSubfolders(true); + File exportedFolderFile = exportPage.exportToBrowserAsZipFile(); + + goToProjectHome(importProject); + importFolderFromZip(exportedFolderFile, false, 1); + goToProjectFolder(importProject, subfolder); + PortalHelper portalHelper = new PortalHelper(this); + portalHelper.addWebPart("Sample Types"); + DataRegionTable table = DataRegionTable.DataRegion(getDriver()).withName("SampleSet").waitFor(); + List typeNames = table.getColumnDataAsText("Name"); + checker().verifyEquals("Type names not as expected", List.of(projectSampleType), typeNames); + } + @Test public void testExportImportSampleTypesWithAssayRuns() throws Exception { @@ -650,7 +681,7 @@ public void testExportImportSampleTypesWithAssayRuns() throws Exception runRecords2.add(Map.of("sampleId", "sample2", "resultData", "less thing")); runRecords2.add(Map.of("sampleId", "sample3", "resultData", "the other other thing")); - ImportRunCommand importRunCommand2 = new ImportRunCommand(protocolId, runRecords1); + ImportRunCommand importRunCommand2 = new ImportRunCommand(protocolId, runRecords2); importRunCommand2.setName("secondRun"); importRunCommand2.setBatchId(124); importRunCommand2.execute(createDefaultConnection(), subfolderPath);