|
| 1 | +package org.labkey.test.tests.panoramapublic; |
| 2 | + |
| 3 | +import org.junit.Assert; |
| 4 | +import org.junit.Test; |
| 5 | +import org.junit.experimental.categories.Category; |
| 6 | +import org.labkey.test.BaseWebDriverTest; |
| 7 | +import org.labkey.test.Locator; |
| 8 | +import org.labkey.test.TestFileUtils; |
| 9 | +import org.labkey.test.categories.External; |
| 10 | +import org.labkey.test.categories.MacCossLabModules; |
| 11 | +import org.labkey.test.components.CustomizeView; |
| 12 | +import org.labkey.test.util.DataRegionTable; |
| 13 | + |
| 14 | +import static org.junit.Assert.fail; |
| 15 | + |
| 16 | + |
| 17 | +@Category({External.class, MacCossLabModules.class}) |
| 18 | +@BaseWebDriverTest.ClassTimeout(minutes = 5) |
| 19 | +public class PanoramaPublicMoveSkyDocTest extends PanoramaPublicBaseTest |
| 20 | +{ |
| 21 | + private static final String SKY_FILE_1 = "MRMer.zip"; |
| 22 | + private static final String SKY_FILE_2 = "MRMer_renamed_protein.zip"; |
| 23 | + private static final String SKY_FILE_3 = "SmMolLibA.sky.zip"; |
| 24 | + |
| 25 | + @Test |
| 26 | + public void testExperimentCopy() |
| 27 | + { |
| 28 | + String projectName = getProjectName(); |
| 29 | + String sourceFolder = "SourceFolder"; |
| 30 | + String sourceSubfolder = "SourceSubFolder"; |
| 31 | + String targetFolder = "TargetFolder"; |
| 32 | + |
| 33 | + log("Creating source folder " + sourceFolder); |
| 34 | + setupSourceFolder(projectName, sourceFolder, SUBMITTER); |
| 35 | + log("Creating subfolder, " + sourceSubfolder + " in folder " + sourceFolder); |
| 36 | + setupSubfolder(projectName, sourceFolder, sourceSubfolder, FolderType.Experiment, SUBMITTER); |
| 37 | + |
| 38 | + goToProjectHome(); |
| 39 | + log("Creating target folder " + targetFolder); |
| 40 | + setupSourceFolder(projectName, targetFolder, SUBMITTER); |
| 41 | + |
| 42 | + impersonate(SUBMITTER); |
| 43 | + updateSubmitterAccountInfo("One"); |
| 44 | + |
| 45 | + goToProjectFolder(projectName, sourceFolder); |
| 46 | + log("Importing " + SKY_FILE_1 + " in folder " + sourceFolder); |
| 47 | + importData(SKY_FILE_1, 1); |
| 48 | + goToDashboard(); |
| 49 | + log("Moving " + SKY_FILE_1 + " FROM " + sourceFolder + " TO " + targetFolder); |
| 50 | + moveDocument(SKY_FILE_1, targetFolder, 1); |
| 51 | + |
| 52 | + var skyDocSourceFolder = sourceFolder + "/" + sourceSubfolder; |
| 53 | + goToProjectFolder(projectName, skyDocSourceFolder); |
| 54 | + log("Importing " + SKY_FILE_2 + " in folder " + skyDocSourceFolder); |
| 55 | + importData(SKY_FILE_2, 1); |
| 56 | + goToDashboard(); |
| 57 | + log("Moving " + SKY_FILE_2 + " FROM " + skyDocSourceFolder + "TO " + targetFolder); |
| 58 | + moveDocument(SKY_FILE_2, targetFolder, 2); |
| 59 | + |
| 60 | + goToProjectFolder(projectName, targetFolder); |
| 61 | + log("Importing " + SKY_FILE_3 + " in folder " + skyDocSourceFolder); |
| 62 | + importData(SKY_FILE_3, 3); |
| 63 | + |
| 64 | + log("Creating and submitting an experiment"); |
| 65 | + String experimentTitle = "Experiment to test moving Skyline documents from other folders"; |
| 66 | + var expWebPart = createExperimentCompleteMetadata(experimentTitle); |
| 67 | + expWebPart.clickSubmit(); |
| 68 | + String shortAccessLink = submitWithoutPXId(); |
| 69 | + |
| 70 | + // Copy the experiment to the Panorama Public project |
| 71 | + var panoramaCopyFolder = "Copy of " + targetFolder; |
| 72 | + log("Copying experiment to folder " + panoramaCopyFolder +" in the Panorama Public project"); |
| 73 | + copyExperimentAndVerify(projectName, targetFolder, experimentTitle, panoramaCopyFolder, shortAccessLink); |
| 74 | + goToProjectFolder(PANORAMA_PUBLIC, panoramaCopyFolder); |
| 75 | + verifyRunFilePathRoot(SKY_FILE_1, PANORAMA_PUBLIC, panoramaCopyFolder); |
| 76 | + verifyRunFilePathRoot(SKY_FILE_2, PANORAMA_PUBLIC, panoramaCopyFolder); |
| 77 | + verifyRunFilePathRoot(SKY_FILE_3, PANORAMA_PUBLIC, panoramaCopyFolder); |
| 78 | + } |
| 79 | + |
| 80 | + private void moveDocument(String skylineDocName, String targetFolder, int jobCount) |
| 81 | + { |
| 82 | + DataRegionTable table = new DataRegionTable.DataRegionFinder(getDriver()).withName("TargetedMSRuns").waitFor(); |
| 83 | + table.checkCheckbox(0); |
| 84 | + table.clickHeaderButton("Move"); |
| 85 | + waitAndClickAndWait(Locator.linkWithText(targetFolder)); |
| 86 | + waitForPipelineJobsToComplete(jobCount, false); |
| 87 | + |
| 88 | + goToDashboard(); |
| 89 | + |
| 90 | + // Verify that the document moved |
| 91 | + table = new DataRegionTable.DataRegionFinder(getDriver()).withName("TargetedMSRuns").waitFor(); |
| 92 | + int rowIndex = table.getRowIndex("File", skylineDocName); |
| 93 | + if (rowIndex < 0) |
| 94 | + fail("Unable to find row for moved Skyline document: " + skylineDocName); |
| 95 | + |
| 96 | + verifyRunFilePathRoot(skylineDocName, getProjectName(), targetFolder); |
| 97 | + } |
| 98 | + |
| 99 | + private void verifyRunFilePathRoot(String skylineDocName, String projectName, String targetFolder) |
| 100 | + { |
| 101 | + // Verify that exp.run filePathRoot is set to the target folder |
| 102 | + portalHelper.navigateToQuery("exp", "Runs"); |
| 103 | + DataRegionTable queryGrid = new DataRegionTable("query", this); |
| 104 | + CustomizeView view = queryGrid.openCustomizeGrid(); |
| 105 | + view.showHiddenItems(); |
| 106 | + view.addColumn("FilePathRoot"); |
| 107 | + view.applyCustomView(); |
| 108 | + int rowIndex = queryGrid.getRowIndex("Name", skylineDocName); |
| 109 | + if (rowIndex < 0) |
| 110 | + fail("Unable to find row for Skyline document in exp.Runs query grid: " + skylineDocName); |
| 111 | + |
| 112 | + var expectedFileRoot = TestFileUtils.getDefaultFileRoot(projectName + "/" + targetFolder).getPath(); |
| 113 | + var filePathRoot = queryGrid.getDataAsText(rowIndex, "FilePathRoot"); |
| 114 | + |
| 115 | + Assert.assertEquals("Unexpected FilePathRoot ",expectedFileRoot, filePathRoot); |
| 116 | + } |
| 117 | +} |
0 commit comments