Restarting browser after every feature file cucumberjs

882 views Asked by At

Currently we have an automation framework built using cucumberjs/protractor. As is now, all of our tests run in one browser instance.. this causes issues with our mocking system as it causes instabilities as more and more tests run. What is the easiest solution to make cucumberjs tests kick off a fresh browser instance at every new feature file? Would it include configuring the hooks.js?

1

There are 1 answers

4
RedMage On

Create a before hook in your hooks.js:

this.Before(()=> {
  this.browser.restart();
})

http://www.protractortest.org/#/api?view=ProtractorBrowser.prototype.restart