2

Following the lead of this question, I tried (naievely) to do this:

protractor test/features/protractor-conf.js --params.test_set=dev_test

and

protractor-conf.js:

exports.config = {
   // ...
  specs: [browser.params.test_set+'/*.feature'],

... but of course it doesn't work because browser is not defined at the time that the conf file is parse.

So how could I achieve this effect: passing a parameter to protractor that determines the specs?

Community
  • 1
  • 1
GreenAsJade
  • 14,459
  • 11
  • 63
  • 98

1 Answers1

2

Use the --specs command-line argument:

--specs Comma-separated list of files to test

protractor test/features/protractor-conf.js --specs=dev_test/*.feature

Note that dev_test/*.feature would be passed into the protractor's command-line-interface which would resolve the paths based on the current working directory (source code).

alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
  • Fingers crossed - this looks exactly what I'm after. I'm about to explore this, but I fear the syntax can't quite be right, because we want to pass the wildcard in to protractor, not have the shell expand it? – GreenAsJade Jun 25 '15 at 04:07
  • @GreenAsJade okay, I've quickly tried something similar. In my case it was `protractor test/e2e/config/local.conf.js --specs=test/e2e/specs/*.js` and it worked for me. – alecxe Jun 25 '15 at 04:09
  • Wierd, I just found the same. I don't understand why, but ... yay :) At least this point of concern is addressed for others now. I'd love to know why it works... I guess there's a stack of stuff going on during invocation that I haven't delved into what is processing what... – GreenAsJade Jun 25 '15 at 04:09
  • @GreenAsJade shell is not expanding the paths here - the glob pattern is passed into the protractor command line interface as a string which is further processed and passed to the task scheduler. I've added some explanation, hope that clears things up a bit.. – alecxe Jun 25 '15 at 04:25