Reputation: 764
I am using Protractor typescript for automation of angular application. When i run the using "npm run e2e" then i have observed that angular is always listening on https://localhost:4200.
I Tried to declare baseUrl in Protractor.conf.js as param as below -
params:
{
baseUrl: 'http://www.angular.io'}
,
I am passing that baseUrl to navigate method in e2e-spec.ts as below -
page.navigateTo(browser.params.baseUrl);
But i don't want to pass Url each time in it block to the navigate() method. So i want baseUrl should be set once and reflected or used by all spec-ts file as base url. Like when i run the application using "npm run e2e" it automatically launches https://localhost:4200
Can you please help me , how to change url at one place e.g. in protraactor.conf.js and it should automatically used by navigate() in spec.ts.
Thanks for you help...
Upvotes: 0
Views: 1106
Reputation: 142
Declare the baseUrl in config file as below,
exports.config = {
framework: 'custom',
//frameworkPath: protractorCucumberFramework,
frameworkPath: require.resolve('protractor-cucumber-framework'),
seleniumAddress: 'http://localhost:4444/wd/hub',
baseUrl: 'your application url',
//Browser Configurations
capabilities: {
'browserName': 'chrome',
chromeOptions: {
// Chrome is controlled by automated software : disable"
'args': ['disable-infobars=true'],
}
},
And in Spec file, Call the baseUrl as mentioned below,
browser.get("");
It Should work.
Upvotes: 1