JAL-4305 Isolate and unify the Jalview object from all the gubbins in jalview.bin...
[jalview.git] / test / jalview / bin / CommandsTest2.java
index 0c2071a..a78ca5a 100644 (file)
@@ -65,16 +65,21 @@ public class CommandsTest2
     String[] args = cmdLine.split("\\s+");
 
     CommandsTest.callJalviewMain(args);
-    try
+    while (Desktop.instance != null
+            && Desktop.instance.operationsAreInProgress())
     {
-      // sleep for slow build server to open annotations and viewer windows
-      Thread.sleep(seqNum * 50 + annNum * 50 + viewerNum * 500);
-    } catch (InterruptedException e)
-    {
-      e.printStackTrace();
+      try
+      {
+        // sleep for slow build server to open annotations and viewer windows
+        Thread.sleep(viewerNum * 50);
+      } catch (InterruptedException e)
+      {
+        e.printStackTrace();
+      }
     }
+    ;
 
-    AlignFrame[] afs = Desktop.getAlignFrames();
+    AlignFrame[] afs = Desktop.getDesktopAlignFrames();
     Assert.assertNotNull(afs);
     Assert.assertTrue(afs.length > 0);