-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
browser.getLocationAbsUrl() has different behavior testing angular 1.2.26 and 1.3.0-RC.5 #1436
Comments
This is working as intended but was accidentally omitted from the documentation at #1436. Does this cause issues for you besides just being a breaking change? |
At this point it won't cause me issues, but it's a little weird to ask for an absolute url (getLocationAbsUrl) and to get back a relative one. Other than that weirdness, I can see the argument for not having the absolute url exposed. |
@juliemr Can we reopen this issue? Due to #778 issue, we will need getLocationAbsUrl() to return the full abs path as a workaround. Currently in 1.4.0, I even get empty string when I am expecting something like http://localhost:8000/static/xxx/login.html |
https://code.angularjs.org/1.3.15/docs/tutorial/step_06 |
I'm using protractor 1.8.0, and this API got me confuse for a while. I was sure the problem was with my configuration. My belief was reinforced by the official documentation (http://angular.github.io/protractor/#/api?view=Protractor.prototype.getLocationAbsUrl). Should the the API be renamed to getLocationUrl() instead and documentation updated?! I can try to create a pull request if needed. |
So what is the way to get the absolute URL now in angular 1.3+? I would agree that the method should be renamed to getLocationUrl, if it's not really returning the absolute URL, otherwise it's really confusing. |
my config : Angular 1.4.3, protractor - 2.1.0
error: expected undefined to be '/phones/nexus-s' But: ( http://angular.github.io/protractor/#/api?view=webdriver.WebDriver.prototype.getCurrentUrl ) |
Is there a way to get absolute url? It's breaking legacy tests on protractor 1.7 and AngularJS 1.4.7 |
Instead I can use |
Using angular 1.3 in the app under test and protractor 1.3.1 browser.getLocationAbsUrl() returns a relative url instead of the absUrl due to using angular.getTestability().getLocation() instead of$location.absUrl(). It's probably as easy as adding a getLocationAbs() to $ $testability, but that goes into architectural questions I don't have context for.
So for a clear example, for URL http://domain.com/path?a=b#/hash on chrome (probably others, but not tested):
The relevant protractor code is at:
https://github.com/angular/protractor/blob/master/lib/clientsidescripts.js#L567
As well as the relevant angular code at:
https://github.com/angular/angular.js/blob/85880a64900fa22a61feb926bf52de0965332ca5/src/ng/testability.js#L84
https://github.com/angular/angular.js/blob/1efaf3dc136f822703a9cda55afac7895a923ccb/src/ng/location.js#L348
I hope that's clear, but if you need anything else or if there's clear direction for what I can do to fix it, let me know.
Thanks!
The text was updated successfully, but these errors were encountered: