i use protractor v1.4.0 and I want to set protractor baseUrl from command line so i can't use
baseUrl: 'http://localhost:8000/',
config option in protractor configuration file. I want to define default value for base url with "params" option in protractor configuration file as follows:
params: {
baseUrl: 'http://localhost:8080/'
},
and then overwrite the default value by passing a new value from command line when i run protractor as follows:
protractor 'path_to_my_conf_file' --params.baseUrl http://localhost:80/
then in my spec file i need to set base url using protractor API, but i can't find how to do that.
The 1-st answer to the following question is exactly what i need but it doesn't work.
How can I add URL's dynamically to Protractor tests?
As another option, could also try browser.baseUrl = "https://test-url.com"
in onPrepare
(works in Protractor 1.4.0)
You can just change it from the command line like so:
protractor --baseUrl http://whateveryouwant
Run tests via grunt
with grunt-protractor-runner
and grunt-option
libraries:
protractor: {
options: {
configFile: "path_to_my_conf_file",
args: {
baseUrl: grunt.option('baseUrl', 'http://localhost:80/')
}
}
}
Then, run the task via:
grunt protractor --baseUrl=http://mynewurl
And, to let it use the default baseUrl
, just run:
grunt protractor
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With