Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

protractor - send spec/suite name as parameter

can I run protractor tests with spec or suite name as a parameter? I'm currently running it with:

protractor myconf.js 

thanks.

like image 296
user2880391 Avatar asked Jul 13 '15 11:07

user2880391


1 Answers

Yes, there is the specific --specs command-line argument:

$ protractor --help
Usage: protractor [options] [configFile]
configFile defaults to protractor.conf.js
The [options] object will override values from the config file.
Options:
  --help                                             Print Protractor help menu                               
  --version                                          Print Protractor version         
...
  --specs                                            Comma-separated list of files to test  

You would still need a config to be passed, but --specs would override the specs set in the configuration:

protractor myconf.js --specs=test/e2e/myspec.js

You can also use the --suite command-line argument:

protractor myconf.js --suite=smoke

where smoke matches the configured suite name:

suites: {
  smoke: 'spec/smoketests/*.js',
  full: 'spec/*.js'
},

Alternatively, if you are using jasmine2, you can make use of the "focused tests" feature by temporarily changing describe to fdescribe and/or it to fit.

like image 84
alecxe Avatar answered Oct 13 '22 05:10

alecxe