Skip to content

Commit

Permalink
feat(generator): use sauce labs for running e2e tests with travis CI
Browse files Browse the repository at this point in the history
closes #572
  • Loading branch information
DaftMonk committed Sep 21, 2014
1 parent cda5261 commit 50ca41d
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 23 deletions.
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ language: node_js
node_js:
- '0.10'
- '0.11'
env:
global:
- secure: fBqMlUrbIwaRJeKe39zxVsRcvtPIP/R98JNzrD0ycHzdfbhsWge0J7FCpdKjgRCf99ggqMhyevJafSJv7cfiVgJhB6kYudhG0G60V+vBjj4NIZnOelpVeQHXyLlekRpu+Qa/DaL43jovRAI0I11cwVfIRWtXZwiQOjCd/Elsdl8=
- secure: GZ95FcH0K88RG7P0SJjoIcHLfUalFRHeu5Vd7Kh0wXTh3O6Zku7iauk6Cd+aYGuFedL5wSzht5qnVBRm10VxhhJMxHiZ+I+VBxt4bysKM0axMZ+SMTfPK3zajVVXKfzIsIYO0m0qwYtHCgSXUrMnwAczESxczxq48VxA/rCXbYc=
addons:
sauce_connect: true
before_install:
- gem update --system
- gem install sass --version "=3.3.7"
Expand Down
18 changes: 13 additions & 5 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var markdown = require('marked');
var semver = require('semver');
var _s = require('underscore.string');
var shell = require('shelljs');
var process = require('child_process');
var child_process = require('child_process');
var Q = require('q');
var helpers = require('yeoman-generator').test;
var fs = require('fs-extra');
Expand Down Expand Up @@ -227,12 +227,20 @@ module.exports = function (grunt) {

shell.cd('test/fixtures');
grunt.log.ok('installing npm dependencies for generated app');
process.exec('npm install --quiet', {cwd: '../fixtures'}, function (error, stdout, stderr) {
child_process.exec('npm install --quiet', {cwd: '../fixtures'}, function (error, stdout, stderr) {

grunt.log.ok('installing bower dependencies for generated app');
process.exec('bower install', {cwd: '../fixtures'}, function (error, stdout, stderr) {
shell.cd('../../');
done();
child_process.exec('bower install', {cwd: '../fixtures'}, function (error, stdout, stderr) {

if(!process.env.SAUCE_USERNAME) {
child_process.exec('npm run update-webdriver', function() {
shell.cd('../../');
done();
});
} else {
shell.cd('../../');
done();
}
})
});
});
Expand Down
7 changes: 4 additions & 3 deletions app/templates/protractor.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ exports.config = {
// with relative paths will be prepended with this.
baseUrl: 'http://localhost:' + (process.env.PORT || '9000'),

// If true, only chromedriver will be started, not a standalone selenium.
// Tests for browsers other than chrome will not run.
chromeOnly: true,
// Credientials for Saucelabs
sauceUser: process.env.SAUCE_USERNAME,

sauceKey: process.env.SAUCE_ACCESS_KEY,

// list of files / patterns to load in the browser
specs: [
Expand Down
4 changes: 2 additions & 2 deletions endpoint/templates/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var routerStub = {
};

// require the index with our stubbed out modules
var <%= name %>Index = proxyquire('./index.js', {
var <%= cameledName %>Index = proxyquire('./index.js', {
'express': {
Router: function() {
return routerStub;
Expand All @@ -31,7 +31,7 @@ var <%= name %>Index = proxyquire('./index.js', {
describe('<%= classedName %> API Router:', function() {

it('should return an express router instance', function() {
<%= name %>Index.should.equal(router);
<%= cameledName %>Index.should.equal(routerStub);
});

describe('GET <%= route %>', function() {
Expand Down
24 changes: 11 additions & 13 deletions test/test-file-creation.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ describe('angular-fullstack generator', function () {
'server/api/thing/index.js',
'server/api/thing/index.spec.js',
'server/api/thing/thing.controller.js',
'server/api/thing/thing.e2e.js',
'server/api/thing/thing.integration.js',
'server/components/errors/index.js',
'server/config/local.env.js',
'server/config/local.env.sample.js',
Expand Down Expand Up @@ -215,7 +215,7 @@ describe('angular-fullstack generator', function () {
'server/api/user/index.js',
'server/api/user/index.spec.js',
'server/api/user/user.controller.js',
'server/api/user/user.e2e.js',
'server/api/user/user.integration.js',
'server/api/user/user.model.js',
'server/api/user/user.model.spec.js',
'server/auth/index.js',
Expand Down Expand Up @@ -347,17 +347,15 @@ describe('angular-fullstack generator', function () {
});
});

// it('should run e2e tests successfully', function(done) {
// this.timeout(80000);
// gen.run({}, function () {
// exec('npm run update-webdriver', function (error, stdout, stderr) {
// exec('grunt test:e2e', function (error, stdout, stderr) {
// expect(stdout, 'Client tests failed \n' + stdout ).to.contain('Done, without errors.');
// done();
// });
// });
// })
// });
it('should run e2e tests successfully', function(done) {
this.timeout(80000);
gen.run({}, function () {
exec('grunt test:e2e', function (error, stdout, stderr) {
expect(stdout, 'Client tests failed \n' + stdout).to.contain('0 failures');
done();
});
});
});
});

describe('with other preprocessors and oauth', function() {
Expand Down

0 comments on commit 50ca41d

Please sign in to comment.