i am trying to test my angularjs app using protractor. my conf.js looks like this
exports.config = { seleniumAddress: 'http://localhost:4444/wd/hub', capabilities: { 'browserName': 'chrome' }, specs: ['HomePageCtrl_spec.js'], chromeOnly: true, jasmineNodeOpts: { onComplete: null, isVerbose: false, showColors: true, includeStackTrace: true }, onPrepare: function() { browser.manage().window().setSize(1600, 1000); }, params : { url : 'test' }};
and i am runnig this command on command prompt
protractor Conf.js --params.url='https://XXXXX/YYY'
in my spec file, in beforeEach function i am able to get the passed url (console.log((browser.params.url))
is coming correctly), but when i do browser.get(browser.params.url)
.. it is not working
anyone has idea why this is failing?
Answer
Protractor provides it by default. You just have to declare the correct variable.
exports.config = { seleniumAddress: 'http://localhost:4444/wd/hub', capabilities: { 'browserName': 'chrome' }, specs: ['HomePageCtrl_spec.js'], chromeOnly: true, jasmineNodeOpts: { onComplete: null, isVerbose: false, showColors: true, includeStackTrace: true }, onPrepare: function() { browser.manage().window().setSize(1600, 1000); }, baseUrl: 'test' };
and then, you run the tests:
protractor Conf.js --baseUrl="https://XXXXX/YYY"
To use this url within your tests:
browser.get(browser.baseUrl)