]> source.dussan.org Git - vaadin-framework.git/commitdiff
Use maven to run PhantomJS tests (#11121)
authorTeemu Suo-Anttila <tsuoanttila@users.noreply.github.com>
Tue, 21 Aug 2018 12:22:12 +0000 (15:22 +0300)
committerIlia Motornyi <elmot@vaadin.com>
Tue, 21 Aug 2018 12:22:12 +0000 (15:22 +0300)
uitest/build.xml
uitest/pom.xml
uitest/src/test/java/com/vaadin/tests/tb3/VaadinBrowserFactory.java
uitest/tb3test.xml [deleted file]

index ab0c154ba83a515a6326d2928060981cb7b76f6d..8dbf65938324a3c6e63a8e4faf1c8f9d6ffe3f50 100644 (file)
@@ -1,72 +1,7 @@
-<?xml version="1.0"?>
+<project>
 
-<project name="vaadin-uitest" basedir="." default="test-tb3"
-    xmlns:ivy="antlib:org.apache.ivy.ant">
-    <description>
-        Provides a uitest WAR containing Vaadin UI tests
-    </description>
-    <include file="../common.xml" as="common" />
-
-    <!-- global properties -->
-    <property name="module.name" value="vaadin-uitest" />
-    <property name="uitest.dir" location="${vaadin.basedir}/uitest" />
-    <property name="result.dir" value="result" />
-    <property name="theme.result.dir" value="${result.dir}/VAADIN/themes" />
-    <property name="result.war"
-        location="${result.dir}/lib/${module.name}-${vaadin.version}.war" />
-
-    <!-- Need to give a default value to keep Ivy happy -->
-    <property name="vaadin.build.repository" value="http://maven.vaadin.com/vaadin-prereleases"/>
-
-    <target name="clean">
-        <fail unless="result.dir" message="No result.dir parameter given" />
-        <delete dir="${result.dir}" />
-    </target>
-
-    <target name="fetch-war">
-        <mkdir dir="${vaadin.basedir}/uitest/target"/>
-        <get src="${vaadin.build.repository}/com/vaadin/vaadin-uitest/${vaadin.version}/vaadin-uitest-${vaadin.version}.war" dest="${vaadin.basedir}/uitest/target/vaadin-uitest-${vaadin.version}.war"/>
-    </target>
-
-    <target name="test-server" depends="clean-testbench-errors">
-        <property name="war.file"
-            location="${vaadin.basedir}/uitest/target/vaadin-uitest-${vaadin.version}.war" />
-        <ant antfile="${uitest.dir}/integration_tests.xml"
-            target="integration-test-all" inheritall="false"
-            inheritrefs="false">
-            <property name="demo.war" value="${war.file}" />
-        </ant>
-    </target>
-
-    <target name="test-tb3" depends="clean-testbench-errors">
-        <property name="war.file"
-            location="${vaadin.basedir}/uitest/target/vaadin-uitest-${vaadin.version}.war" />
-        <mkdir dir="${vaadin.basedir}/result" />
-        <parallel>
-            <daemons>
-                <ant antfile="${uitest.dir}/vaadin-server.xml"
-                    inheritall="true" inheritrefs="true" target="deploy-and-start" />
-            </daemons>
-            <sequential>
-                <ant antfile="${uitest.dir}/vaadin-server.xml"
-                    target="wait-for-startup" />
-               <ant antfile="${uitest.dir}/tb3test.xml" target="run-all-tb3-tests"
-                    inheritall="true" />
-            </sequential>
-        </parallel>
+    <target name="test-tb3">
+        <echo>This Ant script is no longer used to test the framework. Run `mvn verify -P test` to execute browser tests.</echo>
     </target>
 
-    <target name="clean-testbench-errors">
-        <fail unless="com.vaadin.testbench.screenshot.directory"
-            message="Define screenshot directory using -Dcom.vaadin.testbench.screenshot.directory" />
-        <mkdir dir="${com.vaadin.testbench.screenshot.directory}/errors" />
-        <delete>
-            <fileset
-                dir="${com.vaadin.testbench.screenshot.directory}/errors">
-                <include name="*" />
-            </fileset>
-        </delete>
-    </target>
-
-
 </project>
index 71ba0592e592a2bf07c9ea3431e046eff28b8805..91ea2e862ca297c932774b4b0b49db88e69bd597 100644 (file)
@@ -12,6 +12,7 @@
     <packaging>war</packaging>
     <properties>
         <skip.uitest.deployment>true</skip.uitest.deployment>
+        <skip.uitest.failsafe>true</skip.uitest.failsafe>
     </properties>
 
     <url>https://vaadin.com/</url>
                     <httpConnector>
                         <port>8888</port>
                     </httpConnector>
+                    <stopKey>foo</stopKey>
+                    <stopPort>8889</stopPort>
                 </configuration>
             </plugin>
 
                     <skip>true</skip>
                 </configuration>
             </plugin>
+            <plugin>
+                <artifactId>maven-failsafe-plugin</artifactId>
+                <configuration>
+                    <skip>${skip.uitest.failsafe}</skip>
+                    <includes>
+                        <include>**/AllTB3Tests.java</include>
+                    </includes>
+                    <systemPropertyVariables>
+                        <com.vaadin.testbench.screenshot.directory>${project.parent.basedir}/tests/screenshots</com.vaadin.testbench.screenshot.directory>
+                        <com.vaadin.testbench.max.retries>${com.vaadin.testbench.max.retries}</com.vaadin.testbench.max.retries>
+                        <useLocalWebDriver>${useLocalWebDriver}</useLocalWebDriver>
+                        <browsers.include>${browsers.include}</browsers.include>
+                        <categories.include>${categoriess.include}</categories.include>
+                        <browsers.exclude>${browsers.exclude}</browsers.exclude>
+                        <categories.exclude>${categories.exclude}</categories.exclude>
+                    </systemPropertyVariables>
+                </configuration>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>integration-test</goal>
+                            <goal>verify</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>
         <pluginManagement>
             <plugins>
                 <skip.uitest.deployment>false</skip.uitest.deployment>
             </properties>
         </profile>
+        <profile>
+            <id>test</id>
+            <activation>
+                <activeByDefault>false</activeByDefault>
+            </activation>
+            <properties>
+                <skip.uitest.failsafe>false</skip.uitest.failsafe>
+            </properties>
+            <build>
+                <pluginManagement>
+                    <plugins>
+                        <plugin>
+                            <groupId>org.eclipse.jetty</groupId>
+                            <artifactId>jetty-maven-plugin</artifactId>
+
+                            <executions>
+                                <!-- start and stop jetty (running our app)
+                                 when running integration tests -->
+                                <execution>
+                                    <id>start-jetty</id>
+                                    <phase>pre-integration-test</phase>
+                                    <goals>
+                                        <goal>start</goal>
+                                    </goals>
+                                </execution>
+                                <execution>
+                                    <id>stop-jetty</id>
+                                    <phase>post-integration-test</phase>
+                                    <goals>
+                                        <goal>stop</goal>
+                                    </goals>
+                                </execution>
+                            </executions>
+                        </plugin>
+                    </plugins>
+                </pluginManagement>
+            </build>
+
+        </profile>
+        <profile>
+            <id>validation</id>
+            <activation>
+                <activeByDefault>false</activeByDefault>
+            </activation>
+            <build>
+                <pluginManagement>
+                    <plugins>
+                        <plugin>
+                            <artifactId>maven-failsafe-plugin</artifactId>
+                            <configuration>
+                                <systemPropertyVariables>
+                                    <useLocalWebDriver>true</useLocalWebDriver>
+                                    <browsers.include>phantomjs1</browsers.include>
+                                    <categories.exclude>push,needs-ssh</categories.exclude>
+                                </systemPropertyVariables>
+                            </configuration>
+                            <executions>
+                                <execution>
+                                    <goals>
+                                        <goal>integration-test</goal>
+                                        <goal>verify</goal>
+                                    </goals>
+                                </execution>
+                            </executions>
+                        </plugin>
+                    </plugins>
+                </pluginManagement>
+            </build>
+        </profile>
     </profiles>
 
 </project>
index 1e7e68ae92bf89123820b7348780486c677f5406..27f50a6a17e67bdbc894d05ace314eaac0e7f7f8 100644 (file)
@@ -16,7 +16,7 @@ public class VaadinBrowserFactory extends DefaultBrowserFactory {
 
     @Override
     public DesiredCapabilities create(Browser browser) {
-        String browserFactoryClass = System.getProperty("browser.factory");
+        String browserFactoryClass = System.getProperty("testbench.browser.factory");
         if (browserFactoryClass != null
                 && !browserFactoryClass.trim().isEmpty()) {
             if (delegate == null) {
diff --git a/uitest/tb3test.xml b/uitest/tb3test.xml
deleted file mode 100644 (file)
index 1e4eb02..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0"?>
-<project name="tb3test" xmlns:antcontrib="antlib:net.sf.antcontrib" xmlns:ivy="antlib:org.apache.ivy.ant" basedir=".">
-
-    <dirname property="tb3test.dir" file="${ant.file.tb3test}" />
-    <property name="report.dir" location="${tb3test.dir}/result/reports-tb3" />
-    <property name="browsers.include" value="" />
-    <property name="browsers.exclude" value="" />
-    <property name="browser.factory" value="" />
-    <property name="categories.include" value="" />
-    <property name="categories.exclude" value="" />
-    <property name="useLocalWebDriver" value="false" />
-    <property name="com.vaadin.testbench.max.retries" value="0" />
-    <property name="com.vaadin.testbench.hub.url" value="" />
-    <property name="vaadin.testbench.developer.license" value="" />
-    <property name="junit.test.suite" value="com.vaadin.tests.tb3.AllTB3Tests" />
-
-    <ivy:resolve file="${tb3test.dir}/ivy.xml" conf="build, build-provided" />
-    <ivy:cachepath pathid="classpath.tb3.lib" conf="build, build-provided" />
-    <path id="classpath.tb3">
-        <path location="${tb3test.dir}/target/test-classes" />
-        <path refid="classpath.tb3.lib" />
-        <path location="${tb3test.dir}/target/classes" />
-    </path>
-
-    <target name="run-all-tb3-tests" unless="tests.tb3.skip"
-        description="Run all the TB3 tests (except server tests) in the project">
-        <antcall target="run-tb3-suite" />
-    </target>
-
-    <target name="run-tb3-suite">
-        <fail unless="com.vaadin.testbench.screenshot.directory" message="Define screenshot directory using -Dcom.vaadin.testbench.screenshot.directory" />
-        <delete dir="${report.dir}" />
-        <mkdir dir="${report.dir}" />
-
-        <junit showoutput="no" printsummary="no" fork="yes">
-            <formatter type="xml" />
-            <classpath refid="classpath.tb3" />
-
-            <jvmarg value="-Dcom.vaadin.testbench.screenshot.directory=${com.vaadin.testbench.screenshot.directory}" />
-            <jvmarg value="-Djava.awt.headless=true" />
-            <jvmarg value="-Dbrowsers.include=${browsers.include}" />
-            <jvmarg value="-Dbrowsers.exclude=${browsers.exclude}" />
-            <jvmarg value="-Dbrowser.factory=${browser.factory}" />
-            <jvmarg value="-Dcategories.include=${categories.include}" />
-            <jvmarg value="-Dcategories.exclude=${categories.exclude}" />
-            <jvmarg value="-DuseLocalWebDriver=${useLocalWebDriver}" />
-            <jvmarg value="-Dcom.vaadin.testbench.max.retries=${com.vaadin.testbench.max.retries}" />
-            <jvmarg value="-Dcom.vaadin.testbench.hub.url=${com.vaadin.testbench.hub.url}" />
-            <jvmarg value="-Dvaadin.testbench.developer.license=${vaadin.testbench.developer.license}" />
-            <test name="${junit.test.suite}" todir="${report.dir}" />
-        </junit>
-
-    </target>
-
-</project>