2
votes

I would like to run separate protractor specs without closing the browser in between.

Something like:

  • Open the browser and go to the URL
  • then, run "protractor conf.js --specs=spec1.js"
  • then, do some actions on the SUT, typically do some actions on our simulator (so, non protractor actions)
  • then, run "protractor conf.js --specs=spec2.js"
  • and finally close the browser and shutdown the webdriver.

The goal is to keep the context between the protractor specs execution.

Is it possible?

Correction and Additional information:

My need is to keep the browser opened between two separate test suites (in separate files) and not between two tests. I'm using IE11 alongside selenium standalone server.

Thank you.

1
Have you tried anything actually in code? - Vishal Aggarwal

1 Answers

0
votes

Protractor by default doesnt close the browser between each session unless you specifically ask it do so. The below option in config file controls that.

/** * If true, protractor will restart the browser between each test. Default * value is false. * * CAUTION: This will cause your tests to slow down drastically. */

restartBrowserBetweenTests?: boolean;

Looks like your requirement is

  1. Execute Spec 1
  2. Execute some task outside browser(non-protractor work)
  3. Then Execute Spec 2

Normally how I implement this is - lets say I have a task to validate & confirm email from my outlook , which is a non-protractor task before I run next test case, I just throw an alert at the end of my 1st test case asking the tester to manually verify the email and then accept the alert on the browser and then I will proceed with the second test case