Merge branch 'develop' into features/r2_11_2_alphafold/JAL-629
[jalview.git] / test / jalview / bin / CommandsTest2.java
index 0a47700..d6b6f3c 100644 (file)
@@ -51,8 +51,7 @@ public class CommandsTest2
   @AfterMethod(alwaysRun = true)
   public void tearDown()
   {
-    if (Desktop.instance != null)
-      Desktop.instance.closeAll_actionPerformed(null);
+    Desktop.closeDesktop();
   }
 
   @Test(
@@ -65,15 +64,19 @@ public class CommandsTest2
   {
     String[] args = cmdLine.split("\\s+");
 
-    Jalview.main(args);
-    try
-    {
-      // sleep for slow build server to open annotations and viewer windows
-      Thread.sleep(seqNum * 50 + annNum * 50 + viewerNum * 500);
-    } catch (InterruptedException e)
+    CommandsTest.callJalviewMain(args);
+    while (Desktop.instance!=null && Desktop.instance.operationsAreInProgress())
     {
-      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();
     Assert.assertNotNull(afs);