angular / protractor

E2E test framework for Angular apps
http://www.protractortest.org
MIT License
8.75k stars 2.31k forks source link

getLocationAbsUrl on a non-angular page expects angular to exist #3097

Open cnishina opened 8 years ago

cnishina commented 8 years ago

Clicking on my "doge meme" link and testing to see the abs url should work. Instead receive error message: "Failed: unknown error: angular is not defined".

website:

<ul class="pet" id="pet_id">
  <li class="dog" id="dog_id" name="dog_name">wow such <a href="https://en.wikipedia.org/wiki/Doge_(meme)">Doge meme</a></li>
  <li class="cat" id="cat_id" name="cat_name">Cat</li>
</ul>

spec.js:

it('should be clicked', function() {
    browser.ignoreSynchronization = true;
    browser.get('http://localhost:8000/web.html');
    element(by.partialLinkText('Doge')).click();
    expect(browser.getLocationAbsUrl()).toBe('https://en.wikipedia.org/wiki/Doge_(meme)');
  });

repo: https://github.com/cnishina/protractor-examples/tree/master/webdriver

juliemr commented 8 years ago

This is a documentation fail for us.

getLocationAbsUrl is meaningless without Angular. It's intended as a supplement to getCurrentUrl when that doesn't work. (some IE situations)

Maybe we should rename it to something more useful, or make it very clear in the documentation that it doesn't work for other pages.

juliemr commented 8 years ago

We should fix this and the docs for https://github.com/angular/protractor/issues/3007 at the same time - related issue.