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

Add support for cy.reload() onBeforeLoad and onLoad callbacks #1895

bdiz opened this Issue Jun 7, 2018 · 1 comment


2 participants

bdiz commented Jun 7, 2018

Current behavior:

Currently there are no options to add onBeforeLoad() and onLoad() callbacks for cy.reload() like there is for cy.visit().

Desired behavior:

I'd like to have these callbacks on cy.reload() too.

In my case, I want to make sure my app still loads and functions on a reload. I have some code that needs to be stubbed in cy.visit in the onBeforeLoad() callback. I need to make these stubs when the app gets reloaded too.


Cypress 3.0.1


This comment has been minimized.


jennifer-shehane commented Jun 7, 2018

Pull requests are welcome, the cy.reload() code should be updated to match how cy.visit() handles this option.

As a workaround today, you can listen to the window:on:before:load event from Cypress like so:

Cypress.on('window:before:load', (win) => {
  // code here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment