1

I had automated all my scenarios using cucumber-protractor framework. All this scenarios run fine when executed individually i.e. closes the browser once scenario is complete but when ran together I am unable to open new browser window after each scenario. It just continues in same browser. Due to SSO login, I have to restart browser after each scenario.

I tried using maxSession, maxInstance in protractor but of no help. Though maxIntance opens new browser, it doesn't close old one and neither passes control to new one. I tried using getWindowHandler as well but that also didn't worked.

Any help is greatly appreciated as I am stuck on this for long time.

2 Answers 2

0

It seems juliemr answers your question:

tests are sharded by file, not by scenario, so you'll need to split the scenarios into separate files.

https://github.com/angular/protractor/issues/864#issuecomment-45571006

So you'll need to split the scenarios into separate feature files and, if desired, set maxInstances to however many you want to run at once. For example:

capabilities: {
    'browserName': 'chrome',
    'shardTestFiles': true,
    'maxInstances': 10
}
0

Add a hook after each scenario to close the browser:

this.After(function(scenario, done) {
  this.quit(done);
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.