Protractor is an end-to-end testing library for AngularJS.
Install:
npm install -g protractor
This will install two command line tools, protractor
and webdriver-manager
.
Set up:
webdriver-manager update
webdriver-manager start
Protractor Config file:
exports.config = { specs: [ './e2etest/**/*.spec.js' ], seleniumAddress: 'http://localhost:4444/wd/hub' };
index.spec.js:
describe('angularjs homepage todo list', function() { it('should add a todo', function() { browser.get('https://angularjs.org'); expect(browser.getTitle()).toBe('AngularJS — Superheroic JavaScript MVW Framework'); }); });
RUN:
protractor conf.js