Disclaimer: This is a basic implementation, and much of the configuration files have been lifted from the aurelia skeleton.
##Install dependencies
npm i -D del gulp-protractor
In repository root (same place your tslint.json and so on):
- Create
protractor.conf.js
- Create
aurelia.protractor.js
- Add an
e2eTestRunner
key to youraurelia_project/aurelia.json
with the configuration given below (see fileaurelia.json
) - Add the
e2e
task by putting filese2e.ts
ande2e.json
into youraurelia_project/tasks
folder.
You should now be able to put your e2e tests into test/e2e/src
folder. Here's a basic one to get you going and make sure you're up and working:
describe('App', () => {
beforeEach(() => {
browser.loadAndWaitForAureliaPage('http://localhost:9000');
});
it('should show the home page', () => {
const title = browser.getTitle();
expect(title).toEqual('Home');
});
});
It's up to you to make sure your server is accessible at http://localhost:9000
for the
tests to pass. Luckily running au run
in a separate terminal should get you this!
Further reference: Look at the PageObject approach for maintainable tests.
See also Protractor docs and A style guide - although the latter is 'one way' not the 'true way' necessarily.