Package Exports
- protractor
- protractor/bin/protractor
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (protractor) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Protractor
Protractor is an end to end test framework for Angular applications built on top of webdriverJS.
Protractor can be run as a standalone binary runner, or included into your tests as a library. Use Protractor as a library if you would like to manage WebDriver and your test setup yourself.
To run the sample tests
Install protractor with.
npm install protractorStart up a selenium server (See the appendix below for help with this). By default, the tests expect the selenium server to be running at http://localhost:4444/wd/hub.
The example folder contains multiple versions of a simple test suite which runs against angularjs.org.
onJasmineNodeSpec.js and onMocha.js show how to use the Protractor library with jasmine-node and mocha. Run these with:
jasmine-node example/onJasmineNodeSpec.js
mocha example/onMocha.jsYou can also run the example suite using the Protractor runner. The runner accepts a configuration file, which runs the tests at example/onProtractor.js.
bin/protractor example/protractorConf.jsUsing the Protractor runner
The Protractor runner is a binary which accepts a config file. The Protractor runner runs tests written in Jasmine, but other adapters may be added in the future.
Install protractor with
npm install protractorCreate a configuration file - an example is shown in node_modules/protractor/conf.js.
cp node_modules/protractor/conf.js myConf.jsEdit the configuration file to point to your tests.
exports.config = {
jasmineNodeOpts: {
specFolders: ['myTest.js', 'myOtherTestFolder']
}
}The configuration file must also specify a way of connection to webdriver. This can be
seleniumAddress: The address of a running selenium standalone server.seleniumServerJar: The location of the selenium standalone .jar file on your machine. Protractor will use this to start up the selenium server.sauceUserandsauceKey: The username and key for a SauceLabs account. Protractor will use this to run tests on SauceLabs.
Run with
node_modules/.bin/protractor myConf.jsOr, if you installed protractor globally (using npm install -g protractor)
protractor myConf.jsUsing the Protractor library
Use the Protractor library if you would like to manage webdriverJs yourself.
Install protractor with
npm install protractorIn your test, set up a webdriver instance, then wrap it with protractor.
var protractor = require('protractor');
var driver;
// Set up driver as a webdriver however you'd like.
var ptor = protractor.wrapDriver(driver);Cloning and running Protractor's own tests
Clone the github repository.
git clone https://github.com/juliemr/protractor.git
cd protractor
npm installStart up a selenium server. By default, the tests expect the selenium server to be running at http://localhost:4444/wd/hub.
Protractor's test suite runs against the included testapp. Start that up with
cd testapp
scripts/web-server.jsThen run the tests with
bin/protractor conf.jsAppendix A: Setting up a standalone selenium server
WebdriverJS does not natively include the selenium server - you must start a standalone selenium server. Download the selenium server. All you need is the latest selenium-server-standalone.
To use with chrome browsers, download chromedriver. More information about chromedriver
Start the selenium standalone with
java -jar selenium-server-standalone-2.x.x.jar