manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1788169 - /manifoldcf/branches/CONNECTORS-1196-2/connectors/wiki/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/wiki/tests/NavigationHSQLDBUI.java
Date Thu, 23 Mar 2017 00:51:03 GMT
Author: kwright
Date: Thu Mar 23 00:51:03 2017
New Revision: 1788169

URL: http://svn.apache.org/viewvc?rev=1788169&view=rev
Log:
Update wiki UI test

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

Modified: manifoldcf/branches/CONNECTORS-1196-2/connectors/wiki/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/wiki/tests/NavigationHSQLDBUI.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1196-2/connectors/wiki/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/wiki/tests/NavigationHSQLDBUI.java?rev=1788169&r1=1788168&r2=1788169&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1196-2/connectors/wiki/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/wiki/tests/NavigationHSQLDBUI.java
(original)
+++ manifoldcf/branches/CONNECTORS-1196-2/connectors/wiki/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/wiki/tests/NavigationHSQLDBUI.java
Thu Mar 23 00:51:03 2017
@@ -27,7 +27,7 @@ import java.io.*;
 import java.util.*;
 import org.junit.*;
 
-import org.apache.manifoldcf.core.tests.HTMLTester;
+import org.apache.manifoldcf.core.tests.SeleniumTester;
 
 /** Basic UI navigation tests */
 public class NavigationHSQLDBUI extends BaseUIHSQLDB
@@ -65,219 +65,135 @@ public class NavigationHSQLDBUI extends
       initialURLQueryResources,
       initialDocInfoQueryResources,
       namespaceResource);
-/*
-    testerInstance.newTest(Locale.US);
     
-    HTMLTester.Window window;
-    HTMLTester.Link link;
-    HTMLTester.Form form;
-    HTMLTester.Textarea textarea;
-    HTMLTester.Selectbox selectbox;
-    HTMLTester.Button button;
-    HTMLTester.Radiobutton radiobutton;
-    HTMLTester.Checkbox checkbox;
-    HTMLTester.Loop loop;
-    
-    window = testerInstance.openMainWindow("http://localhost:8346/mcf-crawler-ui/index.jsp");
-    
-    // Login
-    form = window.findForm(testerInstance.createStringDescription("loginform"));
-    textarea = form.findTextarea(testerInstance.createStringDescription("userID"));
-    textarea.setValue(testerInstance.createStringDescription("admin"));
-    textarea = form.findTextarea(testerInstance.createStringDescription("password"));
-    textarea.setValue(testerInstance.createStringDescription("admin"));
-    button = window.findButton(testerInstance.createStringDescription("Login"));
-    button.click();
-    window = testerInstance.findWindow(null);
-
-    // Define an output connection via the UI
-    link = window.findLink(testerInstance.createStringDescription("List output connections"));
-    link.click();
-    window = testerInstance.findWindow(null);
-    link = window.findLink(testerInstance.createStringDescription("Add an output connection"));
-    link.click();
+    testerInstance.start(SeleniumTester.BrowserType.CHROME, "en-US", "http://localhost:8346/mcf-crawler-ui/index.jsp");
+
+    //Login
+    testerInstance.waitForElementWithName("loginform");
+    testerInstance.setValue("userID","admin");
+    testerInstance.setValue("password","admin");
+    testerInstance.clickButton("Login");
+    testerInstance.verifyHeader("Welcome to Apache ManifoldCF™");
+    testerInstance.navigateTo("List output connections");
+    testerInstance.clickButton("Add a new output connection");
+
     // Fill in a name
-    window = testerInstance.findWindow(null);
-    form = window.findForm(testerInstance.createStringDescription("editconnection"));
-    textarea = form.findTextarea(testerInstance.createStringDescription("connname"));
-    textarea.setValue(testerInstance.createStringDescription("MyOutputConnection"));
-    link = window.findLink(testerInstance.createStringDescription("Type tab"));
-    link.click();
+    testerInstance.waitForElementWithName("connname");
+    testerInstance.setValue("connname","MyOutputConnection");
+
+    //Goto to Type tab
+    testerInstance.clickTab("Type");
+
     // Select a type
-    window = testerInstance.findWindow(null);
-    form = window.findForm(testerInstance.createStringDescription("editconnection"));
-    selectbox = form.findSelectbox(testerInstance.createStringDescription("classname"));
-    selectbox.selectValue(testerInstance.createStringDescription("org.apache.manifoldcf.agents.tests.TestingOutputConnector"));
-    button = window.findButton(testerInstance.createStringDescription("Continue to next page"));
-    button.click();
-    // Visit the Throttling tab
-    window = testerInstance.findWindow(null);
-    link = window.findLink(testerInstance.createStringDescription("Throttling tab"));
-    link.click();
-    // Go back to the Name tab
-    window = testerInstance.findWindow(null);
-    link = window.findLink(testerInstance.createStringDescription("Name tab"));
-    link.click();
+    testerInstance.waitForElementWithName("classname");
+    testerInstance.selectValue("classname","org.apache.manifoldcf.agents.tests.TestingOutputConnector");
+    testerInstance.clickButton("Continue");
+
     // Now save the connection.
-    window = testerInstance.findWindow(null);
-    button = window.findButton(testerInstance.createStringDescription("Save this output connection"));
-    button.click();
-    
+    testerInstance.clickButton("Save");
+    testerInstance.verifyThereIsNoError();
+
     // Define a repository connection via the UI
-    window = testerInstance.findWindow(null);
-    link = window.findLink(testerInstance.createStringDescription("List repository connections"));
-    link.click();
-    window = testerInstance.findWindow(null);
-    link = window.findLink(testerInstance.createStringDescription("Add a connection"));
-    link.click();
-    // Fill in a name
-    window = testerInstance.findWindow(null);
-    form = window.findForm(testerInstance.createStringDescription("editconnection"));
-    textarea = form.findTextarea(testerInstance.createStringDescription("connname"));
-    textarea.setValue(testerInstance.createStringDescription("MyRepositoryConnection"));
-    link = window.findLink(testerInstance.createStringDescription("Type tab"));
-    link.click();
+    testerInstance.navigateTo("List repository connections");
+    testerInstance.clickButton("Add new connection");
+
+    testerInstance.waitForElementWithName("connname");
+    testerInstance.setValue("connname","MyRepositoryConnection");
+
     // Select a type
-    window = testerInstance.findWindow(null);
-    form = window.findForm(testerInstance.createStringDescription("editconnection"));
-    selectbox = form.findSelectbox(testerInstance.createStringDescription("classname"));
-    selectbox.selectValue(testerInstance.createStringDescription("org.apache.manifoldcf.crawler.connectors.wiki.WikiConnector"));
-    button = window.findButton(testerInstance.createStringDescription("Continue to next page"));
-    button.click();
+    testerInstance.clickTab("Type");
+    testerInstance.selectValue("classname","org.apache.manifoldcf.crawler.connectors.wiki.WikiConnector");
+    testerInstance.clickButton("Continue");
+
     // Visit the Throttling tab
-    window = testerInstance.findWindow(null);
-    link = window.findLink(testerInstance.createStringDescription("Throttling tab"));
-    link.click();
+    testerInstance.clickTab("Throttling");
+
     // Visit the rest of the tabs - Email first
-    window = testerInstance.findWindow(null);
-    link = window.findLink(testerInstance.createStringDescription("Email tab"));
-    link.click();
-    window = testerInstance.findWindow(null);
-    form = window.findForm(testerInstance.createStringDescription("editconnection"));
-    textarea = form.findTextarea(testerInstance.createStringDescription("email"));
-    textarea.setValue(testerInstance.createStringDescription("foo@bar.com"));
+    testerInstance.clickTab("Email");
+    testerInstance.setValue("email", "foo@bar.com");
+    
     // Visit the Server tab
-    link = window.findLink(testerInstance.createStringDescription("Server tab"));
-    link.click();
-    window = testerInstance.findWindow(null);
-    form = window.findForm(testerInstance.createStringDescription("editconnection"));
-    // Fill in the server name
-    textarea = form.findTextarea(testerInstance.createStringDescription("servername"));
-    textarea.setValue(testerInstance.createStringDescription("localhost"));
-    // Fill in the port
-    textarea = form.findTextarea(testerInstance.createStringDescription("serverport"));
-    textarea.setValue(testerInstance.createStringDescription("8089"));
-    // Go back to the Name tab
-    link = window.findLink(testerInstance.createStringDescription("Name tab"));
-    link.click();
-    // Now save the connection.
-    window = testerInstance.findWindow(null);
-    button = window.findButton(testerInstance.createStringDescription("Save this connection"));
-    button.click();
+    testerInstance.clickTab("Server");
+    testerInstance.setValue("servername", "localhost");
+    testerInstance.setValue("serverport", "8089");
+
+    // Save
+    testerInstance.clickButton("Save");
+    testerInstance.verifyThereIsNoError();
     // Look for "connection working"
-    window = testerInstance.findWindow(null);
-    window.checkMatch(testerInstance.createStringDescription("Connection working"));
-    
+    final String pageSource = testerInstance.getRenderedSource();
+    if (pageSource.indexOf("Connection working") == -1)
+    {
+      throw new Exception("Connection working message not there");
+    }
+    //window = testerInstance.findWindow(null);
+    //window.checkMatch(testerInstance.createStringDescription("Connection working"));
+
     // Create a job
-    link = window.findLink(testerInstance.createStringDescription("List jobs"));
-    link.click();
-    // Add a job
-    window = testerInstance.findWindow(null);
-    link = window.findLink(testerInstance.createStringDescription("Add a job"));
-    link.click();
-    // Fill in a name
-    window = testerInstance.findWindow(null);
-    form = window.findForm(testerInstance.createStringDescription("editjob"));
-    textarea = form.findTextarea(testerInstance.createStringDescription("description"));
-    textarea.setValue(testerInstance.createStringDescription("MyJob"));
-    link = window.findLink(testerInstance.createStringDescription("Connection tab"));
-    link.click();
+    testerInstance.navigateTo("List jobs");
+    //Add a job
+    testerInstance.clickButton("Add a new job");
+    testerInstance.waitForElementWithName("description");
+    //Fill in a name
+    testerInstance.setValue("description","MyJob");
+    testerInstance.clickTab("Connection");
+
     // Select the connections
-    window = testerInstance.findWindow(null);
-    form = window.findForm(testerInstance.createStringDescription("editjob"));
-    selectbox = form.findSelectbox(testerInstance.createStringDescription("output_connectionname"));
-    selectbox.selectValue(testerInstance.createStringDescription("MyOutputConnection"));
-    selectbox = form.findSelectbox(testerInstance.createStringDescription("output_precedent"));
-    selectbox.selectValue(testerInstance.createStringDescription("-1"));
-    button = window.findButton(testerInstance.createStringDescription("Add an output"));
-    button.click();
-    window = testerInstance.findWindow(null);
-    form = window.findForm(testerInstance.createStringDescription("editjob"));
-    selectbox = form.findSelectbox(testerInstance.createStringDescription("connectionname"));
-    selectbox.selectValue(testerInstance.createStringDescription("MyRepositoryConnection"));
-    button = window.findButton(testerInstance.createStringDescription("Continue to next screen"));
-    button.click();
+    testerInstance.selectValue("output_connectionname","MyOutputConnection");
+    testerInstance.selectValue("output_precedent","-1");
+    testerInstance.clickButton("Add output",true);
+    testerInstance.waitForElementWithName("connectionname");
+    testerInstance.selectValue("connectionname","MyRepositoryConnection");
+    
+    testerInstance.clickButton("Continue");
+
     // Visit all the tabs.  Scheduling tab first
-    window = testerInstance.findWindow(null);
-    link = window.findLink(testerInstance.createStringDescription("Scheduling tab"));
-    link.click();
-    window = testerInstance.findWindow(null);
-    form = window.findForm(testerInstance.createStringDescription("editjob"));
-    selectbox = form.findSelectbox(testerInstance.createStringDescription("dayofweek"));
-    selectbox.selectValue(testerInstance.createStringDescription("0"));
-    selectbox = form.findSelectbox(testerInstance.createStringDescription("hourofday"));
-    selectbox.selectValue(testerInstance.createStringDescription("1"));
-    selectbox = form.findSelectbox(testerInstance.createStringDescription("minutesofhour"));
-    selectbox.selectValue(testerInstance.createStringDescription("30"));
-    selectbox = form.findSelectbox(testerInstance.createStringDescription("monthofyear"));
-    selectbox.selectValue(testerInstance.createStringDescription("11"));
-    selectbox = form.findSelectbox(testerInstance.createStringDescription("dayofmonth"));
-    selectbox.selectValue(testerInstance.createStringDescription("none"));
-    textarea = form.findTextarea(testerInstance.createStringDescription("duration"));
-    textarea.setValue(testerInstance.createStringDescription("120"));
-    button = window.findButton(testerInstance.createStringDescription("Add new schedule record"));
-    button.click();
-    window = testerInstance.findWindow(null);
-    // The Namespace and Titles tab
-    link = window.findLink(testerInstance.createStringDescription("Namespace and Titles tab"));
-    link.click();
-    window = testerInstance.findWindow(null);
-    form = window.findForm(testerInstance.createStringDescription("editjob"));
-    // Look for the 'add' button
-    button = window.findButton(testerInstance.createStringDescription("Add namespace/prefix"));
-    button.click();
-    window = testerInstance.findWindow(null);
+    testerInstance.clickTab("Scheduling");
+    testerInstance.selectValue("dayofweek","0");
+    testerInstance.selectValue("hourofday","1");
+    testerInstance.selectValue("minutesofhour","30");
+    testerInstance.selectValue("monthofyear","11");
+    testerInstance.selectValue("dayofmonth","none");
+    testerInstance.setValue("duration","120");
+    testerInstance.clickButton("Add Scheduled Time",true);
+    testerInstance.waitForElementWithName("editjob");
 
-    // Save the job
-    button = window.findButton(testerInstance.createStringDescription("Save this job"));
-    button.click();
+    // The Namespace and Titles tab
+    testerInstance.clickTab("Namespace and Titles");
+    testerInstance.clickButton("Add", true);
 
-    // Delete the job
-    window = testerInstance.findWindow(null);
-    HTMLTester.StringDescription jobID = window.findMatch(testerInstance.createStringDescription("<!--jobid=(.*?)-->"),0);
-    testerInstance.printValue(jobID);
-    link = window.findLink(testerInstance.createStringDescription("Delete this job"));
-    link.click();
+    // Go back to the Name tab
+    testerInstance.clickTab("Name");
     
-    // Wait for the job to go away
-    loop = testerInstance.beginLoop(120);
-    window = testerInstance.findWindow(null);
-    link = window.findLink(testerInstance.createStringDescription("Manage jobs"));
-    link.click();
-    window = testerInstance.findWindow(null);
-    HTMLTester.StringDescription isJobNotPresent = window.isNotPresent(jobID);
-    testerInstance.printValue(isJobNotPresent);
-    loop.breakWhenTrue(isJobNotPresent);
-    loop.endLoop();
+    // Save the job
+    testerInstance.clickButton("Save");
+    testerInstance.verifyThereIsNoError();
     
+    testerInstance.waitForPresenceById("job");
+    String jobID = testerInstance.getAttributeValueById("job","jobid");
+
+    //Navigate to List Jobs
+    testerInstance.navigateTo("List jobs");
+    testerInstance.waitForElementWithName("listjobs");
+
+    //Delete the job
+    testerInstance.clickButtonByTitle("Delete job " + jobID);
+    testerInstance.acceptAlert();
+    testerInstance.verifyThereIsNoError();
+
+    //Wait for the job to go away
+    testerInstance.waitForJobDeleteEN(jobID, 120);
+
     // Delete the repository connection
-    window = testerInstance.findWindow(null);
-    link = window.findLink(testerInstance.createStringDescription("List repository connections"));
-    link.click();
-    window = testerInstance.findWindow(null);
-    link = window.findLink(testerInstance.createStringDescription("Delete MyRepositoryConnection"));
-    link.click();
-    
+    testerInstance.navigateTo("List repository connections");
+    testerInstance.clickButtonByTitle("Delete MyRepositoryConnection");
+    testerInstance.acceptAlert();
+
     // Delete the output connection
-    window = testerInstance.findWindow(null);
-    link = window.findLink(testerInstance.createStringDescription("List output connections"));
-    link.click();
-    window = testerInstance.findWindow(null);
-    link = window.findLink(testerInstance.createStringDescription("Delete MyOutputConnection"));
-    link.click();
-    
-    testerInstance.executeTest();
-*/
+    testerInstance.navigateTo("List output connections");
+    testerInstance.clickButtonByTitle("Delete MyOutputConnection");
+    testerInstance.acceptAlert();
+
   }
   
 }



Mime
View raw message