Skip to content

Commit 50ca41d

Browse files
committed
feat(generator): use sauce labs for running e2e tests with travis CI
closes #572
1 parent cda5261 commit 50ca41d

File tree

5 files changed

+36
-23
lines changed

5 files changed

+36
-23
lines changed

.travis.yml

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ language: node_js
22
node_js:
33
- '0.10'
44
- '0.11'
5+
env:
6+
global:
7+
- secure: fBqMlUrbIwaRJeKe39zxVsRcvtPIP/R98JNzrD0ycHzdfbhsWge0J7FCpdKjgRCf99ggqMhyevJafSJv7cfiVgJhB6kYudhG0G60V+vBjj4NIZnOelpVeQHXyLlekRpu+Qa/DaL43jovRAI0I11cwVfIRWtXZwiQOjCd/Elsdl8=
8+
- secure: GZ95FcH0K88RG7P0SJjoIcHLfUalFRHeu5Vd7Kh0wXTh3O6Zku7iauk6Cd+aYGuFedL5wSzht5qnVBRm10VxhhJMxHiZ+I+VBxt4bysKM0axMZ+SMTfPK3zajVVXKfzIsIYO0m0qwYtHCgSXUrMnwAczESxczxq48VxA/rCXbYc=
9+
addons:
10+
sauce_connect: true
511
before_install:
612
- gem update --system
713
- gem install sass --version "=3.3.7"

Gruntfile.js

+13-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var markdown = require('marked');
33
var semver = require('semver');
44
var _s = require('underscore.string');
55
var shell = require('shelljs');
6-
var process = require('child_process');
6+
var child_process = require('child_process');
77
var Q = require('q');
88
var helpers = require('yeoman-generator').test;
99
var fs = require('fs-extra');
@@ -227,12 +227,20 @@ module.exports = function (grunt) {
227227

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

232232
grunt.log.ok('installing bower dependencies for generated app');
233-
process.exec('bower install', {cwd: '../fixtures'}, function (error, stdout, stderr) {
234-
shell.cd('../../');
235-
done();
233+
child_process.exec('bower install', {cwd: '../fixtures'}, function (error, stdout, stderr) {
234+
235+
if(!process.env.SAUCE_USERNAME) {
236+
child_process.exec('npm run update-webdriver', function() {
237+
shell.cd('../../');
238+
done();
239+
});
240+
} else {
241+
shell.cd('../../');
242+
done();
243+
}
236244
})
237245
});
238246
});

app/templates/protractor.conf.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ exports.config = {
1212
// with relative paths will be prepended with this.
1313
baseUrl: 'http://localhost:' + (process.env.PORT || '9000'),
1414

15-
// If true, only chromedriver will be started, not a standalone selenium.
16-
// Tests for browsers other than chrome will not run.
17-
chromeOnly: true,
15+
// Credientials for Saucelabs
16+
sauceUser: process.env.SAUCE_USERNAME,
17+
18+
sauceKey: process.env.SAUCE_ACCESS_KEY,
1819

1920
// list of files / patterns to load in the browser
2021
specs: [

endpoint/templates/index.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ var routerStub = {
1919
};
2020

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

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

3737
describe('GET <%= route %>', function() {

test/test-file-creation.js

+11-13
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ describe('angular-fullstack generator', function () {
149149
'server/api/thing/index.js',
150150
'server/api/thing/index.spec.js',
151151
'server/api/thing/thing.controller.js',
152-
'server/api/thing/thing.e2e.js',
152+
'server/api/thing/thing.integration.js',
153153
'server/components/errors/index.js',
154154
'server/config/local.env.js',
155155
'server/config/local.env.sample.js',
@@ -215,7 +215,7 @@ describe('angular-fullstack generator', function () {
215215
'server/api/user/index.js',
216216
'server/api/user/index.spec.js',
217217
'server/api/user/user.controller.js',
218-
'server/api/user/user.e2e.js',
218+
'server/api/user/user.integration.js',
219219
'server/api/user/user.model.js',
220220
'server/api/user/user.model.spec.js',
221221
'server/auth/index.js',
@@ -347,17 +347,15 @@ describe('angular-fullstack generator', function () {
347347
});
348348
});
349349

350-
// it('should run e2e tests successfully', function(done) {
351-
// this.timeout(80000);
352-
// gen.run({}, function () {
353-
// exec('npm run update-webdriver', function (error, stdout, stderr) {
354-
// exec('grunt test:e2e', function (error, stdout, stderr) {
355-
// expect(stdout, 'Client tests failed \n' + stdout ).to.contain('Done, without errors.');
356-
// done();
357-
// });
358-
// });
359-
// })
360-
// });
350+
it('should run e2e tests successfully', function(done) {
351+
this.timeout(80000);
352+
gen.run({}, function () {
353+
exec('grunt test:e2e', function (error, stdout, stderr) {
354+
expect(stdout, 'Client tests failed \n' + stdout).to.contain('0 failures');
355+
done();
356+
});
357+
});
358+
});
361359
});
362360

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

0 commit comments

Comments
 (0)