How to pass baseUrl from protractor.conf into my test to assert it in tests?

Jakub Mucha picture Jakub Mucha · Aug 21, 2015 · Viewed 14.7k times · Source

What I want to do is:

expect(browser.getCurrentUrl()).toEqual(protractor.baseUrl + urls.cookiesPage());

This is what I get:

 - Expected 'https://somewebsite.com/about/cookies/' to equal 'undefined/about/cookies/'.

How to pass baseUrl from config file into my test so I can assert it?

Answer

Jakub Mucha picture Jakub Mucha · Aug 21, 2015

5 minutes later, I found an answer... after 2 hours of research:

expect(browser.getCurrentUrl()).toEqual(browser.baseUrl + 'some/url/right/here');

So, this was the answer:

browser.baseUrl