Skip to content

Commit

Permalink
Add Polymer 2 test module and configure travis to use Chrome for it (#…
Browse files Browse the repository at this point in the history
…1285)

Fixes #1276
  • Loading branch information
Denis authored and Legioth committed Mar 9, 2017
1 parent 1e23cdb commit d456fa6
Show file tree
Hide file tree
Showing 17 changed files with 451 additions and 137 deletions.
2 changes: 2 additions & 0 deletions .travis.script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
# TRAVIS_SECURE_ENV_VARS == true if encrypted variables, e.g. SONAR_HOST is available
# TRAVIS_REPO_SLUG == the repository, e.g. vaadin/vaadin

export DISPLAY=:99.0
sh -e /etc/init.d/xvfb start
if [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ "$TRAVIS_SECURE_ENV_VARS" == "true" ]
then
# Pull request for master with secure vars (SONAR_GITHUB_OAUTH, SONAR_HOST) available
Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ cache:
- hummingbird-tests/test-expense-manager-imperative/frontend/node
- hummingbird-tests/test-expense-manager-imperative/frontend/node_modules
- hummingbird-tests/test-expense-manager-imperative/frontend/bower_components
- hummingbird-tests/test-polymer2/driver
before_cache:
# remove all build artifacts
- rm -rf $HOME/.m2/repository/com/vaadin/hummingbird
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* Copyright 2000-2017 Vaadin Ltd.
*
* Licensed 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.
*/
package com.vaadin.hummingbird.testutil;

import org.junit.Before;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.DesiredCapabilities;

import com.vaadin.testbench.parallel.Browser;

/**
* Base class for TestBench tests for some dedicated browser which is specified
* via {@link #getBrowser()}.
* <p>
* By default Chrome is used.
* <p>
* It is required to set system property with path to the driver to be able to
* run the test.
*
* @author Vaadin Ltd
*
*/
public class SingleBrowserTest extends ViewOrUITest {

/**
* Setup the driver for the active browser.
*/
@Before
public void setupDriver() {
switch (getBrowser()) {
case FIREFOX:
setDriver(new FirefoxDriver(DesiredCapabilities.firefox()));
break;
case CHROME:
setDriver(new ChromeDriver(DesiredCapabilities.chrome()));
break;
case PHANTOMJS:
setupPhantomJsDriver();
break;
default:
throw new IllegalStateException(
"Don't know how to execute test with the browser "
+ getBrowser()
+ ". Make a custom driver set up for it.");
}
}

protected Browser getBrowser() {
return Browser.CHROME;
}

}
1 change: 1 addition & 0 deletions hummingbird-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
<systemPropertyVariables>
<serverPort>${server.port}</serverPort>
<phantomjs.binary.path>${phantomjs.binary}</phantomjs.binary.path>
<webdriver.chrome.driver>${webdriver.chrome.driver}</webdriver.chrome.driver>
</systemPropertyVariables>
<excludedGroups>${test.excludegroup}</excludedGroups>
</configuration>
Expand Down
1 change: 1 addition & 0 deletions hummingbird-tests/test-root-context/frontend/bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@
"polymer": "1.5.0"
}
}

1 change: 1 addition & 0 deletions hummingbird-tests/test-root-context/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@
"author": "",
"license": "Apache-2.0"
}

21 changes: 21 additions & 0 deletions hummingbird-tests/test-root-context/frontend/v2/bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "test-polymer2",
"homepage": "https://github.com/vaadin/hummingbird",
"authors": [
],
"description": "",
"main": "",
"license": "Apache2",
"private": true,
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"polymer": "Polymer/polymer#2.0-preview"
}
}

15 changes: 15 additions & 0 deletions hummingbird-tests/test-root-context/frontend/v2/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "test-polymer2",
"version": "1.0.0",
"description": "This file exists only to define the Bower version",
"main": "",
"dependencies": {
"bower": "^1.8.0"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "Apache-2.0"
}
196 changes: 114 additions & 82 deletions hummingbird-tests/test-root-context/pom.xml
Original file line number Diff line number Diff line change
@@ -1,87 +1,119 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.vaadin</groupId>
<artifactId>hummingbird-tests</artifactId>
<version>0.0.19-SNAPSHOT</version>
</parent>
<artifactId>hummingbird-test-root-context</artifactId>
<name>Hummingbird root context tests</name>
<packaging>war</packaging>
<properties>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>
<!-- uses default ports 8888 and 8889 -->
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.vaadin</groupId>
<artifactId>hummingbird-tests</artifactId>
<version>0.0.19-SNAPSHOT</version>
</parent>
<artifactId>hummingbird-test-root-context</artifactId>
<name>Hummingbird root context tests</name>
<packaging>war</packaging>
<properties>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>
<!-- uses default ports 8888 and 8889 -->

<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>hummingbird-test-resources</artifactId>
<version>0.0.19-SNAPSHOT</version>
</dependency>
</dependencies>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>hummingbird-test-resources</artifactId>
<version>0.0.19-SNAPSHOT</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>
<resource>
<!-- this is relative to the pom.xml directory -->
<directory>frontend</directory>
<include>bower_components/**</include>
</resource>
</webResources>
</configuration>
</plugin>

<!-- This module is mapped to default web context -->
<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>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.0</version>
<configuration>
<nodeVersion>${node.version}</nodeVersion>
<npmVersion>${npm.version}</npmVersion>
<workingDirectory>frontend</workingDirectory>
</configuration>
<executions>
<execution>
<id>install-node-and-npm</id>
<goals>
<goal>install-node-and-npm</goal>
<goal>npm</goal> <!-- runs 'install' by default -->
<goal>bower</goal> <!-- runs 'install' by default -->
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<build>
<plugins>
<!-- This module is mapped to default web context -->
<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>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.0</version>
<configuration>
<nodeVersion>${node.version}</nodeVersion>
<npmVersion>${npm.version}</npmVersion>
</configuration>
<executions>
<execution>
<id>install-node-and-npm-1</id>
<goals>
<goal>install-node-and-npm</goal>
<goal>npm</goal> <!-- runs 'install' by default -->
<goal>bower</goal> <!-- runs 'install' by default -->
</goals>
<configuration>
<workingDirectory>frontend</workingDirectory>
</configuration>
</execution>
<execution>
<id>install-node-and-npm-2</id>
<goals>
<goal>install-node-and-npm</goal>
<goal>npm</goal> <!-- runs 'install' by default -->
<goal>bower</goal> <!-- runs 'install' by default -->
</goals>
<configuration>
<workingDirectory>frontend/v2</workingDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>
<resource>
<!-- this is relative to the pom.xml directory -->
<directory>frontend</directory>
<include>bower_components/**</include>
<include>v2/bower_components/**</include>
</resource>
</webResources>
</configuration>
</plugin>
<plugin>
<groupId>com.lazerycode.selenium</groupId>
<artifactId>driver-binary-downloader-maven-plugin</artifactId>
<version>1.0.10</version>
<configuration>
<!-- root directory that downloaded driver binaries will
be stored in -->
<onlyGetDriversForHostOperatingSystem>true</onlyGetDriversForHostOperatingSystem>
<rootStandaloneServerDirectory>driver</rootStandaloneServerDirectory>
<customRepositoryMap>repo.xml</customRepositoryMap>
</configuration>
<executions>
<execution>
<goals>
<goal>selenium</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
39 changes: 39 additions & 0 deletions hummingbird-tests/test-root-context/repo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<root>
<windows>
<driver id="googlechrome">
<version id="2.27">
<bitrate thirtytwobit="true" sixtyfourbit="true">
<filelocation>http://chromedriver.storage.googleapis.com/2.27/chromedriver_win32.zip
</filelocation>
<hash>d9d38707ed22f5549a1b5ed53ad054c2a0a1ada6</hash>
<hashtype>sha1</hashtype>
</bitrate>
</version>
</driver>
</windows>
<linux>
<driver id="googlechrome">
<version id="2.27">
<bitrate sixtyfourbit="true">
<filelocation>http://chromedriver.storage.googleapis.com/2.27/chromedriver_linux64.zip
</filelocation>
<hash>d2d5a41e7bdac88fd031095337fb3e20a812836c</hash>
<hashtype>sha1</hashtype>
</bitrate>
</version>
</driver>
</linux>
<osx>
<driver id="googlechrome">
<version id="2.27">
<bitrate thirtytwobit="true" sixtyfourbit="true">
<filelocation>http://chromedriver.storage.googleapis.com/2.27/chromedriver_mac64.zip
</filelocation>
<hash>3ebf455e5f461c8f7cabb825af40205b53fce58b</hash>
<hashtype>sha1</hashtype>
</bitrate>
</version>
</driver>
</osx>
</root>
Loading

0 comments on commit d456fa6

Please sign in to comment.