JAL-629 Dynamic sleep in test, more diagnostics
[jalview.git] / test / jalview / bin / CommandsTest2.java
index 34b802e..0e1720a 100644 (file)
@@ -58,13 +58,23 @@ public class CommandsTest2
   @Test(
     groups =
     { "Functional" },
-    dataProvider = "structureOpeningArgsParams")
+    dataProvider = "structureOpeningArgsParams",
+    singleThreaded = true)
   public void structureOpeningArgsTest(String cmdLine, int seqNum,
           int annNum, int viewerNum)
   {
     String[] args = cmdLine.split("\\s+");
 
     Jalview.main(args);
+    try
+    {
+      // sleep for slow build server to open annotations and viewer windows
+      Thread.sleep(seqNum * 100 + annNum * 200 + viewerNum * 1500);
+    } catch (InterruptedException e)
+    {
+      e.printStackTrace();
+    }
+
     AlignFrame[] afs = Desktop.getAlignFrames();
     Assert.assertNotNull(afs);
     Assert.assertTrue(afs.length > 0);
@@ -88,8 +98,12 @@ public class CommandsTest2
 
     AlignmentAnnotation[] aas = al.getAlignmentAnnotation();
     int visibleAnn = 0;
+    int dcount = 0;
     for (AlignmentAnnotation aa : aas)
     {
+      System.err.println("##### DIAGNOSIS: annotation " + ++dcount
+              + " is labelled '" + aa.label + "'");
+      System.err.println("# " + aa.annotationId + ": " + aa.toString());
       if (aa.visible)
         visibleAnn++;
     }
@@ -99,23 +113,12 @@ public class CommandsTest2
 
     if (viewerNum > -1)
     {
-      try
-      {
-        // sleep for slow build server to open viewer window
-        Thread.sleep(2000);
-      } catch (InterruptedException e)
-      {
-        e.printStackTrace();
-      }
       List<StructureViewerBase> openViewers = Desktop.instance
               .getStructureViewers(ap, null);
       Assert.assertNotNull(openViewers);
       int count = 0;
-      int dcount = 0;
       for (StructureViewerBase svb : openViewers)
       {
-        System.err.println("##### DIAGNOSIS: annotation " + dcount
-                + " is called '" + svb.getName() + "'");
         if (svb.isVisible())
           count++;
       }