Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Multiple browsers on travis #3684

Merged
merged 5 commits into from
Aug 23, 2013
Merged
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
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ env:
- SAUCE_USERNAME=angular-ci
- SAUCE_ACCESS_KEY=9b988f434ff8-fbca-8aa4-4ae3-35442987
- SAUCE_CONNECT_READY_FILE=/tmp/sauce-connect-ready
- LOGS_DIR=/tmp/angular-build/logs

before_script:
- mkdir -p $LOGS_DIR

script:
- ./travis_build.sh

after_script:
- ./travis_print_logs.sh
11 changes: 2 additions & 9 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,9 @@ module.exports = function(grunt) {

parallel: {
travis: {
options: {
stream: true
},
tasks: [
{grunt: true, args: ['test:docgen']},
util.parallelTask('tests:docs'),
util.parallelTask('tests:modules'),
util.parallelTask('tests:jquery'),
util.parallelTask('tests:jqlite'),
util.parallelTask('test:e2e')
util.parallelTask(['test:unit', 'test:docgen', 'tests:docs'], {stream: true}),
util.parallelTask(['test:e2e'])
]
}
},
Expand Down
9 changes: 8 additions & 1 deletion docs/component-spec/annotationsSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ describe('Docs Annotations', function() {
body.html('');
});

var normalizeHtml = function(html) {
return html.toLowerCase().replace(/\s*$/, '');
};

describe('popover directive', function() {

var $scope, element;
Expand Down Expand Up @@ -57,14 +61,17 @@ describe('Docs Annotations', function() {
$scope.$apply();
element.triggerHandler('click');
expect(popoverElement.title()).toBe('#title_text');
expect(popoverElement.content()).toBe('<h1>heading</h1>\n');
expect(normalizeHtml(popoverElement.content())).toMatch('<h1>heading</h1>');
}));

});


describe('foldout directive', function() {

// Do not run this suite on Internet Explorer.
if (msie < 10) return;

var $scope, parent, element, url;
beforeEach(function() {
module(function($provide, $animateProvider) {
Expand Down
3 changes: 3 additions & 0 deletions docs/component-spec/mocks.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copy/pasted from src/Angular.js, so that we can disable specific tests on IE.
var msie = parseInt((/msie (\d+)/.exec(navigator.userAgent.toLowerCase()) || [])[1], 10);

var createMockWindow = function() {
var mockWindow = {};
var setTimeoutQueue = [];
Expand Down
3 changes: 3 additions & 0 deletions docs/component-spec/versionJumpSpec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
describe('DocsApp', function() {

// Do not run this suite on Internet Explorer.
if (msie < 10) return;

beforeEach(module('docsApp'));

describe('DocsVersionsCtrl', function() {
Expand Down
5 changes: 2 additions & 3 deletions karma-docs.conf.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var sharedConfig = require('./karma-shared.conf');

module.exports = function(config) {
sharedConfig(config);
sharedConfig(config, {testName: 'AngularJS: docs', logFile: 'karma-docs.log'});

config.set({
files: [
Expand All @@ -26,6 +26,7 @@ module.exports = function(config) {
'build/docs/js/docs.js',
'build/docs/docs-data.js',

'docs/component-spec/mocks.js',
'docs/component-spec/*.js'
],

Expand All @@ -34,6 +35,4 @@ module.exports = function(config) {
suite: 'Docs'
}
});

config.sauceLabs.testName = 'AngularJS: docs';
};
4 changes: 1 addition & 3 deletions karma-e2e.conf.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var sharedConfig = require('./karma-shared.conf');

module.exports = function(config) {
sharedConfig(config);
sharedConfig(config, {testName: 'AngularJS: e2e', logFile: 'karma-e2e.log'});

config.set({
frameworks: [],
Expand All @@ -22,6 +22,4 @@ module.exports = function(config) {
suite: 'E2E'
}
});

config.sauceLabs.testName = 'AngularJS: e2e';
};
4 changes: 1 addition & 3 deletions karma-jqlite.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var angularFiles = require('./angularFiles');
var sharedConfig = require('./karma-shared.conf');

module.exports = function(config) {
sharedConfig(config);
sharedConfig(config, {testName: 'AngularJS: jqLite', logFile: 'karma-jqlite.log'});

config.set({
files: angularFiles.mergeFilesFor('karma'),
Expand All @@ -13,6 +13,4 @@ module.exports = function(config) {
suite: 'jqLite'
}
});

config.sauceLabs.testName = 'AngularJS: jqLite';
};
4 changes: 1 addition & 3 deletions karma-jquery.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var angularFiles = require('./angularFiles');
var sharedConfig = require('./karma-shared.conf');

module.exports = function(config) {
sharedConfig(config);
sharedConfig(config, {testName: 'AngularJS: jQuery', logFile: 'karma-jquery.log'});

config.set({
files: angularFiles.mergeFilesFor('karmaJquery'),
Expand All @@ -13,6 +13,4 @@ module.exports = function(config) {
suite: 'jQuery'
}
});

config.sauceLabs.testName = 'AngularJS: jQuery';
};
4 changes: 1 addition & 3 deletions karma-modules.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var angularFiles = require('./angularFiles');
var sharedConfig = require('./karma-shared.conf');

module.exports = function(config) {
sharedConfig(config);
sharedConfig(config, {testName: 'AngularJS: modules', logFile: 'karma-modules.log'});

config.set({
files: angularFiles.mergeFilesFor('karmaModules', 'angularSrcModules'),
Expand All @@ -12,6 +12,4 @@ module.exports = function(config) {
suite: 'modules'
}
});

config.sauceLabs.testName = 'AngularJS: modules';
};
48 changes: 46 additions & 2 deletions karma-shared.conf.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = function(config) {
module.exports = function(config, specificOptions) {
config.set({
frameworks: ['jasmine'],
autoWatch: true,
Expand All @@ -9,16 +9,60 @@ module.exports = function(config) {

// config for Travis CI
sauceLabs: {
testName: 'AngularJS',
testName: specificOptions.testName || 'AngularJS',
startConnect: false,
tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER
},

// For more browsers on Sauce Labs see:
// https://saucelabs.com/docs/platforms/webdriver
customLaunchers: {
'SL_Chrome': {
base: 'SauceLabs',
browserName: 'chrome'
},
'SL_Firefox': {
base: 'SauceLabs',
browserName: 'firefox'
},
'SL_Safari': {
base: 'SauceLabs',
browserName: 'safari',
platform: 'Mac 10.8',
version: '6'
},
'SL_IE_8': {
base: 'SauceLabs',
browserName: 'internet explorer',
platform: 'Windows 7',
version: '8'
},
'SL_IE_9': {
base: 'SauceLabs',
browserName: 'internet explorer',
platform: 'Windows 2008',
version: '9'
},
'SL_IE_10': {
base: 'SauceLabs',
browserName: 'internet explorer',
platform: 'Windows 2012',
version: '10'
}
}
});


if (process.env.TRAVIS) {
// TODO(vojta): remove once SauceLabs supports websockets.
// This speeds up the capturing a bit, as browsers don't even try to use websocket.
config.transports = ['xhr-polling'];

// Debug logging into a file, that we print out at the end of the build.
config.loggers.push({
type: 'file',
filename: process.env.LOGS_DIR + '/' + (specificOptions.logFile || 'karma.log'),
level: config.LOG_DEBUG
});
}
};
17 changes: 12 additions & 5 deletions lib/grunt/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,18 @@ module.exports = {
};
},

parallelTask: function(name) {
var args = [name, '--port=' + this.lastParallelTaskPort];
parallelTask: function(args, options) {
var task = {
grunt: true,
args: args,
stream: options && options.stream
};

args.push('--port=' + this.lastParallelTaskPort);

if (grunt.option('browsers')) {
if (args.indexOf('test:e2e') !== -1 && grunt.option('e2e-browsers')) {
args.push('--browsers=' + grunt.option('e2e-browsers'));
} else if (grunt.option('browsers')) {
args.push('--browsers=' + grunt.option('browsers'));
}

Expand All @@ -259,8 +267,7 @@ module.exports = {

this.lastParallelTaskPort++;


return {grunt: true, args: args};
return task;
},

lastParallelTaskPort: 9876
Expand Down
19 changes: 13 additions & 6 deletions lib/sauce/sauce_connect_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@ set -e
CONNECT_URL="http://saucelabs.com/downloads/Sauce-Connect-latest.zip"
CONNECT_DIR="/tmp/sauce-connect-$RANDOM"
CONNECT_DOWNLOAD="Sauce_Connect.zip"
CONNECT_LOG="$CONNECT_DIR/log"

CONNECT_LOG="$LOGS_DIR/sauce-connect"
CONNECT_STDOUT="$LOGS_DIR/sauce-connect.stdout"
CONNECT_STDERR="$LOGS_DIR/sauce-connect.stderr"

# Get Connect and start it
mkdir -p $CONNECT_DIR
cd $CONNECT_DIR
curl $CONNECT_URL > $CONNECT_DOWNLOAD 2> /dev/null
unzip $CONNECT_DOWNLOAD
curl $CONNECT_URL -o $CONNECT_DOWNLOAD 2> /dev/null 1> /dev/null
unzip $CONNECT_DOWNLOAD > /dev/null
rm $CONNECT_DOWNLOAD


Expand All @@ -36,6 +39,10 @@ if [ ! -z "$SAUCE_CONNECT_READY_FILE" ]; then
ARGS="$ARGS --readyfile $SAUCE_CONNECT_READY_FILE"
fi

echo "Starting Sauce Connect in the background"
echo "Logging into $CONNECT_LOG"
java -jar Sauce-Connect.jar $ARGS $SAUCE_USERNAME $SAUCE_ACCESS_KEY > $CONNECT_LOG &

echo "Starting Sauce Connect in the background, logging into:"
echo " $CONNECT_LOG"
echo " $CONNECT_STDOUT"
echo " $CONNECT_STDERR"
java -jar Sauce-Connect.jar $ARGS $SAUCE_USERNAME $SAUCE_ACCESS_KEY \
--logfile $CONNECT_LOG 2> $CONNECT_STDERR 1> $CONNECT_STDOUT &
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"marked": "~0.2.9",
"rewire": "1.1.3",
"grunt-contrib-jasmine-node": "~0.1.1",
"grunt-parallel": "~0.3.0",
"grunt-parallel": "vojtajina/grunt-parallel#streaming-per-task",
"grunt-ddescribe-iit": "~0.0.1",
"grunt-merge-conflict": "~0.0.1"
},
Expand Down
4 changes: 2 additions & 2 deletions test/AngularSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ describe('angular', function() {
expect(dst.a).not.toBe(src.a);
});

it("should deeply copy an object into an existing object", function() {
it("should deeply copy an object into a non-existing object", function() {
var src = {a:{name:"value"}};
var dst = copy(src, dst);
var dst = copy(src, undefined);
expect(src).toEqual({a:{name:"value"}});
expect(dst).toEqual(src);
expect(dst).not.toBe(src);
Expand Down
Loading