Protractor Flake
Rerun potentially flakey protractor tests before failing.
npm i protractor-flake # or globally for easier cli usage npm i -g protractor-flake
Usage
Via the CLI:
npm i -g protractor-flake # protractor-flake <protractor-flake-options> -- <options to be passed to protractor> protractor-flake --parser standard --max-attempts=3 -- path/to/protractor.conf.js
See src/parse-options.js for the full list of command line options.
Protractor flake expects protractor
to be on $PATH by default, but you can use the --protractor-path
argument to point to the protractor executable.
Or programmatically:
var protractorFlake = ; // Default Options // Full Options;
Parsers
Protractor flake defaults to using the standard
parser, which will typically pick up failures run from non-sharded/multi-capability test runs using Jasmine 1 + 2 and Mocha.
There are a few other ways that you can customize your parsing:
- overriding this with the
parser
option, specifying one of the built in parsers. - providing a path to a module (e.g.
/my/module.js
or./module.js
) that exports a parser - a parser (if used programatically)
Parsers should be defined as an object with a parse
method (and optionally a name
property):
moduleexports = { let failedSpecs = // ... analyze protractor test output // ... and add to specFiles failedSpecs // specFiles to be re-run by protractor-flake // if an empty array is returned, all specs will be re-run return ...failedSpecs }
Parser documentation
- Mocha (TODO)
- Jasmine (TODO)
- cucumber
Caveats
This has not yet been tested with Protractor + Mocha. It should function similarly. Please update with an issue or PR if this is not the case.
Tests will not re-run properly (all tests will run each time) if you use a custom reporter that does not log stacktraces for failed tests. For example, if you are using jasmine-spec-reporter with Jasmine 2.0, make sure to set displayStacktrace: 'specs'
or displayStacktrace: 'all'
.
Contributors
See CONTRIBUTING.md