You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2012/07/13 22:30:42 UTC

svn commit: r1361380 - in /myfaces/tobago/trunk/tobago-example/tobago-example-test: ./ src/main/java/org/apache/myfaces/tobago/example/test/ src/main/webapp/WEB-INF/ src/main/webapp/tc/popup/ src/main/webapp/tc/tree/ src/test/java/org/apache/myfaces/to...

Author: lofwyr
Date: Fri Jul 13 20:30:42 2012
New Revision: 1361380

URL: http://svn.apache.org/viewvc?rev=1361380&view=rev
Log:
TOBAGO-1174: Easier handling of Selenium tests

Added:
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/KillSession.java
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/popup/popup-bug-tobago-1091.selenium.html
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-select.selenium.html
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumScript.java
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumScriptItem.java
Modified:
    myfaces/tobago/trunk/tobago-example/tobago-example-test/pom.xml
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/TestPageFilter.java
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/web.xml
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-select.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/AutomaticSeleniumTest.java
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumTest.java

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/pom.xml?rev=1361380&r1=1361379&r2=1361380&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/pom.xml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/pom.xml Fri Jul 13 20:30:42 2012
@@ -210,6 +210,11 @@
       <classifier>tests</classifier>
       <scope>test</scope>
     </dependency>
+    <dependency>
+    	<groupId>net.sourceforge.nekohtml</groupId>
+    	<artifactId>nekohtml</artifactId>
+    	<version>1.9.15</version>
+    </dependency>
   </dependencies>
   <profiles>
     <profile>

Added: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/KillSession.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/KillSession.java?rev=1361380&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/KillSession.java (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/KillSession.java Fri Jul 13 20:30:42 2012
@@ -0,0 +1,38 @@
+package org.apache.myfaces.tobago.example.test;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.io.IOException;
+
+public class KillSession extends HttpServlet {
+
+  @Override
+  protected void doGet(HttpServletRequest request, HttpServletResponse response)
+      throws ServletException, IOException {
+    final HttpSession session = request.getSession(false);
+    if (session != null) {
+       session.invalidate();
+    }
+    response.getOutputStream().write("session killed".getBytes());
+  }
+}

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/TestPageFilter.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/TestPageFilter.java?rev=1361380&r1=1361379&r2=1361380&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/TestPageFilter.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/TestPageFilter.java Fri Jul 13 20:30:42 2012
@@ -37,7 +37,8 @@ public class TestPageFilter {
       "/WEB-INF.*",
       "/org/.*",
       "/src/.*",
-      ".*/\\.svn/.*"
+      ".*/\\.svn/.*",
+      ".*\\.selenium\\.html"
   ));
 
   /**

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/web.xml?rev=1361380&r1=1361379&r2=1361380&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/web.xml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/web.xml Fri Jul 13 20:30:42 2012
@@ -66,6 +66,11 @@
     <servlet-class>org.apache.myfaces.tobago.servlet.ResourceServlet</servlet-class>
   </servlet>
 
+  <servlet>
+    <servlet-name>KillSessionServlet</servlet-name>
+    <servlet-class>org.apache.myfaces.tobago.example.test.KillSession</servlet-class>
+  </servlet>
+
   <servlet-mapping>
     <servlet-name>FacesServlet</servlet-name>
     <url-pattern>/faces/*</url-pattern>
@@ -76,6 +81,11 @@
     <url-pattern>/org/apache/myfaces/tobago/renderkit/*</url-pattern>
   </servlet-mapping>
 
+  <servlet-mapping>
+    <servlet-name>KillSessionServlet</servlet-name>
+    <url-pattern>/KillSession</url-pattern>
+  </servlet-mapping>
+
   <filter>
     <filter-name>MyFacesExtensionsFilter</filter-name>
     <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>

Added: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/popup/popup-bug-tobago-1091.selenium.html
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/popup/popup-bug-tobago-1091.selenium.html?rev=1361380&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/popup/popup-bug-tobago-1091.selenium.html (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/popup/popup-bug-tobago-1091.selenium.html Fri Jul 13 20:30:42 2012
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="http://localhost:8080/" />
+<title>Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/faces/tc/popup/popup-bug-tobago-1091.xhtml</td>
+	<td></td>
+</tr>
+<tr>
+	<td>verifyValue</td>
+	<td>id=page:check</td>
+	<td>on</td>
+</tr>
+<tr>
+	<td>clickAndWait</td>
+	<td>id=page:open</td>
+	<td></td>
+</tr>
+<tr>
+	<td>clickAndWait</td>
+	<td>id=page:popup:close</td>
+	<td></td>
+</tr>
+<tr>
+	<td>verifyValue</td>
+	<td>id=page:check</td>
+	<td>on</td>
+</tr>
+</tbody></table>
+</body>
+</html>

Added: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-select.selenium.html
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-select.selenium.html?rev=1361380&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-select.selenium.html (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-select.selenium.html Fri Jul 13 20:30:42 2012
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="http://localhost:8080/" />
+<title>Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr >
+	<td>open</td>
+	<td>/faces/tc/tree/tree-select.xhtml</td>
+	<td></td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>id=page:tree:5:select</td>
+	<td></td>
+</tr>
+<tr>
+	<td>verifyValue</td>
+	<td>id=page:tree:5:select</td>
+	<td>on</td>
+</tr>
+<tr>
+	<td>clickAndWait</td>
+	<td>id=page:cancel</td>
+	<td></td>
+</tr>
+<tr>
+	<td>verifyValue</td>
+	<td>id=page:tree:5:select</td>
+	<td>off</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>id=page:tree:5:select</td>
+	<td></td>
+</tr>
+<tr>
+	<td>clickAndWait</td>
+	<td>id=page:submit</td>
+	<td></td>
+</tr>
+<tr>
+	<td>verifyValue</td>
+	<td>id=page:tree:5:select</td>
+	<td>on</td>
+</tr>
+<tr>
+	<td>clickAndWait</td>
+	<td>id=page:cancel</td>
+	<td></td>
+</tr>
+<tr>
+	<td>verifyValue</td>
+	<td>id=page:tree:5:select</td>
+	<td>off</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>id=page:tree:5:select</td>
+	<td></td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>id=page:in</td>
+	<td>some text</td>
+</tr>
+<tr>
+	<td>clickAndWait</td>
+	<td>id=page:submit</td>
+	<td></td>
+</tr>
+<tr>
+	<td>verifyValue</td>
+	<td>id=page:tree:5:select</td>
+	<td>on</td>
+</tr>
+<tr>
+	<td>clickAndWait</td>
+	<td>id=page:cancel</td>
+	<td></td>
+</tr>
+<tr>
+	<td>verifyValue</td>
+	<td>id=page:tree:5:select</td>
+	<td>on</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-select.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-select.xhtml?rev=1361380&r1=1361379&r2=1361380&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-select.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-select.xhtml Fri Jul 13 20:30:42 2012
@@ -19,10 +19,9 @@
 <f:view
     xmlns:tc="http://myfaces.apache.org/tobago/component"
     xmlns:tx="http://myfaces.apache.org/tobago/extension"
-    xmlns:ui="http://java.sun.com/jsf/facelets"
     xmlns:f="http://java.sun.com/jsf/core">
 
-  <tc:page>
+  <tc:page id="page">
     <tc:gridLayoutConstraint width="600px" height="300px"/>
     <f:facet name="layout">
       <tc:gridLayout rows="*;auto;auto"/>
@@ -35,8 +34,15 @@
       </tc:treeNode>
     </tc:tree>
 
-    <tx:in label="Required" required="true"/>
-    <tc:button label="Submit"/>
+    <tx:in fieldId="in" label="Required" required="true"/>
+    <tc:panel>
+      <f:facet name="layout">
+        <tc:gridLayout columns="*;auto;auto"/>
+      </f:facet>
+      <tc:panel/>
+      <tc:button id="cancel" label="Cancel" immediate="true"/>
+      <tc:button id="submit" label="Submit"/>
+    </tc:panel>
 
   </tc:page>
 </f:view>

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/AutomaticSeleniumTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/AutomaticSeleniumTest.java?rev=1361380&r1=1361379&r2=1361380&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/AutomaticSeleniumTest.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/AutomaticSeleniumTest.java Fri Jul 13 20:30:42 2012
@@ -20,8 +20,13 @@ package org.apache.myfaces.tobago.exampl
 import org.apache.myfaces.tobago.util.Parameterized;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xml.sax.SAXException;
 
+import javax.xml.xpath.XPathExpressionException;
 import java.io.File;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -30,6 +35,8 @@ import java.util.List;
 @RunWith(Parameterized.class)
 public class AutomaticSeleniumTest extends SeleniumTest {
 
+  private static final Logger LOG = LoggerFactory.getLogger(AutomaticSeleniumTest.class);
+
   private static final String MAVEN_TARGET = "target/tobago-example-test";
 
   private String url;
@@ -39,9 +46,23 @@ public class AutomaticSeleniumTest exten
   }
 
   @Test
-  public void testPageConsistency() {
-    getSelenium().open(url);
-    checkPage();
+  public void testPageConsistency() throws Exception {
+    SeleniumScript script = getSeleniumScript(url);
+
+    getCommandProcessor().doCommand("open", new String[] {"http://localhost:8080/" + "KillSession", ""});
+
+    for (SeleniumScriptItem item : script.getItems()) {
+      LOG.info("Calling: " + item);
+      getCommandProcessor().doCommand(item.getCommand(), item.getParameters());
+      checkPage();
+    }
+  }
+
+  private SeleniumScript getSeleniumScript(String url) throws XPathExpressionException, SAXException, IOException {
+    String seleniumUrl = url.substring("/faces/".length());
+    seleniumUrl = seleniumUrl.substring(0, seleniumUrl.lastIndexOf("."));
+    seleniumUrl = "http://localhost:8080/" + seleniumUrl + ".selenium.html";
+    return new SeleniumScript(seleniumUrl, url);
   }
 
   @Parameterized.Parameters

Added: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumScript.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumScript.java?rev=1361380&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumScript.java (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumScript.java Fri Jul 13 20:30:42 2012
@@ -0,0 +1,101 @@
+package org.apache.myfaces.tobago.example.test;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.html.dom.HTMLDocumentImpl;
+import org.cyberneko.html.parsers.DOMFragmentParser;
+import org.junit.Assert;
+import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.html.HTMLDocument;
+import org.xml.sax.SAXException;
+
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpression;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+public class SeleniumScript {
+
+  private static final XPathFactory XPATH_FACTORY;
+  private static final XPathExpression XPATH_EXPRESSION;
+  private static final XPathExpression TR_XPATH;
+  private static final XPathExpression TD_XPATH;
+
+  private List<SeleniumScriptItem> items = new ArrayList<SeleniumScriptItem>();
+
+  static {
+    try {
+      XPATH_FACTORY = XPathFactory.newInstance();
+      XPATH_EXPRESSION = XPATH_FACTORY.newXPath().compile("//TABLE/TBODY");
+      TR_XPATH = XPATH_FACTORY.newXPath().compile("TR");
+      TD_XPATH = XPATH_FACTORY.newXPath().compile("TD");
+    } catch (XPathExpressionException e) {
+      throw new RuntimeException(e);
+    }
+  }
+
+  public SeleniumScript(String scriptUrl, String url) throws IOException, SAXException, XPathExpressionException {
+    DOMFragmentParser parser = new DOMFragmentParser();
+    HTMLDocument document = new HTMLDocumentImpl();
+    DocumentFragment fragment = document.createDocumentFragment();
+    try {
+      parser.parse(scriptUrl, fragment);
+      addSeleniumItems(fragment, url);
+    } catch (FileNotFoundException e) {
+      // using default
+      items.add(new SeleniumScriptItem("open", url, ""));
+    }
+  }
+
+  private void addSeleniumItems(DocumentFragment fragment, String url) throws XPathExpressionException {
+
+    final Object table = XPATH_EXPRESSION.evaluate(fragment, XPathConstants.NODE);
+    final NodeList trList = (NodeList) TR_XPATH.evaluate(table, XPathConstants.NODESET);
+
+    for (int i = 0; i < trList.getLength(); i++) {
+      final Node tr = trList.item(i);
+      final NodeList tdList = (NodeList) TD_XPATH.evaluate(tr, XPathConstants.NODESET);
+
+      Assert.assertEquals(3, tdList.getLength());
+
+      String command = tdList.item(0).getTextContent();
+      String parameter1 = tdList.item(1).getTextContent();
+      String parameter2 = tdList.item(2).getTextContent();
+      if (command.equals("open")) {
+        // for open commands, use the filename, not the name in the script,
+        // because we need the script for *.jspx and *.xhtml
+        final String realPrefix = url.substring(0, url.lastIndexOf("."));
+        final String scriptPrefix = parameter1.substring(0, parameter1.lastIndexOf("."));
+        Assert.assertEquals("Is the url in the script correct?", scriptPrefix, realPrefix);
+        parameter1 = url;
+      }
+
+      items.add(new SeleniumScriptItem(command, parameter1, parameter2));
+    }
+  }
+
+  public List<SeleniumScriptItem> getItems() {
+    return items;
+  }
+}

Added: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumScriptItem.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumScriptItem.java?rev=1361380&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumScriptItem.java (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumScriptItem.java Fri Jul 13 20:30:42 2012
@@ -0,0 +1,47 @@
+package org.apache.myfaces.tobago.example.test;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.Arrays;
+
+public class SeleniumScriptItem {
+
+  private String command;
+  private String[] parameters;
+
+  public SeleniumScriptItem(String command, String parameter1, String parameter2) {
+    this.command = command;
+    this.parameters = new String[] {parameter1, parameter2};
+  }
+
+  public String getCommand() {
+    return command;
+  }
+
+  public String[] getParameters() {
+    return parameters;
+  }
+
+  @Override
+  public String toString() {
+    return "SeleniumScriptItem{" +
+        "command='" + command + '\'' +
+        ", parameters=" + (parameters == null ? null : Arrays.asList(parameters)) +
+        '}';
+  }
+}

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumTest.java?rev=1361380&r1=1361379&r2=1361380&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumTest.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumTest.java Fri Jul 13 20:30:42 2012
@@ -17,7 +17,9 @@ package org.apache.myfaces.tobago.exampl
  * limitations under the License.
  */
 
+import com.thoughtworks.selenium.CommandProcessor;
 import com.thoughtworks.selenium.DefaultSelenium;
+import com.thoughtworks.selenium.HttpCommandProcessor;
 import com.thoughtworks.selenium.SeleniumException;
 import org.junit.AfterClass;
 import org.junit.Assert;
@@ -33,25 +35,35 @@ public abstract class SeleniumTest {
   public static final String HAS_ERROR_SEVERITY = "has error severity";
   public static final String IS_BROKEN = "is broken";
 
+  @Deprecated
   private static DefaultSelenium selenium;
+  private static CommandProcessor commandProcessor;
 
   @BeforeClass
   public static void setUp() throws Exception {
     selenium = createSeleniumClient();
     selenium.start();
+//todo alternative   commandProcessor.start();
   }
 
   @AfterClass
   public static void tearDown() throws Exception {
     selenium.stop();
+//todo alternative   commandProcessor.stop();
   }
 
+  @Deprecated
   protected DefaultSelenium getSelenium() {
     return selenium;
   }
 
+  protected CommandProcessor getCommandProcessor() {
+    return commandProcessor;
+  }
+
   protected static DefaultSelenium createSeleniumClient() throws Exception {
-    return new DefaultSelenium("localhost", 4444, "*firefox", "http://localhost:8080/");
+    commandProcessor = new HttpCommandProcessor("localhost", 4444, "*firefox", "http://localhost:8080/");
+    return new DefaultSelenium(commandProcessor);
   }
 
   protected void waitForAjaxComplete() {