Skip to content

Commit 9285856

Browse files
committed
test(gen): add tests for running the e2e tests in production mode
1 parent 6391313 commit 9285856

File tree

4 files changed

+45
-16
lines changed

4 files changed

+45
-16
lines changed

app/templates/Gruntfile.js

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -856,20 +856,33 @@ module.exports = function (grunt) {
856856
}
857857

858858
else if (target === 'e2e') {
859-
return grunt.task.run([
860-
'clean:server',
861-
'env:all',
862-
'env:test',<% if (filters.stylus) { %>
863-
'injector:stylus', <% } %><% if (filters.less) { %>
864-
'injector:less', <% } %><% if (filters.sass) { %>
865-
'injector:sass', <% } %>
866-
'concurrent:test',
867-
'injector',
868-
'wiredep',
869-
'autoprefixer',
870-
'express:dev',
871-
'protractor'
872-
]);
859+
860+
if (option === 'prod') {
861+
return grunt.task.run([
862+
'build',
863+
'env:all',
864+
'env:prod',
865+
'express:prod',
866+
'protractor'
867+
]);
868+
}
869+
870+
else {
871+
return grunt.task.run([
872+
'clean:server',
873+
'env:all',
874+
'env:test',<% if (filters.stylus) { %>
875+
'injector:stylus', <% } %><% if (filters.less) { %>
876+
'injector:less', <% } %><% if (filters.sass) { %>
877+
'injector:sass', <% } %>
878+
'concurrent:test',
879+
'injector',
880+
'wiredep',
881+
'autoprefixer',
882+
'express:dev',
883+
'protractor'
884+
]);
885+
}
873886
}
874887

875888
else if (target === 'coverage') {

app/templates/e2e/main/main.spec(jasmine).js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ describe('Main View', function() {
1010

1111
it('should include jumbotron with correct data', function() {
1212
expect(page.h1El.getText()).toBe('\'Allo, \'Allo!');
13-
expect(page.imgEl.getAttribute('src')).toMatch(/assets\/images\/yeoman.png$/);
13+
expect(page.imgEl.getAttribute('src')).toMatch(/yeoman.png$/);
1414
expect(page.imgEl.getAttribute('alt')).toBe('I\'m Yeoman');
1515
});
1616
});

app/templates/e2e/main/main.spec(mocha).js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ describe('Main View', function() {
1010

1111
it('should include jumbotron with correct data', function() {
1212
<%= does("page.h1El.getText()") %>.eventually.equal('\'Allo, \'Allo!');
13-
<%= does("page.imgEl.getAttribute('src')") %>.eventually.match(/assets\/images\/yeoman.png$/);
13+
<%= does("page.imgEl.getAttribute('src')") %>.eventually.match(/yeoman.png$/);
1414
<%= does("page.imgEl.getAttribute('alt')") %>.eventually.equal('I\'m Yeoman');
1515
});
1616
});

test/test-file-creation.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,10 @@ describe('angular-fullstack generator', function () {
433433
it('should run e2e tests successfully', function(done) {
434434
runTest('grunt test:e2e', this, done, 240000);
435435
});
436+
437+
it('should run e2e tests successfully for production app', function(done) {
438+
runTest('grunt test:e2e:prod', this, done, 240000);
439+
});
436440
});
437441

438442
describe('with other preprocessors and oauth', function() {
@@ -498,6 +502,10 @@ describe('angular-fullstack generator', function () {
498502
it('should run e2e tests successfully', function(done) {
499503
runTest('grunt test:e2e', this, done, 240000);
500504
});
505+
506+
it('should run e2e tests successfully for production app', function(done) {
507+
runTest('grunt test:e2e:prod', this, done, 240000);
508+
});
501509
});
502510

503511
describe('with other preprocessors and no server options', function() {
@@ -565,6 +573,10 @@ describe('angular-fullstack generator', function () {
565573
it('should run e2e tests successfully', function(done) {
566574
runTest('grunt test:e2e', this, done, 240000);
567575
});
576+
577+
it('should run e2e tests successfully for production app', function(done) {
578+
runTest('grunt test:e2e:prod', this, done, 240000);
579+
});
568580
});
569581

570582
describe('with no preprocessors and no server options', function() {
@@ -619,6 +631,10 @@ describe('angular-fullstack generator', function () {
619631
it('should run e2e tests successfully', function(done) {
620632
runTest('grunt test:e2e', this, done, 240000);
621633
});
634+
635+
it('should run e2e tests successfully for production app', function(done) {
636+
runTest('grunt test:e2e:prod', this, done, 240000);
637+
});
622638
});
623639
});
624640
});

0 commit comments

Comments
 (0)