Author: kwright
Date: Mon Mar 20 06:19:08 2017
New Revision: 1787687

URL: http://svn.apache.org/viewvc?rev=1787687&view=rev
Log:
Move the wait for job delete into the tester class

Modified:
    
manifoldcf/branches/CONNECTORS-1196-2/connectors/rss/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/rss/tests/NavigationHSQLDBUI.java
    
manifoldcf/branches/CONNECTORS-1196-2/framework/core/src/test/java/org/apache/manifoldcf/core/tests/SeleniumTester.java

Modified: 
manifoldcf/branches/CONNECTORS-1196-2/connectors/rss/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/rss/tests/NavigationHSQLDBUI.java
URL: 
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1196-2/connectors/rss/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/rss/tests/NavigationHSQLDBUI.java?rev=1787687&r1=1787686&r2=1787687&view=diff
==============================================================================
--- 
manifoldcf/branches/CONNECTORS-1196-2/connectors/rss/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/rss/tests/NavigationHSQLDBUI.java
 (original)
+++ 
manifoldcf/branches/CONNECTORS-1196-2/connectors/rss/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/rss/tests/NavigationHSQLDBUI.java
 Mon Mar 20 06:19:08 2017
@@ -38,8 +38,6 @@ public class NavigationHSQLDBUI extends
   public void createConnectionsAndJob()
     throws Exception
   {
-    // Q: How can we control locale?  Is that even possible?  Will the test 
fail
-    // if the browser locale is wrong?
     testerInstance.start(SeleniumTester.BrowserType.CHROME, "en-US", 
"http://localhost:8346/mcf-crawler-ui/index.jsp";);
 
     //Login
@@ -163,16 +161,7 @@ public class NavigationHSQLDBUI extends
     testerInstance.acceptAlert();
 
     //Wait for the job to go away
-    testerInstance.navigateTo("Manage jobs");
-    testerInstance.waitForElementWithName("liststatuses");
-    // Q: We may want to add functionality like this directly to the tester 
class?
-    while (testerInstance.exists(By.cssSelector("span[jobid=\"" + jobID + 
"\"]")))
-    {
-      testerInstance.clickButton("Refresh");
-      testerInstance.waitForElementWithName("liststatuses");
-      //Let us wait for a second.
-      Thread.sleep(1000);
-    }
+    testerInstance.waitForJobDelete(jobID, 120);
 
     // Delete the repository connection
     testerInstance.navigateTo("List repository connections");

Modified: 
manifoldcf/branches/CONNECTORS-1196-2/framework/core/src/test/java/org/apache/manifoldcf/core/tests/SeleniumTester.java
URL: 
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1196-2/framework/core/src/test/java/org/apache/manifoldcf/core/tests/SeleniumTester.java?rev=1787687&r1=1787686&r2=1787687&view=diff
==============================================================================
--- 
manifoldcf/branches/CONNECTORS-1196-2/framework/core/src/test/java/org/apache/manifoldcf/core/tests/SeleniumTester.java
 (original)
+++ 
manifoldcf/branches/CONNECTORS-1196-2/framework/core/src/test/java/org/apache/manifoldcf/core/tests/SeleniumTester.java
 Mon Mar 20 06:19:08 2017
@@ -303,6 +303,29 @@ public class SeleniumTester {
         ((JavascriptExecutor) driver).executeScript("return 
arguments[0].innerHTML", element);
   }
 
+  // Macro operations for job management
+  
+  /** Wait for a specified job to go away after being deleted.
+  */
+  public void waitForJobDelete(final String jobID, int timeoutAmount)
+    throws Exception {
+    
+    navigateTo("Manage jobs");
+    waitForElementWithName("liststatuses");
+    while (exists(By.cssSelector("span[jobid=\"" + jobID + "\"]")))
+    {
+      if (timeoutAmount == 0)
+      {
+        throw new Exception("Timed out waiting for job "+jobID+" to go away");
+      }
+      clickButton("Refresh");
+      waitForElementWithName("liststatuses");
+      //Let us wait for a second.
+      Thread.sleep(1000L);
+      timeoutAmount--;
+    }
+  }
+  
   private long tick() {
     long TICKS_AT_EPOCH = 621355968000000000L;
     return System.currentTimeMillis() * 10000 + TICKS_AT_EPOCH;


Reply via email to