8000 feat(test): protractor integration, e2e test sample · angular/angular-cli@9deb8b3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9deb8b3

Browse files
committed
feat(test): protractor integration, e2e test sample
1 parent ba4f81b commit 9deb8b3

File tree

4 files changed

+40
-4
lines changed

4 files changed

+40
-4
lines changed

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,22 @@ 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+
To run the end-to-end protractor tests you first need to update selenium drivers
78+
once via `$(npm bin)/webdriver-manager update`.
79+
Afterwards you only need to run `$(npm bin)/protractor` while serving via
80+
`ng serve`.
81+
82+
This will be easier when the command
7883
[ng test](https://github.com/angular/angular-cli/issues/70) is implemented.
7984

8085

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"jasmine-core": "^2.3.4",
1919
"karma": "^0.13.15",
2020
"karma-chrome-launcher": "^0.2.1",
21-
"karma-jasmine": "^0.3.6"
21+
"karma-jasmine": "^0.3.6",
22+
"protractor": "^3.0.0"
2223
}
2324
}
Lines changed: 23 additions & 0 deletions
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+
};
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
describe('<%= jsComponentName %> App', function() {
2+
it('should display message saying app works', function() {
3+
browser.get('/');
4+
expect(element(by.css('<%= htmlComponentName %>-app p')).getText())
5+
.toEqual('<%= htmlComponentName %> Works!');
6+
});
7+
});

0 commit comments

Comments
 (0)
0