Browse Source

Use maven to run PhantomJS tests (#11121)

tags/7.7.15
Teemu Suo-Anttila 5 years ago
parent
commit
6462d54a2d

+ 3
- 68
uitest/build.xml View 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>

+ 98
- 0
uitest/pom.xml View 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>
@@ -273,6 +274,8 @@
<httpConnector>
<port>8888</port>
</httpConnector>
<stopKey>foo</stopKey>
<stopPort>8889</stopPort>
</configuration>
</plugin>

@@ -301,6 +304,32 @@
<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>
@@ -332,6 +361,75 @@
<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>

+ 1
- 1
uitest/src/test/java/com/vaadin/tests/tb3/VaadinBrowserFactory.java View 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) {

+ 0
- 55
uitest/tb3test.xml View File

@@ -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>

Loading…
Cancel
Save