Q:

Is there a way to retrieve the current relative url in Protractor?

I'm starting to test an Angular2 project and I want to retrieve the URL of the browser in some tests to check that redirections are made correctly.
The problem is that the only method I can see in the API to retrieve the current URL is webdriver.WebDriver.getCurrentUrl, but it returns the absolute path. This can be a pain if for some reason you change the testing port or hostname in the future. Is there any way to retrieve only the relative URL like you can do with browser.get? Thanks.

A:

To keep things simple - To handle future changes to host & port, you can just do this.
expect(browser.getCurrentUrl()).toContain("/some/path/resource");

