mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-21 22:34:21 +08:00
feat(e2e): add ng e2e command
This commit is contained in:
parent
0228140d02
commit
e2e4f563f4
11
README.md
11
README.md
@ -152,16 +152,13 @@ Tests will execute after a build is executed via [Karma](http://karma-runner.git
|
|||||||
|
|
||||||
### Running end-to-end tests
|
### Running end-to-end tests
|
||||||
|
|
||||||
Before running the tests make sure that you have an updated webdriver and that
|
|
||||||
the tests are built:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$(npm bin)/webdriver-manager update
|
ng e2e
|
||||||
$(npm bin)/tsc -p e2e/
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Afterwards you only need to run `$(npm bin)/protractor` while serving via
|
Before running the tests make sure you are serving the app via `ng serve`.
|
||||||
`ng serve`.
|
|
||||||
|
End-to-end tests are ran via [Protractor](https://angular.github.io/protractor/).
|
||||||
|
|
||||||
|
|
||||||
### Deploying the app via GitHub Pages
|
### Deploying the app via GitHub Pages
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import "angular2/testing";
|
/// <reference path="../typings/main.d.ts" />
|
||||||
|
|
||||||
import { <%= jsComponentName %>Page } from './app.po';
|
import { <%= jsComponentName %>Page } from './app.po';
|
||||||
|
|
||||||
describe('<%= htmlComponentName %> App', function() {
|
describe('<%= htmlComponentName %> App', function() {
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
import "angular2/testing";
|
|
||||||
|
|
||||||
export class <%= jsComponentName %>Page {
|
export class <%= jsComponentName %>Page {
|
||||||
navigateTo() { return browser.get('/'); }
|
navigateTo() { return browser.get('/'); }
|
||||||
getParagraphText() { return element(by.css('<%= jsComponentName %>-app p')).getText(); }
|
getParagraphText() { return element(by.css('<%= jsComponentName %>-app p')).getText(); }
|
||||||
|
@ -1,11 +1,16 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ES5",
|
|
||||||
"module": "commonjs",
|
|
||||||
"sourceMap": true,
|
|
||||||
"declaration": false,
|
"declaration": false,
|
||||||
"emitDecoratorMetadata": true,
|
"emitDecoratorMetadata": true,
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"removeComments": false
|
"mapRoot": "",
|
||||||
|
"module": "system",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"noEmitOnError": true,
|
||||||
|
"noImplicitAny": false,
|
||||||
|
"rootDir": ".",
|
||||||
|
"sourceMap": true,
|
||||||
|
"sourceRoot": "/",
|
||||||
|
"target": "es5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,9 @@
|
|||||||
"start": "ng server",
|
"start": "ng server",
|
||||||
"postinstall": "typings install --ambient",
|
"postinstall": "typings install --ambient",
|
||||||
"lint": "tslint src/**/*.ts",
|
"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,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -30,12 +32,14 @@
|
|||||||
"ember-cli-inject-live-reload": "^1.3.0",
|
"ember-cli-inject-live-reload": "^1.3.0",
|
||||||
"glob": "^6.0.4",
|
"glob": "^6.0.4",
|
||||||
"jasmine-core": "^2.3.4",
|
"jasmine-core": "^2.3.4",
|
||||||
|
"jasmine-spec-reporter": "^2.4.0",
|
||||||
"karma": "^0.13.15",
|
"karma": "^0.13.15",
|
||||||
"karma-chrome-launcher": "^0.2.1",
|
"karma-chrome-launcher": "^0.2.1",
|
||||||
"karma-jasmine": "^0.3.6",
|
"karma-jasmine": "^0.3.6",
|
||||||
"protractor": "^3.0.0",
|
"protractor": "^3.0.0",
|
||||||
"tslint": "^3.3.0",
|
"tslint": "^3.3.0",
|
||||||
"typescript": "^1.7.3",
|
"typescript": "^1.7.3",
|
||||||
"typings": "^0.6.6"
|
"typings": "^0.6.6",
|
||||||
|
"ts-node": "^0.5.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,28 +1,26 @@
|
|||||||
|
var SpecReporter = require('jasmine-spec-reporter');
|
||||||
|
|
||||||
exports.config = {
|
exports.config = {
|
||||||
allScriptsTimeout: 11000,
|
allScriptsTimeout: 11000,
|
||||||
|
|
||||||
specs: [
|
specs: [
|
||||||
'e2e/**/*.e2e.js'
|
'e2e/**/*.e2e.ts'
|
||||||
],
|
],
|
||||||
|
|
||||||
capabilities: {
|
capabilities: {
|
||||||
'browserName': 'chrome'
|
'browserName': 'chrome'
|
||||||
},
|
},
|
||||||
|
|
||||||
directConnect: true,
|
directConnect: true,
|
||||||
|
|
||||||
baseUrl: 'http://localhost:4200/',
|
baseUrl: 'http://localhost:4200/',
|
||||||
|
|
||||||
framework: 'jasmine',
|
framework: 'jasmine',
|
||||||
|
|
||||||
jasmineNodeOpts: {
|
jasmineNodeOpts: {
|
||||||
defaultTimeoutInterval: 30000
|
showColors: true,
|
||||||
|
defaultTimeoutInterval: 30000,
|
||||||
|
print: function() {}
|
||||||
},
|
},
|
||||||
|
|
||||||
useAllAngular2AppRoots: true,
|
useAllAngular2AppRoots: true,
|
||||||
|
|
||||||
beforeLaunch: function() {
|
beforeLaunch: function() {
|
||||||
require('zone.js');
|
require('ts-node/register');
|
||||||
require('reflect-metadata');
|
},
|
||||||
}
|
onPrepare: function() {
|
||||||
|
jasmine.getEnv().addReporter(new SpecReporter());
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
{
|
{
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"devDependencies": {
|
"devDependencies": {},
|
||||||
},
|
|
||||||
"ambientDevDependencies": {
|
"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": {
|
"ambientDependencies": {
|
||||||
"es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#6697d6f7dadbf5773cb40ecda35a76027e0783b2"
|
"es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#6697d6f7dadbf5773cb40ecda35a76027e0783b2"
|
||||||
|
20
addon/ng2/commands/e2e.js
Normal file
20
addon/ng2/commands/e2e.js
Normal file
@ -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();
|
||||||
|
}
|
||||||
|
});
|
@ -10,6 +10,7 @@ module.exports = {
|
|||||||
'install' : require('./commands/install'),
|
'install' : require('./commands/install'),
|
||||||
'uninstall' : require('./commands/uninstall'),
|
'uninstall' : require('./commands/uninstall'),
|
||||||
'test' : require('./commands/test'),
|
'test' : require('./commands/test'),
|
||||||
|
'e2e' : require('./commands/e2e'),
|
||||||
'lint' : require('./commands/lint'),
|
'lint' : require('./commands/lint'),
|
||||||
'format' : require('./commands/format')
|
'format' : require('./commands/format')
|
||||||
};
|
};
|
||||||
|
12
addon/ng2/tasks/e2e.js
Normal file
12
addon/ng2/tasks/e2e.js
Normal file
@ -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');
|
||||||
|
}
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user