[
The above pic i am run protractor Conf.js with particular environmental name which is stored in JSON file
how to test particular environmental URL only in the protractor test case?
[
The above pic i am run protractor Conf.js with particular environmental name which is stored in JSON file
how to test particular environmental URL only in the protractor test case?
To use only in one place a URL from json:
use it in any spec, and you can change the json file every run. I hope i understood correctly.
To pass parameters to protractor, use
--params.jsonFile="./path/to/json/relative/to/currentRunFolder"
and again use it as above using
browser.params.jsonFile
FIRST METHOD - You have to pass the parameters using
params
variable in command line. Update yourconf.js
file to include a parameter calledbaseUrl
and other url variables as shown below -later pass the value in the command prompt. Here's how -
Wherever you have code to get the url in your spec's, use the following code -
SECOND METHOD - If at all you don't want to pass the url to the
params
object everytime, then you can store them in your conf.js or even your specs file and call them. Here's an example -Your
conf.js
file -Now pass the url's that you want to use through command line -
THIRD METHOD - If at all you have a problem of running a test suite with many spec's, in that case above second method wouldn't work. You need to use
browser.get()
in each of your test spec files, in such cases use following method -Update your conf.js file -
Your command line commands -
Your test spec files need to include the
browser.get()
command. Here's how -Hope it helps.