This repository is DEPRECATED and no longer maintained.
Thank you for all your contributions
A Grunt plugin for running Protractor runner.
This plugin requires Grunt >=0.4.1
.
For Protractor 5.x.x
, please use version v5.x.x
of this plugin.
For Protractor 4.x.x
, please use version v4.x.x
of this plugin.
For Protractor 3.x.x
, please use version v3.x.x
of this plugin.
For Protractor 2.x.x
, please use version v2.x.x
of this plugin.
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
This plugin will install protractor
module locally as a normal dependency.
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-protractor-runner');
Finally you need a Selenium server. If you don't have one set up already, you can install a local standalone version with this command:
./node_modules/grunt-protractor-runner/scripts/webdriver-manager-update
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/example/conf.js", // Default config file
keepAlive: true, // If false, the grunt process stops when the test fails.
noColor: false, // If true, protractor will not use colors in its output.
args: {
// Arguments passed to the command
}
},
your_target: { // Grunt requires at least one target to run so you can simply put 'all: {}' here too.
options: {
configFile: "e2e.conf.js", // Target-specific config file
args: {} // Target-specific arguments
}
},
},
})
Type: String
Default value: No default value
A protractor config file.
Type: Boolean
Default value: false
(true
before v1.0.0)
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: Boolean
Default value: false
If true, protractor will not give colored output. If false, protractor will give colored output, as it does by default.
Type: Boolean
Default value: false
If true, grunt will pass 'debug' as second argument to protractor CLI to enable node CLI debugging as described in Protractor Debugging documentation.
Type: Object
Default value: {}
Arguments passed to the command. These arguments can also be supplied via command-line too. Ex.grunt protractor --specs=specs/some-test.js
or for object options grunt protractor --cucumberOpts={\"tags\":\"@quick\"}
or --params='{ "location" : { "href" : "some url" } }'
Passing object argument with --params.xxx.yyy=zzz
is not supported at the moment. If you need this behaviour, please join the discussion in #148 .
Supported arguments are below.
string
: A running selenium address to usestring
: Location of the standalone selenium server .jar filestring
: Optional port for the standalone selenium serverstring
: URL to prepend to all relative pathsstring
: Element housing ng-app, if not html or bodyarray
: Array of spec files to test. Ex. ["spec1.js","spec2.js"]
array
: Array of files to exclude from testing. Ex. ["spec2.js"]
string
or array
: Suite or Array of suites to run. Ex. ["suite1", "suite2"]
boolean
: Print stack trace on errorboolean
: Print full spec namesstring
: Browser name, e.g. chrome or firefoxobject
: Param object to be passed to the test as browser.paramsstring
: Location of chrome driver overridng the property in config fileboolean
: To connect directly to the browser Drivers. This option is only available for Firefox and Chrome.string
: Username for a SauceLabs accountstring
: Access Key for a SauceLabs accountstring
: Customize the URL Protractor uses to connect to sauce labs (for example, if you are tunneling selenium traffic through a sauce connect tunnel). Default is ondemand.saucelabs.com:80/wd/hub
object
: Capabilities object to be passed to the test, e.g. browserName, platform and versionstring
: Limited support for using mocha as the test framework instead of jasmine.string
: When framework
is set to custom
, set this path relative to the config file or absoluteobject
: Cucumber framework options object to be passed to the test, e.g. require, tags and formatobject
: Mocha test framework options object to be passedstring
: You can specify a file containing code to run once configs are read but before any environment setup. This will only run once, and before onPrepare.string
: You can specify a file containing code to run once protractor is ready and available, and before the specs are executed. If multiple capabilities are being run, this will run once per capability.string
: WebDriver proxy configuration to run remote testsType: String
Default value: false
The file that the task should output the results to.
Type: Object
Default value: {}
Options for output file. For details see: fs.createWriteStream's options
Type: String
Default value: node
Path to the node binary file. Useful if node is not on the PATH.
Type: Boolean
Default value: false
If true, webdriver-manager update
will run and install/update selenium driver.
Run npm install
to install dependencies.
Then run grunt
or npm test
to test the module. You will encounter these.
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.
This plugin installs protractor
module locally as a normal dependency.
In case you want to use the plugin with the global installed protractor command. You can do it with these steps below.
rm -rf node_modules/protractor
protractor
globally with npm install -g protractor
require()
mechanism. See Module loading from the global folders for more information.webdriver-manager update
to install/update selenium driver for global install protractor.You need to install/update selenium webdriver for protractor.
webdriver-manager update
or node scripts/webdriver-manager-update
or node ./node_modules/protractor/bin/webdriver-manager update
5.0.0
protractor
to version 5 (#185)4.0.0
suite
argument (#172)protractor
to version 4 (#168)3.2.0
grunt
version >=0.4.0"
(#154)3.1.0
options.outputOptions
(#143)webDriverProxy
in options.args
(#147)3.0.0
2.1.2
2.1.1
2.1.0
options.webdriverManagerUpdate
option (#125)2.0.0
protractor
to ^2.0.0
(#114)chromeOnly
in options.args
is deprecated. Replaced by directConnect
(#114)beforeLaunch
and onPrepare
in options.args
(#110)1.2.1
split
and through2
from devDependencies to dependencies (#104)1.2.0
options.nodeBin
to specify node binary (#96)1.1.4
webdriver-manager update
step from problematic postinstall to pretest1.1.3
1.1.2
1.1.1
1.1.0
1.0.1
1.0.0
options.keepAlive
to false (#50)0.2.5
0.2.4
0.2.3
0.2.2
protractor
module as a normal dependency and automatically download/update webdriver with webdriver-manager
after installed (#29, #39)0.2.1
0.2.0
require()
function works (#29)peerDependencies
to devDependencies
. These changes might break some user modules. (See FAQ above for explanation) (#29)0.1.11 - Support SauceLabs account config in options.args (#27)
0.1.10
0.1.9
0.1.8 - Support --chromeDriver in options.args (#17)
0.1.7 - Support --browser and --params arguments passed to the protractor command using config in options.args (#12)
0.1.6 - Change protractor(peerDependencies) to support version to 0.x (#8, #9, #10)
0.1.5 - Added options.debug
(#7)
0.1.4 - Change protractor(peerDependencies) to support version to 0.10.x - 0.11.x (#6)
0.1.3 - Fixed Windows command
0.1.2 - Added keepAlive option.