Skip to content

Commit

Permalink
feat(test): protractor integration, e2e test sample
Browse files Browse the repository at this point in the history
  • Loading branch information
filipesilva committed Dec 18, 2015
1 parent ba4f81b commit dd508ad
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 4 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,22 @@ The build artifacts will be stored in the `dist/` directory.

### Running tests

Before running the tests make sure that the project is built. To build the
Before running the tests make sure that the project is built. To build the
project once you can use:

```bash
ng build
```

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

This will be easier when the command
To run the end-to-end protractor tests you first need to update selenium drivers
once via `$(npm bin)/webdriver-manager update`.
Afterwards you only need to run `$(npm bin)/protractor` while serving via
`ng serve`.

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


Expand Down
3 changes: 2 additions & 1 deletion addon/ng2/blueprints/ng2/files/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"jasmine-core": "^2.3.4",
"karma": "^0.13.15",
"karma-chrome-launcher": "^0.2.1",
"karma-jasmine": "^0.3.6"
"karma-jasmine": "^0.3.6",
"protractor": "^3.0.0"
}
}
23 changes: 23 additions & 0 deletions addon/ng2/blueprints/ng2/files/protractor.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
exports.config = {
allScriptsTimeout: 11000,

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

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

directConnect: true,

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

framework: 'jasmine',

jasmineNodeOpts: {
defaultTimeoutInterval: 30000
},

useAllAngular2AppRoots: true
};
7 changes: 7 additions & 0 deletions addon/ng2/blueprints/ng2/files/src/app/__name__.e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
describe('<%= jsComponentName %> App', function() {
it('should display message saying app works', function() {
browser.get('/');
expect(element(by.css('<%= htmlComponentName %>-app p')).getText())
.toEqual('<%= htmlComponentName %> Works!');
});
});

0 comments on commit dd508ad

Please sign in to comment.