Reputation: 95
How can we run the same test multiple times in Protractor?
Looks like this has been a problem before, any solution for this?
Upvotes: 4
Views: 4191
Reputation: 1
Doing a for loop, like in Linux, didn't work for me. What worked for me was this command:
for /l %A in (1, 1, 100) do protractor conf.js %A
/l means we use it for numbers. %A means it's a command line (%%A is used for a batch file)
Upvotes: -1
Reputation: 473803
Solve it on a higher level with bash running protractor from the command line N times:
Or, you can also do it via the grunt
task manager, sample can be found here:
There is also protactor-flake
package that will automatically rerun failing protractor tests.
Upvotes: 3
Reputation: 9072
Similar to what @alecxe suggested, I do this in the bash shell to run protractor n times to find tests that fail intermittently:
for ((n=0;n<100;n++)); do protractor protractor.conf.js; done
I use jasmine-spec-reporter, and often add a grep at the end to find only the errors:
for ((n=0;n<10;n++)); do protractor ./protractor/protractor.conf.js; done | grep FAILED
Upvotes: 1