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

E2e osx #151

Merged
merged 2 commits into from
Jan 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ sudo: false
env:
- NODE_VERSION=4
- NODE_VERSION=5

os:
- linux
- osx
script: npm run-script test
before_install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.30.1/install.sh | bash; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then source ~/.nvm/nvm-exec; fi
- nvm install $NODE_VERSION
- npm link npm
- npm config set spin false
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"minimatch": "^2.0.10",
"mocha": "^2.2.5",
"rewire": "^2.3.4",
"shelljs": "^0.5.3",
"through": "^2.3.8",
"walk-sync": "^0.2.6"
}
Expand Down
151 changes: 151 additions & 0 deletions tests/e2e/e2e_workflow.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
'use strict';

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

describe('Basic end-to-end Workflow', function () {
before(conf.setup);

after(conf.restore);

it('Installs angular-cli correctly', function() {
this.timeout(300000);

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

sh.exec('npm i angular-cli -g -C ' + process.cwd(), { silent: true });
expect(fs.existsSync(path.join(process.cwd(), 'bin', 'ng')));
});
});

it('Can create new project using `ng new test-project`', function() {
this.timeout(300000);

return ng([
'new',
'test-project',
'--silent'
]).then(function() {
expect(fs.existsSync(path.join(root, 'test-project')));
});
});

it('Can change current working directory to `test-project`', function() {
process.chdir(path.join(root, 'test-project'));
expect(path.basename(process.cwd())).to.equal('test-project');
});

it('Can run `ng build` in created project', function() {
this.timeout(10000);

return ng([
'build',
'--silent'
]).then(function() {
expect(fs.existsSync(path.join(process.cwd(), 'dist')));
});
});

it('Perform `ng test`', function(done) {
this.timeout(30000);

return ng([
'test'
]).then(function(err) {
// TODO when `ng test` will be implemented
//expect(err).to.be.equal(1);
done();
});
});

it('Can create a test component using `ng generate component test-component`', function() {
return ng([
'generate',
'component',
'test-component'
]).then(function() {
var componentDir = path.join(process.cwd(), 'src', 'app', 'components', 'test-component');
expect(fs.existsSync(componentDir));
expect(fs.existsSync(path.join(componentDir, 'test-component.ts')));
expect(fs.existsSync(path.join(componentDir, 'test-component.html')));
expect(fs.existsSync(path.join(componentDir, 'test-component.css')));
});
});

it('Perform `ng test`', function(done) {
this.timeout(30000);

return ng([
'test'
]).then(function(err) {
// TODO when `ng test` will be implemented
//expect(err).to.be.equal(1);
done();
});
});

it('Can create a test service using `ng generate service test-service`', function() {
return ng([
'generate',
'service',
'test-service'
]).then(function() {
var serviceDir = path.join(process.cwd(), 'src', 'app', 'services', 'test-service');
expect(fs.existsSync(serviceDir));
expect(fs.existsSync(path.join(serviceDir, 'test-service.ts')));
expect(fs.existsSync(path.join(serviceDir, 'test-service.spec.ts')));
});
});

it('Perform `ng test`', function(done) {
this.timeout(30000);

return ng([
'test'
]).then(function(err) {
// TODO when `ng test` will be implemented
//expect(err).to.be.equal(1);
done();
});
});

it('Can create a test pipe using `ng generate pipe test-pipe`', function() {
return ng([
'generate',
'pipe',
'test-pipe'
]).then(function() {
var pipeDir = path.join(process.cwd(), 'src', 'app', 'pipes', 'test-pipe');
expect(fs.existsSync(pipeDir));
expect(fs.existsSync(path.join(pipeDir, 'test-pipe.ts')));
expect(fs.existsSync(path.join(pipeDir, 'test-pipe.spec.ts')));
});
});

it('Perform `ng test`', function(done) {
this.timeout(300000);

return ng([
'test'
]).then(function(err) {
// TODO when `ng test` will be implemented
//expect(err).to.be.equal(1);
// Clean `tmp` folder

process.chdir(path.resolve(root, '..'));
sh.rm('-rf', './tmp'); // tmp.teardown takes too long

done();
});
});

});
2 changes: 1 addition & 1 deletion tests/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var Mocha = require('mocha');
var glob = require('glob');

var root = 'tests/{unit,acceptance}';
var root = 'tests/{unit,acceptance,e2e}';
var specFiles = glob.sync(root + '/**/*.spec.js');
var mocha = new Mocha({
timeout: 5000,
Expand Down