Skip to content

Commit 757c75e

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

File tree

4 files changed

+40
-4
lines changed

4 files changed

+40
-4
lines changed

README.md

+8-3
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

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"jasmine-core": "^2.3.4",
1414
"karma": "^0.13.15",
1515
"karma-chrome-launcher": "^0.2.1",
16-
"karma-jasmine": "^0.3.6"
16+
"karma-jasmine": "^0.3.6",
17+
"protractor": "^3.0.0"
1718
}
1819
}
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,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)