1

Jasmine offers way to run helper files before specs using its helpers option. I wanted to use a helper file to add a global beforeEach call, so all tests run this before they are started. But I somehow fail to find the way to do this using protractor (that uses Jasmine).

How can I add helpers option for jasmine in Protractor. Can I somewhere specify Jasmine's options?

alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
redhead
  • 1,264
  • 1
  • 17
  • 32

1 Answers1

2

According to the documentation, helpers scripts are executed before the specs. In protractor, this is what onPrepare() function is responsible for. Here is a sample onPrepare() function that logs into the application before any specs were executed.

Also, here is a relevant topic on the subject of sharing the beforeEach() setup across specs:

Community
  • 1
  • 1
alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195