Skip to content

Commit

Permalink
run e2e on sauce lab (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
PinkyJie committed Dec 16, 2015
1 parent f2ef8db commit 7896561
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 10 deletions.
7 changes: 6 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ script:
- ./publish-to-gh-pages.sh
after_success:
- npm run codecov
- npm run e2e -- --ci --build-id=$TRAVIS_BUILD_NUMBER
env:
global:
- GitHub_REF: github.com/PinkyJie/angular1-webpack-starter.git
- secure: "Sq6NJGdO4trRXiY+pr8RMV8GuZjsML8If6653ZKVqsHPFPS8eTEKNlIepXcWf/+I6cqVhiT0B/IUxVwdbw/Jh+0BLM1RxofvyFAcZAQaxhRnfDnVdGqysP89RlxuoR/Bc58F7qFwu4nfJ96dFfiIDEnV5whLbvekXperPeLDy41BbgRov4H2ifz3OiwAK2DISmM4ikJBCkwKOA0BHo9/cDtobHNicCM7sE36aYIjYXK6esM8aBZ/XHiLzF/rlfRGQFvNmaxq6Wu41GbtnatDg3PUqBIxCiutKpqEpPothGN/gbTZFNQBCJGmNqnp8KxD2ua3mBvmnL0x+Rij27uMFTfSqfDyLTx/A9M1tMYaIbwBNXz3tR7jyQk0WyAFbuTyw4i6rtM4qqRLSbkF3DXImM5qPqO5zlXNMSAAlOqDXWL9+PpU2U0S7YtxZiV5fzGuZ77F1XTsnHhTgNDru0l0mZhPzTfb+rnagcT74O/6XBeShEZ+eh9gfDLF0/uyXP4Jjif/7204M+Attk/GUuXht+A3+SttUJ/nGbvNJyUi1OXZonuRJSkEPvNu/88KyMvLP/QxTWo0UVE+2Vxb7p9MQo5Fl/W0cCTLQorJX/DYVkJErnktzHX0UV4Y0dR0pQKZpUcmkxkk2zQ/uLugVRD3oHw/Hnzbb3PWlPL5vosIsoE="
- secure: "Sq6NJGdO4trRXiY+pr8RMV8GuZjsML8If6653ZKVqsHPFPS8eTEKNlIepXcWf/+I6cqVhiT0B/IUxVwdbw/Jh+0BLM1RxofvyFAcZAQaxhRnfDnVdGqysP89RlxuoR/Bc58F7qFwu4nfJ96dFfiIDEnV5whLbvekXperPeLDy41BbgRov4H2ifz3OiwAK2DISmM4ikJBCkwKOA0BHo9/cDtobHNicCM7sE36aYIjYXK6esM8aBZ/XHiLzF/rlfRGQFvNmaxq6Wu41GbtnatDg3PUqBIxCiutKpqEpPothGN/gbTZFNQBCJGmNqnp8KxD2ua3mBvmnL0x+Rij27uMFTfSqfDyLTx/A9M1tMYaIbwBNXz3tR7jyQk0WyAFbuTyw4i6rtM4qqRLSbkF3DXImM5qPqO5zlXNMSAAlOqDXWL9+PpU2U0S7YtxZiV5fzGuZ77F1XTsnHhTgNDru0l0mZhPzTfb+rnagcT74O/6XBeShEZ+eh9gfDLF0/uyXP4Jjif/7204M+Attk/GUuXht+A3+SttUJ/nGbvNJyUi1OXZonuRJSkEPvNu/88KyMvLP/QxTWo0UVE+2Vxb7p9MQo5Fl/W0cCTLQorJX/DYVkJErnktzHX0UV4Y0dR0pQKZpUcmkxkk2zQ/uLugVRD3oHw/Hnzbb3PWlPL5vosIsoE="
addons:
sauce_connect:
username: "sd4399340"
access_key: "5829a37c-41c0-4490-b6c2-061ae4acc5e9"
2 changes: 1 addition & 1 deletion karma.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const unitTestEntry = 'source/test/unit/helper.js';
// run multiple times in watch mode
const singleRun = !args.watch;
// use phantomjs in watch mode
const browser = (args.watch || args.travis) ? 'PhantomJS' : 'Chrome';
const browser = (args.watch || args.ci) ? 'PhantomJS' : 'Chrome';
// load babel polyfill for phantomjs
const files = browser === 'PhantomJS' ? [
'node_modules/babel-core/browser-polyfill.js',
Expand Down
60 changes: 55 additions & 5 deletions protractor.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ const HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter'
const SpecReporter = require('jasmine-spec-reporter');

const webpackConfig = require('./webpack.config');
const args = require('yargs').argv;

const e2eBaseFolder = './source/test/e2e';

exports.config = {
baseUrl: `http://${webpackConfig.devServer.host}:${webpackConfig.devServer.port}`,
const config = {
framework: 'jasmine2',
jasmineNodeOpts: {
showColors: true,
Expand All @@ -15,9 +15,6 @@ exports.config = {
print: () => {}
},
specs: `${e2eBaseFolder}/specs/*.spec.js`,
capabilities: {
browserName: 'chrome'
},
onPrepare: () => {
// support ES6, need to put this line in onPrepare to make line number
// in error report correct
Expand Down Expand Up @@ -51,3 +48,56 @@ exports.config = {
timeout: 10000
}
};

if (args.ci) {
// run by sauce lab
config.seleniumAddress = 'http://sd4399340:[email protected]/wd/hub';
// https://wiki.saucelabs.com/display/DOCS/Platform+Configurator#/
config.multiCapabilities = [
{
name: `chrome-on-windows-${args.buildId}`,
build: args.buildId,
browserName: 'chrome',
platform: 'Windows 7'
},
{
name: `safari-on-mac-${args.buildId}`,
build: args.buildId,
browserName: 'safari',
platform: 'OS X 10.11'
},
{
name: `ie9-on-windows-${args.buildId}`,
build: args.buildId,
browserName: 'internet explorer',
platform: 'Windows 7',
version: '9.0'
},
{
name: `safari-on-iphone-${args.buildId}`,
build: args.buildId,
browserName: 'iphone',
platform: 'OS X 10.10',
version: '9.1',
deviceName: 'iPhone 5s',
deviceOrientation: 'portrait'
},
{
name: `chrome-on-andoird-${args.buildId}`,
build: args.buildId,
browserName: 'android',
platform: 'Linux',
version: '4.4',
deviceName: 'Android Emulator',
deviceOrientation: 'portrait'
}
];
} else {
// local run
config.baseUrl = `http://${webpackConfig.devServer.host}:${webpackConfig.devServer.port}/`;
config.capabilities = {
browserName: 'chrome'
};
}

exports.config = config;
2 changes: 1 addition & 1 deletion publish-to-gh-pages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -ev

# run unit test (--travis: use phantomjs browser)
npm test -- --travis
npm test -- --ci

# apply /#/ style router for SPA
git apply ./gh-pages-patch.diff
Expand Down
4 changes: 2 additions & 2 deletions source/test/e2e/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class BasePageObject {
const homeItem = breadcrumb.homeItem;
expect(homeItem.view.isDisplayed()).toBe(true);
expect(homeItem.view.$(homeItem.link).getAttribute('href'))
.toEqual(`${browser.baseUrl}/`);
.toEqual(`${browser.baseUrl}`);
expect(homeItem.view.$(homeItem.icon)).toHaveClass('mdi-action-home');
// items
expect(breadcrumb.breadcrumbItem.view.count()).toEqual(expectedBreadcrumbItems.length);
Expand Down Expand Up @@ -168,7 +168,7 @@ class BasePageObject {

class E2EHelper {
gotoUrl (url) {
browser.get(`${browser.baseUrl}/${url}`);
browser.get(`${browser.baseUrl}${url}`);
}

chooseDate (input, picker, date) {
Expand Down

0 comments on commit 7896561

Please sign in to comment.