Skip to content

Commit d2b33e3

Browse files
committed
feat(test): protractor integration, e2e test sample
1 parent 0f66aac commit d2b33e3

File tree

4 files changed

+42
-4
lines changed

4 files changed

+42
-4
lines changed

README.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,21 @@ The build artifacts will be stored in the `dist/` directory.
6464

6565
### Running tests
6666

67-
Before running the tests make sure that the project is built. To build the
67+
Before running the tests make sure that the project is built. To build the
6868
project once you can use:
6969

7070
```bash
7171
ng build
7272
```
7373

74-
With the project built in the `dist/` folder you can just run: `karma start`.
74+
With the project built in the `dist/` folder you can just run: `karma start`.
7575
Karma will run the tests and keep the browser open waiting to run again.
7676

77-
This will be easier when the command
77+
This will be easier when the command
7878
[ng test](https://github.com/angular/angular-cli/issues/70) is implemented.
7979

80+
To run the end-to-end protractor tests, do `$(npm bin)/protractor` while running `ng serve`.
81+
8082

8183
### Deploying the app via GitHub Pages
8284

addon/ng2/blueprints/ng2/files/package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
"name": "<%= htmlComponentName %>",
33
"version": "0.0.0",
44
"license": "Apache-2.0",
5+
"scripts":{
6+
"postinstall": "webdriver-manager update"
7+
},
58
"dependencies": {
69
"systemjs": "0.19.4",
710
"angular2": "2.0.0-alpha.48"
@@ -13,6 +16,7 @@
1316
"jasmine-core": "^2.3.4",
1417
"karma": "^0.13.15",
1518
"karma-chrome-launcher": "^0.2.1",
16-
"karma-jasmine": "^0.3.6"
19+
"karma-jasmine": "^0.3.6",
20+
"protractor": "^3.0.0"
1721
}
1822
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
exports.config = {
2+
allScriptsTimeout: 11000,
3+
4+
specs: [
5+
'dist/**/*.e2e.js'
6+
],
7+
8+
capabilities: {
9+
'browserName': 'chrome'
10+
},
11+
12+
directConnect: true,
13+
14+
baseUrl: 'http://localhost:4200/',
15+
16+
framework: 'jasmine',
17+
18+
jasmineNodeOpts: {
19+
defaultTimeoutInterval: 30000
20+
},
21+
22+
useAllAngular2AppRoots: true
23+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
describe('<%= jsComponentName %> App', function() {
2+
3+
// #docregion redirect
4+
it('should display message saying app works', function() {
5+
browser.get('/');
6+
expect(element(by.css('<%= htmlComponentName %>-app p')).getText())
7+
.toEqual('<%= htmlComponentName %> Works!');
8+
});
9+
});

0 commit comments

Comments
 (0)