Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,33 @@ sudo: required
language: node_js
os:
- linux

addons:
sauce_connect:
username: "notkit"
jwt:
secure: "r7M8cgpDqP8NeJThQBCfqsCJDOVI/+HASWjirtHiKjnPGNu7hgPdAISn+gQP+w5RwC8HNysprNKNzSHm+wcUACZH+3zBxj9lVHB7V1dXcWV1W/kegvjaXnpo45V/1pJRft8EVKZSExncGegLz/RkM01d/b/EZvXSzViVoSgXWr4wXrRnH0yshqH1DswrDGfh31HpCP7XA75g9nPohZrJaX0ChsWQS5wUKKNRsbwdyNV5A2tl1BlJnYxMXMysbiiXBj++21lltSBJa5hT1GQKsJ9pGVyWdopWYXFFgRtxn4AJwM9N9e6Ns44m3sP6v3uYyYtlTgB+TBECHi4u5FrTaSiFgFpjk6Z+ljihrZ/iPWn1MQpfjuPlKdwOd6hfFLd79M/uw1Ih+0q0HGER01QwjvrA7nGCLu74SED60cu9UuJqSBQJceZ5nHmde3GMJHbw/u4RRiuWSU/7W/DoqGCLh/Q0FSYBeKTgN81NesUJp/Vk0xk5sPdRo3JuHDzqsFe6+6NMkqo46h3/G6ChfAhgyUAlPwPgVgWR8j6RHbZWgxsRll2KwmPXxzqoSct9OSsUQP4cIO1PrvmbZv933cPYppjjLKOV9RQsmUClZmzRqShcKB1Xt3ITdywTLaG/mKo5SrlQdol3y3Nkee+lzOpl8O91gNdHbgoYhpM+5OSoar8="

env:
global:
- DBUS_SESSION_BUS_ADDRESS=/dev/null
- DISPLAY=:99.0
- CHROME_BIN=chromium-browser
matrix:
- CI_MODE=local_e2e
- CI_MODE=saucelabs_e2e

cache:
directories:
- tour-of-heroes/node_modules
before_script:
- sh -e /etc/init.d/xvfb start

install:
- cd tour-of-heroes
- npm install
- cd ..

before_script:
- ./scripts/travis_setup.sh

script:
- npm run lint
- npm run test -- --watch=false
- npm run travis
- ./scripts/travis_test.sh
12 changes: 12 additions & 0 deletions scripts/travis_setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Sets up the test environment on Travis.

set -ex -o pipefail
cd `dirname $0`

cd ../tour-of-heroes
webdriver-manager update

# Start Xvfb when running locally.
if [[ ${TRAVIS} && (${CI_MODE} == "local_e2e") ]]; then
sh -e /etc/init.d/xvfb start
fi
20 changes: 20 additions & 0 deletions scripts/travis_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Runs the Travis CI

set -ex -o pipefail
cd `dirname $0`
cd ../tour-of-heroes

ng build

if [[ ${TRAVIS} && (${CI_MODE} == "local_e2e") ]]; then
npm run lint
npm run test -- --watch=false
PROTRACTOR_CONFIG="./protractor.conf.js"
fi

# When using saucelabs, use a different config.
if [[ ${TRAVIS} && (${CI_MODE} == "saucelabs_e2e") ]]; then
PROTRACTOR_CONFIG="./protractor-saucelabs.conf.js"
fi

concurrently --success first --kill-others "lite-server" "protractor $PROTRACTOR_CONFIG"
4 changes: 1 addition & 3 deletions tour-of-heroes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
"lint": "tslint \"src/**/*.ts\"",
"test": "ng test",
"pree2e": "webdriver-manager update",
"e2e": "protractor",
"pretravis": "ng build",
"travis": "concurrently --success first --kill-others \"lite-server\" \"npm run e2e\""
"e2e": "protractor"
},
"private": true,
"dependencies": {
Expand Down
38 changes: 38 additions & 0 deletions tour-of-heroes/protractor-saucelabs.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
var testName = 'Tour of Heroes Smoke Tests'
var SpecReporter = require('jasmine-spec-reporter');

exports.config = {
sauceUser: process.env.SAUCE_USERNAME,
sauceKey: process.env.SAUCE_ACCESS_KEY,

capabilities: {
'browserName': 'internet explorer',
'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER,
'build': process.env.TRAVIS_BUILD_NUMBER,
'name': testName,
'version': '11',
'selenium-version': '2.53.1',
'platform': 'Windows 7'
},

allScriptsTimeout: 30000,
specs: [
'./e2e/**/*.e2e-spec.ts'
],
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
useAllAngular2AppRoots: true,
beforeLaunch: function() {
require('ts-node').register({
project: 'e2e'
});
},
onPrepare: function() {
jasmine.getEnv().addReporter(new SpecReporter());
}
};