Skip to content

Commit

Permalink
feat(e2e): add ng e2e command
Browse files Browse the repository at this point in the history
  • Loading branch information
filipesilva committed Feb 19, 2016
1 parent 78f7eac commit 4512686
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 25 deletions.
3 changes: 2 additions & 1 deletion addon/ng2/blueprints/ng2/files/e2e/app.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import "angular2/testing";
/// <reference path="../typings/main.d.ts" />

import { <%= jsComponentName %>Page } from './app.po';

describe('<%= htmlComponentName %> App', function() {
Expand Down
2 changes: 0 additions & 2 deletions addon/ng2/blueprints/ng2/files/e2e/app.po.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import "angular2/testing";

export class <%= jsComponentName %>Page {
navigateTo() { return browser.get('/'); }
getParagraphText() { return element(by.css('<%= jsComponentName %>-app p')).getText(); }
Expand Down
13 changes: 9 additions & 4 deletions addon/ng2/blueprints/ng2/files/e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
{
"compilerOptions": {
"target": "ES5",
"module": "commonjs",
"sourceMap": true,
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false
"mapRoot": "",
"module": "system",
"moduleResolution": "node",
"noEmitOnError": true,
"noImplicitAny": false,
"rootDir": ".",
"sourceMap": true,
"sourceRoot": "/",
"target": "es5"
}
}
8 changes: 6 additions & 2 deletions addon/ng2/blueprints/ng2/files/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
"start": "ng server",
"postinstall": "typings install --ambient",
"lint": "tslint src/**/*.ts",
"format": "clang-format -i -style=file --glob=src/**/*.ts"
"format": "clang-format -i -style=file --glob=src/**/*.ts",
"pree2e": "webdriver-manager update",
"e2e": "protractor"
},
"private": true,
"dependencies": {
Expand All @@ -30,12 +32,14 @@
"ember-cli-inject-live-reload": "^1.3.0",
"glob": "^6.0.4",
"jasmine-core": "^2.3.4",
"jasmine-spec-reporter": "^2.4.0",
"karma": "^0.13.15",
"karma-chrome-launcher": "^0.2.1",
"karma-jasmine": "^0.3.6",
"protractor": "^3.0.0",
"tslint": "^3.3.0",
"typescript": "^1.7.3",
"typings": "^0.6.6"
"typings": "^0.6.6",
"ts-node": "^0.5.5"
}
}
24 changes: 11 additions & 13 deletions addon/ng2/blueprints/ng2/files/protractor.conf.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
var SpecReporter = require('jasmine-spec-reporter');

exports.config = {
allScriptsTimeout: 11000,

specs: [
'e2e/**/*.e2e.js'
'e2e/**/*.e2e.ts'
],

capabilities: {
'browserName': 'chrome'
},

directConnect: true,

baseUrl: 'http://localhost:4200/',

framework: 'jasmine',

jasmineNodeOpts: {
defaultTimeoutInterval: 30000
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},

useAllAngular2AppRoots: true,

beforeLaunch: function() {
require('zone.js');
require('reflect-metadata');
}
require('ts-node/register');
},
onPrepare: function() {
jasmine.getEnv().addReporter(new SpecReporter());
},
};
7 changes: 4 additions & 3 deletions addon/ng2/blueprints/ng2/files/typings.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"dependencies": {},
"devDependencies": {
},
"devDependencies": {},
"ambientDevDependencies": {
"jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#26c98c8a9530c44f8c801ccc3b2057e2101187ee"
"angular-protractor": "github:DefinitelyTyped/DefinitelyTyped/angular-protractor/angular-protractor.d.ts#17fa1e5f269189f7f8e0f53f8c443e6c2eac562c",
"jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#26c98c8a9530c44f8c801ccc3b2057e2101187ee",
"selenium-webdriver": "github:DefinitelyTyped/DefinitelyTyped/selenium-webdriver/selenium-webdriver.d.ts#a83677ed13add14c2ab06c7325d182d0ba2784ea"
},
"ambientDependencies": {
"es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#6697d6f7dadbf5773cb40ecda35a76027e0783b2"
Expand Down
20 changes: 20 additions & 0 deletions addon/ng2/commands/e2e.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* jshint node: true */
'use strict';

var Command = require('ember-cli/lib/models/command');
var E2ETask = require('../tasks/e2e');

module.exports = Command.extend({
name: 'e2e',
description: 'Run e2e tests in existing project',
works: 'insideProject',
run: function() {
var e2eTask = new E2ETask({
ui: this.ui,
analytics: this.analytics,
project: this.project
});

return e2eTask.run();
}
});
1 change: 1 addition & 0 deletions addon/ng2/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module.exports = {
'install' : require('./commands/install'),
'uninstall' : require('./commands/uninstall'),
'test' : require('./commands/test'),
'e2e' : require('./commands/e2e'),
'lint' : require('./commands/lint'),
'format' : require('./commands/format')
};
Expand Down
12 changes: 12 additions & 0 deletions addon/ng2/tasks/e2e.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* jshint node: true */
'use strict';

var Promise = require('ember-cli/lib/ext/promise');
var Task = require('ember-cli/lib/models/task');
var exec = Promise.denodeify(require('shelljs').exec);

module.exports = Task.extend({
run: function() {
return exec('npm run e2e');
}
});

0 comments on commit 4512686

Please sign in to comment.