You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by de...@apache.org on 2016/05/15 14:48:29 UTC

svn commit: r1743906 - in /myfaces/tobago/trunk/tobago-example/tobago-example-demo: pom.xml src/test/java/org/apache/myfaces/tobago/example/demo/ArquillianTest.java src/test/resources/arquillian.xml

Author: deki
Date: Sun May 15 14:48:29 2016
New Revision: 1743906

URL: http://svn.apache.org/viewvc?rev=1743906&view=rev
Log:
TOBAGO-1473: draft for Arquillian test case

Added:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/test/java/org/apache/myfaces/tobago/example/demo/ArquillianTest.java
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/test/resources/arquillian.xml
Modified:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/pom.xml

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/pom.xml?rev=1743906&r1=1743905&r2=1743906&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/pom.xml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/pom.xml Sun May 15 14:48:29 2016
@@ -30,9 +30,16 @@
   <properties>
     <openwebbeans.version>1.1.7</openwebbeans.version>
     <deltaspike.version>1.2.1</deltaspike.version>
+    <arquillian.browser>phantomjs</arquillian.browser>
   </properties>
   <build>
     <finalName>tobago-example-demo</finalName>
+    <testResources>
+      <testResource>
+        <directory>src/test/resources</directory>
+        <filtering>true</filtering>
+      </testResource>
+    </testResources>
     <plugins>
       <plugin>
         <groupId>org.apache.myfaces.tobago</groupId>
@@ -90,9 +97,57 @@
         <dependencies>
         </dependencies>
       </plugin>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <excludes><!-- TODO define group for ArquillianTests and use excludeGroups -->
+            <exclude>**/ArquillianTest.java</exclude>
+          </excludes>
+        </configuration>
+      </plugin>
     </plugins>
   </build>
 
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.jboss.shrinkwrap.resolver</groupId>
+        <artifactId>shrinkwrap-resolver-bom</artifactId>
+        <version>2.2.2</version>
+        <scope>import</scope>
+        <type>pom</type>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.arquillian</groupId>
+        <artifactId>arquillian-bom</artifactId>
+        <version>1.1.11.Final</version>
+        <scope>import</scope>
+        <type>pom</type>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.arquillian.selenium</groupId>
+        <artifactId>selenium-bom</artifactId>
+        <version>2.53.0</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.arquillian.extension</groupId>
+        <artifactId>arquillian-drone-bom</artifactId>
+        <version>2.0.0.Final</version>
+        <scope>import</scope>
+        <type>pom</type>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.arquillian.graphene</groupId>
+        <artifactId>graphene-webdriver</artifactId>
+        <version>2.1.0.CR1</version>
+        <type>pom</type>
+        <scope>test</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
   <dependencies>
 
     <!-- Tobago -->
@@ -143,6 +198,22 @@
       <version>4.3.2.Final</version>
     </dependency>
 
+    <dependency>
+      <groupId>org.jboss.arquillian.junit</groupId>
+      <artifactId>arquillian-junit-container</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.shrinkwrap.resolver</groupId>
+      <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.arquillian.graphene</groupId>
+      <artifactId>graphene-webdriver</artifactId>
+      <type>pom</type>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <profiles>
@@ -555,6 +626,34 @@
           </plugin>
         </plugins>
       </build>
+      <dependencies>
+        <dependency>
+          <groupId>org.jboss.arquillian.container</groupId>
+          <artifactId>arquillian-tomcat-embedded-8</artifactId>
+          <version>1.0.0.CR7</version>
+          <scope>test</scope>
+        </dependency>
+      </dependencies>
+    </profile>
+
+    <profile>
+      <id>tomee</id>
+      <dependencies>
+        <dependency>
+          <groupId>org.apache.tomee</groupId>
+          <artifactId>apache-tomee</artifactId>
+          <version>7.0.0-M3</version>
+          <classifier>webprofile</classifier>
+          <type>zip</type>
+          <scope>test</scope>
+        </dependency>
+        <dependency>
+          <groupId>org.apache.tomee</groupId>
+          <artifactId>arquillian-tomee-remote</artifactId>
+          <version>7.0.0-M3</version>
+          <scope>test</scope>
+        </dependency>
+      </dependencies>
     </profile>
 
     <profile>

Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/test/java/org/apache/myfaces/tobago/example/demo/ArquillianTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/test/java/org/apache/myfaces/tobago/example/demo/ArquillianTest.java?rev=1743906&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/test/java/org/apache/myfaces/tobago/example/demo/ArquillianTest.java (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/test/java/org/apache/myfaces/tobago/example/demo/ArquillianTest.java Sun May 15 14:48:29 2016
@@ -0,0 +1,55 @@
+package org.apache.myfaces.tobago.example.demo;
+
+import java.net.URL;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.drone.api.annotation.Drone;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.resolver.api.maven.archive.importer.MavenImporter;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.FindBy;
+
+@RunWith(Arquillian.class)
+@RunAsClient
+public class ArquillianTest {
+
+    @Drone
+    private WebDriver browser;
+
+    @ArquillianResource
+    private URL contextPath;
+
+    @FindBy(id = "page:i8::field")
+    private WebElement inputField;
+
+    @FindBy(id = "page:outputfield")
+    private WebElement outputField;
+
+    @Deployment
+    public static WebArchive createDeployment() {
+        WebArchive webArchive = ShrinkWrap.create(MavenImporter.class).loadPomFromFile("pom.xml", "jsf-provided", "!myfaces-2.0").importBuildOutput()
+                .as(WebArchive.class);
+        webArchive.addClass(ArquillianTest.class);
+        // XXX there should be a proper profile in POM for that
+        webArchive.delete("/WEB-INF/lib/hibernate-validator-4.3.2.Final.jar");
+        return webArchive;
+    }
+
+    @Test
+    public void shouldCreate() {
+        browser.get(contextPath + "/faces/content/20-component/010-input/10-in/in.xhtml");
+
+        Assert.assertEquals("On Server", outputField.getText());
+        // TODO results in "Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive"
+//        Graphene.guardAjax(inputField).sendKeys("Testtext");
+
+    }
+}

Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/test/resources/arquillian.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/test/resources/arquillian.xml?rev=1743906&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/test/resources/arquillian.xml (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/test/resources/arquillian.xml Sun May 15 14:48:29 2016
@@ -0,0 +1 @@
+<arquillian xmlns="http://jboss.org/schema/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">
   <defaultProtocol type="Servlet 3.0"/>
<!--   <container qualifier="tomee" default="true">
      <configuration>
         <property name="httpPort">-1</property>
         <property name="stopPort">-1</property>
         <property name="cleanOnStartUp">true</property>
         <property name="appWorkingDir">${project.build.directory}/tomee-test</property>
         <property name="dir">${project.build.directory}/tomee</property>
         <property name="debug">${arquillian.remote.debug}</property>
         <property name="debugPort">5005</property>
         <property name="catalina_opts">${argLine} -Djava.security.auth.login.config=${project.basedir}/src/main/tomee/conf/jaas.config</property>
      </configuration>
   </container>-->
   <extension qualifier="webdriver">
      <property name="browser">${arquillian.browser}</property>
<!--      <property name="dimensions">1280x1024</property>
      <property name="reuseCookies">false</property>-->
   </extension>
   <extension qualifier="screenshooter">
      <property name="rootDir">${project.build.directory}/screenshots</property>
   </extension>
</arquillian>
\ No newline at end of file