atecarlos / protractor-http-mock

A library designed to work alongside Protractor for setting up mocks for your HTTP ajax requests.
MIT License
173 stars 70 forks source link

browser.get(***) inside a suite breaks the mocks #101

Closed deonclem closed 8 years ago

deonclem commented 8 years ago

If I'm inside a test and manually update the url (using browser.get(path)), all the mocked calls aren't working anymore and I get a bunch of 404's instead. Same problem with browser.navigate().refresh()

I might be missing something but is there a way around this ? I need to reload my page with different url params to test different scenarios but I can't achieve that.

atecarlos commented 8 years ago

Hi @deonclem . I haven't tried this myself, but here is something I think should work:

Have you tried splitting each new page load into separate tests? Something similar to this were each "get()" call would be a call to a new URL. This way the mocks can be setup before the page is loaded for each URL. Note: if you have the same mocks for all URLs, you can put the "mock(...)" call in a "beforeEach()".

Let me know how it goes.