Skip to content

Commit

Permalink
fix(travis): use SauceLabs for e2e tests on travis
Browse files Browse the repository at this point in the history
  • Loading branch information
c0bra committed Dec 20, 2013
1 parent d386c4a commit 5d8a21d
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ before_script:
- ./lib/sauce/sauce_connect_block.sh

script:
- ./scripts/travis/travis_build.sh
- ./travis_build.sh

after_success:
- grunt release
Expand Down
13 changes: 13 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,18 @@ module.exports = function(grunt) {
}
}
},
ci: {
keepAlive: false,
options: {
args: {
seleniumPort: 4444,
baseUrl: 'http://localhost:9999',
specs: ['.tmp/doc-scenarios/**/*.spec.js', 'test/e2e/**/*.spec.js'],
sauceUser: process.env.SAUCE_USERNAME,
sauceKey: process.env.SAUCE_ACCESS_KEY
}
}
}
auto: {
keepAlive: true,
options: {
Expand Down Expand Up @@ -415,6 +427,7 @@ module.exports = function(grunt) {
grunt.registerTask('test:ci', ['clean', 'jshint', 'ngtemplates', 'serialsauce']);
grunt.registerTask('test:docs', ['connect:testserver', 'protractor:docs']);
grunt.registerTask('test:e2e', ['connect:testserver', 'protractor:singlerun']);
grunt.registerTask('test:e2e:ci', ['connect:testserver', 'protractor:ci']);

// Test
grunt.registerTask('test', 'Run tests on singleRun karma server', function() {
Expand Down
4 changes: 4 additions & 0 deletions lib/grunt/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ module.exports = function(grunt) {
*
*/

grunt.registerMultiTask('tests', '**Use `grunt test` instead**', function(){
util.startKarma.call(util, this.data, true, this.async());
});

// Run tests on multiple versions of angular
grunt.registerTask('karmangular', 'Run tests against multiple versions of angular', function() {
// Start karma servers
Expand Down
20 changes: 20 additions & 0 deletions lib/grunt/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,26 @@ var util = module.exports = {
return retFiles;
},

startKarma: function(config, singleRun, done){
var browsers = grunt.option('browsers');
var reporters = grunt.option('reporters');
var noColor = grunt.option('no-colors');
var port = grunt.option('port');
var p = spawn('node', ['node_modules/karma/bin/karma', 'start', config,
singleRun ? '--single-run=true' : '',
reporters ? '--reporters=' + reporters : '',
browsers ? '--browsers=' + browsers : '',
noColor ? '--no-colors' : '',
port ? '--port=' + port : ''
]);
p.stdout.pipe(process.stdout);
p.stderr.pipe(process.stderr);
p.on('exit', function(code){
if(code !== 0) grunt.fail.warn("Karma test(s) failed. Exit code: " + code);
done();
});
},

customLaunchers: function() {
return {
'SL_Chrome': {
Expand Down
2 changes: 1 addition & 1 deletion travis_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if [ $JOB = "unit" ]; then
elif [ $JOB = "e2e" ]; then
# grunt clean build test:e2e --browsers=SL_Chrome
grunt
grunt test:e2e
grunt test:e2e:ci
else
echo "Unknown job type. Please set JOB=unit or JOB=e2e."
fi

0 comments on commit 5d8a21d

Please sign in to comment.