End-to-End Testing with Protractor
Categories: Angular Angular JS
End-to-End Testing with Protractor
Protractor is a new test framework for running end-to-end (E2E) tests. Protractor lets you run tests that exercise the application as a user would. With Protractor E2E testing, you can test various pages, navigate through each page from within the test script, and find any potential defects. Protractor also integrates with most continuous integration build systems.
Installing Protractor
Like Karma, Protractor is a Node.js-based test framework. The Protractor team recommends installing Protractor globally. To do so, open a command-line window and type the command:
npm install -g protractor
Protractor relies on WebDriverJS, so we will also use this command to update WebDriverJS with the latest libraries:
webdriver-manager update
Configuring Protractor
Next, we will create a Protractor configuration file for our project. Create a new JavaScript file named conf.js under the test folder of the Chapter 4 project. Enter the code shown here in the new file:
/ *chapter4/conf.js */
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['e2e/Hw-spec.js']
};