2121import org .junit .Test ;
2222import org .labkey .serverapi .reader .Readers ;
2323import org .labkey .test .BaseWebDriverTest ;
24+ import org .labkey .test .Locator ;
2425import org .labkey .test .TestFileUtils ;
2526import org .labkey .test .TestTimeoutException ;
2627import org .labkey .test .components .ext4 .Window ;
@@ -67,7 +68,18 @@ public void testSteps() throws Exception
6768 {
6869 setUpTest ();
6970
70- testOutputFileProcessing ();
71+ testDemoUi ();
72+ //testOutputFileProcessing();
73+ }
74+
75+ private void testDemoUi ()
76+ {
77+ beginAt ("/home/jbrowse-jbrowse.view" );
78+
79+ waitAndClick (Locator .tagWithClass ("span" , "MuiButton-label" ));
80+
81+ waitAndClick (Locator .tagWithClass ("span" , "MuiButton-label" ).containing ("Open track selector" ));
82+
7183 }
7284
7385 @ Override
@@ -81,187 +93,75 @@ protected void setUpTest() throws Exception
8193 _containerHelper .createProject (getProjectName (), "Sequence Analysis" );
8294 _containerHelper .enableModule ("JBrowse" );
8395
84- //TODO
85- //download/setup jbrowse scripts
86- // File scriptDir = Files.createTempDir();
87- // downloadInstallScripts(scriptDir);
88- //
89- // goToAdminConsole();
90- // waitAndClickAndWait(Locator.linkContainingText("jbrowse admin"));
91- // Ext4FieldRef.waitForField(this, "Script Directory");
92- // Ext4FieldRef.getForLabel(this, "Script Directory").setValue(scriptDir.toString());
93- // click(Ext4Helper.Locators.ext4ButtonEnabled("Save Settings"));
94- // waitAndClickAndWait(Ext4Helper.Locators.ext4ButtonEnabled("OK"));
95-
9696 //create genome and add resources
9797 Integer genomeId = SequenceTest .createReferenceGenome (this , _completedPipelineJobs );
9898 _completedPipelineJobs ++; //keep track of pipeline jobs
9999
100100 _completedPipelineJobs = SequenceTest .addReferenceGenomeTracks (this , getProjectName (), SequenceTest .TEST_GENOME_NAME , genomeId , _completedPipelineJobs );
101101 }
102102
103- private void downloadInstallScripts (File scriptDir ) throws Exception
104- {
105- URL url = new URL ("http://jbrowse.org/wordpress/wp-content/plugins/download-monitor/download.php?id=98" );
106- File zip = new File (scriptDir , "jbrowse.zip" );
107-
108- try (InputStream is = url .openStream ();BufferedOutputStream out = new BufferedOutputStream (new FileOutputStream (zip )))
109- {
110- IOUtils .copy (is , out );
111- }
112-
113- unzipToDirectory (zip , scriptDir );
114- zip .delete ();
115-
116- //now attempt to run/install script:
117- File unzipDir = new File (scriptDir , "JBrowse-1.11.5" );
118- if (SystemUtils .IS_OS_WINDOWS )
119- {
120- execute (Arrays .asList ("perl" , "bin\\ cpanm" , "--notest" , "-l" , "extlib\\ " , "--installdeps" , "." ), unzipDir );
121- }
122- else
123- {
124- //just run the shell script
125- execute (Arrays .asList ("setup.sh" ), unzipDir );
126- }
127- }
128-
129- private void unzipToDirectory (File sourceZip , File unzipDir ) throws IOException
130- {
131- try (ZipInputStream zis = new ZipInputStream (new FileInputStream (sourceZip ));BufferedInputStream is = new BufferedInputStream (zis ))
132- {
133- ZipEntry entry ;
134- while (null != (entry = zis .getNextEntry ()))
135- {
136- if (entry .isDirectory ())
137- {
138- File newDir = new File (unzipDir , entry .getName ());
139- newDir .mkdir ();
140- continue ;
141- }
142-
143- //log("Expanding " + entry.getName());
144-
145- File destFile = new File (unzipDir , entry .getName ());
146- destFile .getParentFile ().mkdirs ();
147- destFile .createNewFile ();
148-
149- try (BufferedOutputStream os = new BufferedOutputStream (new FileOutputStream (destFile )))
150- {
151- IOUtils .copy (is , os );
152- zis .closeEntry ();
153- }
154- }
155- }
156- }
157-
158- public String execute (List <String > params , File workingDir ) throws Exception
159- {
160- StringBuffer output = new StringBuffer ();
161- log ("\t " + StringUtils .join (params , " " ));
162-
163- ProcessBuilder pb = new ProcessBuilder (params );
164- pb .environment ().put ("PATH" , System .getenv ("PATH" ));
165- pb .directory (workingDir );
166- log ("using working dir: " + workingDir .getPath ());
167- pb .redirectErrorStream (true );
168-
169- Process p = null ;
170- try
171- {
172- p = pb .start ();
173-
174- try (BufferedReader procReader = Readers .getReader (p .getInputStream ()))
175- {
176- String line ;
177- while ((line = procReader .readLine ()) != null )
178- {
179- output .append (line );
180- output .append (System .getProperty ("line.separator" ));
181-
182- log (line );
183- }
184- }
185-
186- int returnCode = p .waitFor ();
187- if (returnCode != 0 )
188- {
189- throw new Exception ("process exited with non-zero value: " + returnCode );
190- }
191- }
192- finally
193- {
194- if (p != null )
195- {
196- p .destroy ();
197- }
198- }
199-
200- return output .toString ();
201- }
202-
203103 @ Override
204104 public List <String > getAssociatedModules ()
205105 {
206106 return Arrays .asList ("jbrowse" );
207107 }
208108
209- private void testOutputFileProcessing () throws Exception
210- {
211- goToProjectHome ();
212-
213- //import BAM, VCF, BED, GFF
214- File dataDir = TestFileUtils .getSampleData ("sequenceAnalysis/genomeAnnotations" );
215- for (File f : dataDir .listFiles ())
216- {
217- SequenceTest .addOutputFile (this , f , SequenceTest .TEST_GENOME_NAME , f .getName (), "Gene Annotations" , "This is an output file" , false );
218- }
219-
220- File testBam = new File (SequenceTest ._sampleData , "test.bam" );
221- SequenceTest .addOutputFile (this , testBam , SequenceTest .TEST_GENOME_NAME , "TestBAM" , "BAM File" , "This is an output file" , false );
222-
223- //create session w/ some of these, verify
224- log ("creating initial jbrowse session" );
225- beginAt ("/sequenceanalysis/" + getContainerId () + "/begin.view" );
226- waitAndClickAndWait (LabModuleHelper .getNavPanelItem ("Output Files:" , null ));
227-
228- DataRegionTable dr = new DataRegionTable ("query" , this );
229- dr .uncheckAll ();
230- dr .checkCheckbox (0 );
231- dr .clickHeaderMenu ("More Actions" , false , "View In JBrowse" );
232-
233- String sessionName = "TestSession1" ;
234- new Window .WindowFinder (getDriver ()).withTitle ("Create/Modify JBrowse Session" ).waitFor ();
235- Ext4FieldRef .getForLabel (this , "Name" ).setValue (sessionName );
236- Ext4FieldRef .getForLabel (this , "Description" ).setValue ("This is the first session" );
237- waitAndClick (Ext4Helper .Locators .ext4ButtonEnabled ("Submit" ));
238- new Window .WindowFinder (getDriver ()).withTitle ("Success" ).waitFor ();
239- waitAndClickAndWait (Ext4Helper .Locators .ext4ButtonEnabled ("OK" ));
240- _completedPipelineJobs ++;
241- waitForPipelineJobsToComplete (_completedPipelineJobs , "Create New Session" , false );
242-
243- //add additional file to session, verify
244- //TODO: first cache timestamps on JSON resources. we expect these to be untouched
245-
246- beginAt ("/sequenceanalysis/" + getContainerId () + "/begin.view" );
247- waitAndClickAndWait (LabModuleHelper .getNavPanelItem ("Output Files:" , null ));
248-
249- dr = new DataRegionTable ("query" , this );
250- dr .uncheckAll ();
251- dr .checkCheckbox (1 );
252- dr .checkCheckbox (2 );
253- dr .clickHeaderMenu ("More Actions" , false , "View In JBrowse" );
254- new Window .WindowFinder (getDriver ()).withTitle ("Create/Modify JBrowse Session" ).waitFor ();
255- Ext4FieldRef .getForBoxLabel (this , "Add To Existing Session" ).setChecked (true );
256- Ext4FieldRef .waitForField (this , "Session" );
257- Ext4ComboRef .getForLabel (this , "Session" ).setComboByDisplayValue (sessionName );
258- waitAndClick (Ext4Helper .Locators .ext4ButtonEnabled ("Submit" ));
259- new Window .WindowFinder (getDriver ()).withTitle ("Success" ).waitFor ();
260- waitAndClickAndWait (Ext4Helper .Locators .ext4ButtonEnabled ("OK" ));
261- _completedPipelineJobs ++;
262- waitForPipelineJobsToComplete (_completedPipelineJobs , "Add To Existing Session" , false );
263-
264- //TODO: reprocess one of these JSONFiles. make sure original files are deleted + session reprocessed
265- beginAt ("/sequenceanalysis/" + getContainerId () + "/begin.view" );
266- }
109+ // private void testOutputFileProcessing() throws Exception
110+ // {
111+ // goToProjectHome();
112+ //
113+ // //import BAM, VCF, BED, GFF
114+ // File dataDir = TestFileUtils.getSampleData("sequenceAnalysis/genomeAnnotations");
115+ // for (File f : dataDir.listFiles())
116+ // {
117+ // SequenceTest.addOutputFile(this, f, SequenceTest.TEST_GENOME_NAME, f.getName(), "Gene Annotations", "This is an output file", false);
118+ // }
119+ //
120+ // File testBam = new File(SequenceTest._sampleData, "test.bam");
121+ // SequenceTest.addOutputFile(this, testBam, SequenceTest.TEST_GENOME_NAME, "TestBAM", "BAM File", "This is an output file", false);
122+ //
123+ // //create session w/ some of these, verify
124+ // log("creating initial jbrowse session");
125+ // beginAt("/sequenceanalysis/" + getContainerId() + "/begin.view");
126+ // waitAndClickAndWait(LabModuleHelper.getNavPanelItem("Output Files:", null));
127+ //
128+ // DataRegionTable dr = new DataRegionTable("query", this);
129+ // dr.uncheckAll();
130+ // dr.checkCheckbox(0);
131+ // dr.clickHeaderMenu("More Actions", false, "View In JBrowse");
132+ //
133+ // String sessionName = "TestSession1";
134+ // new Window.WindowFinder(getDriver()).withTitle("Create/Modify JBrowse Session").waitFor();
135+ // Ext4FieldRef.getForLabel(this, "Name").setValue(sessionName);
136+ // Ext4FieldRef.getForLabel(this, "Description").setValue("This is the first session");
137+ // waitAndClick(Ext4Helper.Locators.ext4ButtonEnabled("Submit"));
138+ // new Window.WindowFinder(getDriver()).withTitle("Success").waitFor();
139+ // waitAndClickAndWait(Ext4Helper.Locators.ext4ButtonEnabled("OK"));
140+ // _completedPipelineJobs++;
141+ // waitForPipelineJobsToComplete(_completedPipelineJobs, "Create New Session", false);
142+ //
143+ // //add additional file to session, verify
144+ // //TODO: first cache timestamps on JSON resources. we expect these to be untouched
145+ //
146+ // beginAt("/sequenceanalysis/" + getContainerId() + "/begin.view");
147+ // waitAndClickAndWait(LabModuleHelper.getNavPanelItem("Output Files:", null));
148+ //
149+ // dr = new DataRegionTable("query", this);
150+ // dr.uncheckAll();
151+ // dr.checkCheckbox(1);
152+ // dr.checkCheckbox(2);
153+ // dr.clickHeaderMenu("More Actions", false, "View In JBrowse");
154+ // new Window.WindowFinder(getDriver()).withTitle("Create/Modify JBrowse Session").waitFor();
155+ // Ext4FieldRef.getForBoxLabel(this, "Add To Existing Session").setChecked(true);
156+ // Ext4FieldRef.waitForField(this, "Session");
157+ // Ext4ComboRef.getForLabel(this, "Session").setComboByDisplayValue(sessionName);
158+ // waitAndClick(Ext4Helper.Locators.ext4ButtonEnabled("Submit"));
159+ // new Window.WindowFinder(getDriver()).withTitle("Success").waitFor();
160+ // waitAndClickAndWait(Ext4Helper.Locators.ext4ButtonEnabled("OK"));
161+ // _completedPipelineJobs++;
162+ // waitForPipelineJobsToComplete(_completedPipelineJobs, "Add To Existing Session", false);
163+ //
164+ // //TODO: reprocess one of these JSONFiles. make sure original files are deleted + session reprocessed
165+ // beginAt("/sequenceanalysis/" + getContainerId() + "/begin.view");
166+ // }
267167}
0 commit comments