Protractor Cucumber Framework
npm install --save-dev protractor-cucumber-framework
To implement this framework, utilize the
protractor custom framework config option:
exportsconfig =// set to "custom" instead of cucumber.framework: 'custom'// path relative to the current config fileframeworkPath: require// require feature filesspecs:'path/to/feature/files/**/*.feature' // accepts a globcucumberOpts:// require step definitionsrequire:'path/to/step/definitions/**/*.steps.js' // accepts a glob;
Passing Options to cucumberjs
All of the
cucumberOpts will be passed to
cucumberjs as arguments.
For example, to call cucumberjs with the
--no-colors, and to specify custom formatters:
cucumberOpts:strict: true'no-colors': trueformat: 'progress' 'pretty:output.txt'// ...
The following parameters have special behavior:
require- globs will be expanded to multiple
rerun- value is passed as an argument; for use with the rerun feature
Formatters when tests are sharded or with multi capabilities
If you have a formatter that outputs to a path and your tests are sharded or you have multi capabilities then this library will add the PID to the path to make them unique. The reason for this is multiple processes can write to the same path which ends up clobbering each other. You'll end up with 1 file per process that protractor spawns.
exportsconfig =capabilities:shardTestFiles: true// ...cucumberOpts:format: 'json:results.json'// ...;
If there were 2 feature files then you can expect the following output files...
...where the numbers will be the actual PIDs.
If your process abruptly stops with an exit code
199 then your steps most likely threw an uncaught
exception. Protractor is capturing these and exiting the process in this situation. The solution is
to upgrade to at least protractor version 4.0.10 and add the following to your protractor conf...
This allows cucumber to handle the exception and record it appropriately.
Pull requests are welcome. Commits should have an appropriate message and be squashed.
Ensure that the following dependencies are installed:
- Java SDK and JRE
- Google Chrome
Clone the github repository:
git clone https://github.com/protractor-cucumber-framework/protractor-cucumber-framework cd protractor-cucumber-framework npm install
Start a selenium server:
npm run webdriver
Start the test app that tests will be run against in a separate shell:
Run the tests in a separate shell:
- bump version
- tag release (
git tag v1.0.2 && git push origin master --tags)
- build github release (
npm i -g release && release)