Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(e2e): return exit codes on failure of e2e tests #1025

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
8499aed
fix(e2e): return exit codes on failure of e2e tests
marc-sensenich Jun 6, 2016
0a5a235
style: Remove unused variables in e2e command spec
marc-sensenich Jun 6, 2016
58746ea
fix(e2e): Fixed failing spec test for e2e command
marc-sensenich Jun 6, 2016
16a8d6a
Update .travis.yml
marc-sensenich Jun 7, 2016
1231559
style(e2e): Clean up the spec test
marc-sensenich Jun 7, 2016
16aafd3
fix(e2e): Clear e2e spec
marc-sensenich Jun 7, 2016
5dcaaaf
Add e2e spec back in
marc-sensenich Jun 7, 2016
c16c552
Update .travis.yml
marc-sensenich Jun 7, 2016
ab049a7
feat: Implementation of flag to install Angular Material on `new` or …
marc-sensenich Jun 7, 2016
6976eb0
Update .travis.yml
marc-sensenich Jun 7, 2016
44fc045
Revert "Update .travis.yml"
marc-sensenich Jun 7, 2016
94321cb
Revert "Update .travis.yml"
marc-sensenich Jun 7, 2016
d0c4bf0
feat: Implementation of flag to install Angular Material on `new` or …
marc-sensenich Jun 7, 2016
662a163
resolve travis.yml changes
marc-sensenich Jun 7, 2016
2037198
fix(e2e): if error on e2e, reject to get proper error
marc-sensenich Jun 8, 2016
bf74208
fix(e2e): move resolve out of if/else to resolve OSX build issues
marc-sensenich Jun 8, 2016
0408eca
fix(e2e): add logging to e2e_suite to find OSX issues
marc-sensenich Jun 8, 2016
8701b18
fix(e2e): change e2e running in spec in attempt to resolve sequence i…
marc-sensenich Jun 8, 2016
25412db
fix(e2e): remove e2e test with error
marc-sensenich Jun 8, 2016
4386a68
fix(e2e): remove reject from task
marc-sensenich Jun 8, 2016
0366187
fix(e2e): remove change reject to resolve with exit code
marc-sensenich Jun 8, 2016
030fca7
fix(e2e): syntax error
marc-sensenich Jun 8, 2016
d30ce08
fix(e2e): no e2e tests, increased debugging, reject and resolve
marc-sensenich Jun 8, 2016
68c11e5
fix(e2e): additional logging
marc-sensenich Jun 8, 2016
5812b6a
fix(e2e): single resolve
marc-sensenich Jun 9, 2016
3c17606
fix(e2e): change e2e_suite test
marc-sensenich Jun 9, 2016
bbbf68b
Matching changed .travis.yml
marc-sensenich Jun 9, 2016
46762e3
Matching changed .travis.yml
marc-sensenich Jun 9, 2016
26eadff
fix(e2e): return exit codes
marc-sensenich Jun 9, 2016
161ea7c
Merge branch 'e2e-proper-exit-code' into e2e-exit-code
marc-sensenich Jun 9, 2016
61bd6d2
fix(e2e): return exit codes
marc-sensenich Jun 9, 2016
74aea15
fix(e2e): return exit codes
marc-sensenich Jun 9, 2016
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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ before_install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then source ~/.nvm/nvm-exec; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew tap caskroom/cask; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew cask install google-chrome; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew cask install google-chrome --force; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export DISPLAY=:99.0; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sh -e /etc/init.d/xvfb start; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export CHROME_BIN=chromium-browser; fi
Expand Down
6 changes: 4 additions & 2 deletions addon/ng2/tasks/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,19 @@ import {exec} from 'child_process';
module.exports = Task.extend({
run: function () {
var ui = this.ui;
var exitCode = 0;

return new Promise((resolve) => {
exec(`npm run e2e -- ${this.project.ngConfig.e2e.protractor.config}`, (err, stdout, stderr) => {
ui.writeLine(stdout);
if (err) {
if (err) {
ui.writeLine(stderr);
ui.writeLine(chalk.red('Some end-to-end tests failed, see above.'));
exitCode = typeof err.code === 'number' ? err.code : 1;
} else {
ui.writeLine(chalk.green('All end-to-end tests pass.'));
}
resolve();
resolve(exitCode);
});
});
}
Expand Down
54 changes: 54 additions & 0 deletions tests/acceptance/e2e.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
'use strict';

var ng = require('../helpers/ng');
var path = require('path');
var tmp = require('../helpers/tmp');
var conf = require('ember-cli/tests/helpers/conf');
var expect = require('chai').expect;
var root = path.join(process.cwd(), 'tmp');

describe('Acceptance ng e2e: ', function () {
before(function () {
this.timeout(100000);

conf.setup();

return tmp.setup('./tmp').then(function () {
process.chdir('./tmp');
})
});

after(function () {
this.timeout(100000);

conf.restore();
return tmp.teardown('./tmp');
});

it('ng e2e fails outside of angular-cli project', function () {
this.timeout(100000);

expect(ng(['e2e'])).to.throw;
});

it('ng e2e fails without a locally running angular-cli project', function () {
this.timeout(240000);

function executor(resolve, reject) {
ng(['new', 'test-project', '--skip-npm', '--skip-bower']).then(function () {
process.chdir(path.join(root, 'test-project'));
})
.then(function () {
ng(['e2e']).then(function(code) {
const exitCode = typeof code === 'number' ? code : 0;
exitCode !== 0 ? resolve() : reject('ng e2e command closed with error');
})
});
}

return new Promise(executor)
.catch((msg) => {
throw new Error(msg);
});
});
});