Protractor: How do I simulate a page refresh?

Created on 1 Aug 2014  Â·  5Comments  Â·  Source: angular/protractor

I want to test my apps view for the event that a user might refresh the page by either pressing "F5" or by using the browser's refresh button.

How would an e2e test with AngularJS and Protractor look like?
I cannot seem to get any relevant information on the web.

Thank you.

Most helpful comment

browser.driver.navigate().refresh() vs browser.refresh().
browser.refresh() - refresh to the url that I used in browser.get()
browser.driver.navigate().refresh() - refreshes the current url in the window. It respects the click after the browser.get().

Thanks Andy

All 5 comments

Try driver.navigate().refresh()

Andy
On 1 Aug 2014 10:40, "Albert van Niekerk" [email protected] wrote:

I want to test my apps view for the event that a user might refresh the
page by either pressing "F5" or by using the browser's refresh button.

How would an e2e test with AngularJS and Protractor look like?
I cannot seem to get any relevant information on the web.

Thank you.

—
Reply to this email directly or view it on GitHub
https://github.com/angular/protractor/issues/1143.

I think that it is just browser.refresh();

On Fri, Aug 1, 2014 at 5:50 AM, AndyC [email protected] wrote:

Try driver.navigate().refresh()

Andy
On 1 Aug 2014 10:40, "Albert van Niekerk" [email protected]
wrote:

I want to test my apps view for the event that a user might refresh the
page by either pressing "F5" or by using the browser's refresh button.

How would an e2e test with AngularJS and Protractor look like?
I cannot seem to get any relevant information on the web.

Thank you.

—
Reply to this email directly or view it on GitHub
https://github.com/angular/protractor/issues/1143.

—
Reply to this email directly or view it on GitHub
https://github.com/angular/protractor/issues/1143#issuecomment-50867441.

Yup.

browser.driver.navigate().refresh() vs browser.refresh().
browser.refresh() - refresh to the url that I used in browser.get()
browser.driver.navigate().refresh() - refreshes the current url in the window. It respects the click after the browser.get().

Thanks Andy

Is there such a think as a hard browser refresh (Shift-Refresh)?

Was this page helpful?
0 / 5 - 0 ratings