Permalink
Browse files

more tests updated to work on mobile

  • Loading branch information...
1 parent 2319a1f commit f0c3922f6c64b7907a6dcc272f807babe3b06b0b @papousek papousek committed Mar 25, 2013
@@ -27,6 +27,8 @@
import java.util.logging.Logger;
import org.jboss.arquillian.ajocado.utils.URLUtils;
import org.jboss.arquillian.drone.api.annotation.Drone;
+import org.jboss.arquillian.graphene.Graphene;
+import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;
@@ -50,8 +52,17 @@ public void loadPage() {
String addition = getAdditionToContextRoot();
this.contextRoot = getContextRoot();
-
+ ShowcaseLayout layout = loadLayout();
+ if (layout == ShowcaseLayout.MOBILE) {
+ webDriver.get(URLUtils.buildUrl(this.contextRoot, "mobile/").toExternalForm()); // because of '#' in URLs
+ }
webDriver.get(URLUtils.buildUrl(contextRoot, addition).toExternalForm());
+ if (layout == ShowcaseLayout.MOBILE) {
+ Graphene.waitAjax()
+ .until()
+ .element(By.className("sourceView"))
+ .is().visible();
+ }
}
@Override
@@ -37,7 +37,7 @@
@Page
private SimpleTablePage page;
- @Test
+ @Test
public void testInit() {
assertEquals(page.getSanJoseHotels(), "$224.00");
assertEquals(page.getSanJoseMeals(), "$65.02");
@@ -21,6 +21,7 @@
*******************************************************************************/
package org.richfaces.tests.showcase.dataTable.page;
+import org.jboss.arquillian.graphene.Graphene;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
@@ -31,11 +32,11 @@
public class SimpleTablePage {
// Subtables
- @FindBy(xpath = "//*[@class='example-cnt']//tbody[@class='rf-cst'][1]/tr[4]")
+ @FindBy(xpath = "//tbody[@class='rf-cst'][1]/tr[4]")
private WebElement sanJoseSubtable;
- @FindBy(xpath = "//*[@class='example-cnt']//tbody[@class='rf-cst'][2]/tr[4]")
+ @FindBy(xpath = "//tbody[@class='rf-cst'][2]/tr[4]")
private WebElement seattleSubtable;
- @FindBy(xpath = "//*[@class='example-cnt']//tfoot/tr")
+ @FindBy(xpath = "//tfoot/tr")
private WebElement footSubtable;
public String getSanJoseHotels() {
@@ -32,7 +32,7 @@
*/
public class ListsPage {
- @FindBy(id = "list")
+ @FindBy(xpath="//*[substring(@id, string-length(@id) - 3) = 'list']")
public RichFacesList list;
@FindBy(jquery = "a:contains('ordered')")
@@ -44,6 +44,7 @@
@Test
public void testFirstCorrectInput() {
page.firstInput.click();
+ page.firstInput.clear();
page.firstInput.sendKeys(CORRECT);
Graphene.waitAjax()
.until("After typing a correct value into the first input field no output text should be present.")
@@ -64,6 +65,7 @@ public void testFirstCorrectInput() {
@Test
public void testFirstWrongInput() {
page.firstInput.click();
+ page.firstInput.clear();
page.firstInput.sendKeys(WRONG);
Graphene.waitAjax()
.until("After typing a wrong value into the first input field no output text should be present.")
@@ -87,6 +89,7 @@ public void testFirstWrongInput() {
@Test
public void testSecondCorrectInput() {
page.secondInput.click();
+ page.secondInput.clear();
page.secondInput.sendKeys(CORRECT);
Graphene.waitAjax()
.until("After typing a correct value into the second input field, the output text should be present.")
@@ -102,6 +105,7 @@ public void testSecondCorrectInput() {
@Test
public void testSecondWrongInput() throws InterruptedException {
page.secondInput.click();
+ page.secondInput.clear();
page.secondInput.sendKeys(WRONG);
Graphene.waitAjax()
.until("After typing a wrong value into the second input field, an error message should be present.")
@@ -27,6 +27,7 @@
import org.richfaces.tests.showcase.AbstractWebDriverTest;
import org.richfaces.tests.showcase.region.page.RegionPage;
import static org.testng.Assert.assertEquals;
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
@@ -21,6 +21,7 @@
*******************************************************************************/
package org.richfaces.tests.showcase.region.page;
+import org.jboss.arquillian.graphene.Graphene;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
@@ -29,25 +30,25 @@
*/
public class RegionPage {
- @FindBy(xpath = "//*[@class='example-cnt']//table[contains(@id, 'userInfoPanel1')]//td[contains(text(), 'User email')]/..//input")
+ @FindBy(xpath = "//table[contains(@id, 'userInfoPanel1')]//td[contains(text(), 'User email')]/..//input")
public WebElement brokenEmailInput;
- @FindBy(xpath = "//*[@class='example-cnt']//table[contains(@id, 'userInfoPanel1')]//td[contains(text(), 'User Name')]/..//input")
+ @FindBy(xpath = "//table[contains(@id, 'userInfoPanel1')]//td[contains(text(), 'User Name')]/..//input")
public WebElement brokenNameInput;
- @FindBy(xpath = "//*[@class='example-cnt']//table[contains(@id, 'echopanel1')]//td[text()='Entered email:']/../td[position()=2]")
+ @FindBy(xpath = "//table[contains(@id, 'echopanel1')]//td[text()='Entered email:']/../td[position()=2]")
public WebElement brokenEmailOutput;
- @FindBy(xpath = "//*[@class='example-cnt']//table[contains(@id, 'echopanel1')]//td[text()='Entered name:']/../td[position()=2]")
+ @FindBy(xpath = "//table[contains(@id, 'echopanel1')]//td[text()='Entered name:']/../td[position()=2]")
public WebElement brokenNameOutput;
- @FindBy(xpath = "//*[@class='example-cnt']//input[@type='submit'][@value='broken submit']")
+ @FindBy(xpath = "//input[@type='submit'][@value='broken submit']")
public WebElement brokenSubmit;
- @FindBy(xpath = "//*[@class='example-cnt']//th[contains(text(), 'User Info Panel with Region')]/../../..//td[contains(text(), 'User email')]/..//input")
+ @FindBy(xpath = "//th[contains(text(), 'User Info Panel with Region')]/../../..//td[contains(text(), 'User email')]/..//input")
public WebElement emailInput;
- @FindBy(xpath = "//*[@class='example-cnt']//th[contains(text(), 'User Info Panel with Region')]/../../..//td[contains(text(), 'User Name')]/..//input")
+ @FindBy(xpath = "//th[contains(text(), 'User Info Panel with Region')]/../../..//td[contains(text(), 'User Name')]/..//input")
public WebElement nameInput;
- @FindBy(xpath = "//*[@class='example-cnt']//table[contains(@id, 'echopanel2')]//td[text()='Entered email:']/../td[position()=2]")
+ @FindBy(xpath = "//table[contains(@id, 'echopanel2')]//td[text()='Entered email:']/../td[position()=2]")
public WebElement emailOutput;
- @FindBy(xpath = "//*[@class='example-cnt']//table[contains(@id, 'echopanel2')]//td[text()='Entered name:']/../td[position()=2]")
+ @FindBy(xpath = "//table[contains(@id, 'echopanel2')]//td[text()='Entered name:']/../td[position()=2]")
public WebElement nameOutput;
- @FindBy(xpath = "//*[@class='example-cnt']//input[@type='submit'][@value='submit']")
+ @FindBy(xpath = "//input[@type='submit'][@value='submit']")
public WebElement submit;
}
@@ -0,0 +1,125 @@
+<?xml version="1.0"?>
+<!-- JBoss, Home of Professional Open Source Copyright 2011, Red Hat, Inc. and individual contributors by the @authors tag. See the
+ copyright.txt in the distribution for a full listing of individual contributors. This is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1
+ of the License, or (at your option) any later version. This software is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this software;
+ if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF site:
+ http://www.fsf.org. -->
+<arquillian xmlns="http://jboss.com/arquillian" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
+
+ <engine>
+ <property name="maxTestClassesBeforeRestart">5</property>
+ <property name="deploymentExportPath">target/</property>
+ </engine>
+
+ <container qualifier="jbossas-managed-6">
+ <configuration>
+ <property name="javaVmArguments">-Xms1024m -Xmx1024m -XX:MaxPermSize=512m</property>
+ </configuration>
+ </container>
+
+ <container qualifier="jbossas-managed-7">
+ <configuration>
+ <property name="javaVmArguments">-Xms1024m -Xmx1024m -XX:MaxPermSize=512m</property>
+ <property name="serverConfig">standalone-preview.xml</property>
+ <property name="outputToConsole">false</property>
+ </configuration>
+ <protocol type="jmx-as7">
+ <property name="executionType">REMOTE</property>
+ </protocol>
+ </container>
+
+ <container qualifier="jbossas-managed-7-1">
+ <configuration>
+ <property name="javaVmArguments">-Xms1024m -Xmx1024m -XX:MaxPermSize=512m</property>
+ <property name="serverConfig">standalone-full.xml</property>
+ </configuration>
+ </container>
+
+ <container qualifier="jbossas-remote-7" default="true">
+ <protocol type="jmx-as7">
+ <property name="executionType">REMOTE</property>
+ </protocol>
+ </container>
+
+ <container qualifier="jbossas-remote-7-1">
+ </container>
+
+ <container qualifier="tomcat-managed-6">
+ <configuration>
+ <property name="javaVmArguments">-Xms1024m -Xmx1024m -XX:MaxPermSize=512m -Dcom.sun.management.jmxremote
+ -Dcom.sun.management.jmxremote.port=8089 -Djava.rmi.server.hostname=localhost
+ </property>
+ <property name="user">tomcat</property>
+ <property name="pass">tomcat</property>
+ </configuration>
+ </container>
+
+ <container qualifier="tomcat-managed-7">
+ <configuration>
+ <property name="javaVmArguments">-Xms1024m -Xmx1024m -XX:MaxPermSize=512m -Dcom.sun.management.jmxremote
+ -Dcom.sun.management.jmxremote.port=8089 -Djava.rmi.server.hostname=localhost
+ </property>
+ <property name="user">tomcat</property>
+ <property name="pass">tomcat</property>
+ </configuration>
+ </container>
+
+ <container qualifier="openshift">
+ <configuration>
+ <property name="namespace">${openshift.namespace}</property>
+ <property name="application">${openshift.application}</property>
+ <property name="sshUserName">${openshift.ssh.user}</property>
+ <property name="passphrase">${openshift.password}</property>
+ <property name="login">richfaces.qa.jenkins@gmail.com</property>
+ <property name="deploymentTimeoutInSeconds">240</property>
+ <property name="identityFile">${openshift.identity.file}</property>
+ <property name="disableStrictHostChecking">true</property>
+ </configuration>
+ </container>
+
+ <extension qualifier="selenium-server">
+ <property name="browserSessionReuse">true</property>
+ <property name="port">8444</property>
+ <!-- <property name="dontTouchLogging">true</property> -->
+ </extension>
+
+ <extension qualifier="graphene">
+ <property name="browser">*firefox</property>
+ <property name="seleniumTimeoutAjax">7000</property>
+ <property name="seleniumMaximize">true</property>
+ <property name="seleniumPort">8444</property>
+ <property name="seleniumHost">localhost</property>
+ </extension>
+
+ <extension qualifier="webdriver">
+ <property name="browserCapabilities">${browser.capabilities}</property>
+ <property name="remoteAddress">http://localhost:4444/wd/hub/</property>
+ <property name="javascriptEnabled">true</property>
+ </extension>
+
+ <extension qualifier="android">
+ <property name="home">${android.sdk.home}</property>
+ <property name="serialId">${android.serial}</property>
+ <property name="abi">armeabi-v7a</property>
+ <property name="verbose">true</property>
+ <property name="force">true</property>
+ <property name="apiLevel">16</property>
+ <property name="avdName">showcase-webdriver-ftest</property>
+ <property name="emulatorBootupTimeoutInSeconds">180</property>
+ <property name="skip">${android.skip}</property>
+ </extension>
+
+ <extension qualifier="android-drone">
+ <property name="androidServerApk">src/test/resources/android-server-${android.apk.version}.apk</property>
+ <property name="verbose">true</property>
+ <property name="webdriverPortHost">4444</property>
+ </extension>
+
+ <extension qalifier="screenRecorder">
+ </extension>
+
+</arquillian>
@@ -12,10 +12,23 @@
<packages>
<package name="org.richfaces.tests.showcase.commandButton" />
<package name="org.richfaces.tests.showcase.commandLink" />
+ <package name="org.richfaces.tests.showcase.componentControl" />
+ <package name="org.richfaces.tests.showcase.inplaceInput" />
+ <package name="org.richfaces.tests.showcase.list" />
+ <package name="org.richfaces.tests.showcase.log" />
+ <package name="org.richfaces.tests.showcase.mediaOutput" />
+ <package name="org.richfaces.tests.showcase.placeholder" />
+ <package name="org.richfaces.tests.showcase.region" />
+ <package name="org.richfaces.tests.showcase.repeat" />
+ <package name="org.richfaces.tests.showcase.select" />
</packages>
<classes>
<class name="org.richfaces.tests.showcase.ajax.TestAjax" />
+ <class name="org.richfaces.tests.showcase.dataScroller.TestSimpleScrolling" />
+ <class name="org.richfaces.tests.showcase.dataTable.TestSimpleTable" />
+ <class name="org.richfaces.tests.showcase.extendedDataTable.TestSimpleTable" />
+ <class name="org.richfaces.tests.showcase.param.TestParam" />
</classes>
</test>
</suite>
@@ -33,7 +33,7 @@
</packages>
<classes>
- <class name="org.richfaces.tests.showcase.outputPanel.TestSimple"/>
+ <class name="org.richfaces.tests.showcase.outputPanel.TestSimple"/>
</classes>
</test>
</suite>

0 comments on commit f0c3922

Please sign in to comment.