A Grunt plugin for running Protractor runner.
This plugin requires Grunt ~0.4.1
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-protractor-runner --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-protractor-runner');
In your project's Gruntfile, add a section named protractor
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
protractor: {
options: {
configFile: "node_modules/protractor/referenceConf.js", // Default config file
keepAlive: true, // If false, the grunt process stops when the test fails.
args: {
// Arguments passed to the command
}
},
your_target: {
configFile: "e2e.conf.js", // Target-specific config file
options: {
args: {} // Target-specific arguments
}
},
},
})
Type: String
Default value: node_modules/protractor/referenceConf.js
A protractor config file.
Type: Boolean
Default value: true
If true, grunt process continues even if the test fails. This option is useful when using with grunt watch. If false, grunt process stops when the test fails.
Type: Object
Default value: {}
Arguments passed to the command. Supported arguments are below.
- seleniumAddress
string
: A running selenium address to use - seleniumServerJar
string
: Location of the standalone selenium server .jar file - seleniumPort
string
: Optional port for the standalone selenium server - baseUrl
string
: URL to prepend to all relative paths - rootElement
string
: Element housing ng-app, if not html or body - specs
array
: Array of spec files to test. Ex.["spec1.js","spec2.js"]
- includeStackTrace
boolean
: Print stack trace on error - verbose
boolean
: Print full spec names
After npm install
, you need to run script node_modules/protractor/bin/install_selenium_standalone
to download
selenium to selenium/
.
Then run grunt
to test the module. If it runs fine and opens chrome a couple of times without warnings or errors, it means success although it prints 0 tests, 0 assertions, 0 failures
.
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
- 0.1.3 - Fixed Windows command
- 0.1.2 - Added keepAlive option.