reload
Reload the page.
Syntaxβ
cy.reload()
cy.reload(forceReload)
cy.reload(options)
cy.reload(forceReload, options)
Usageβ
Correct Usage
cy.reload()
Argumentsβ
forceReload (Boolean)
Whether to reload the current page without using the cache. true forces the
reload without cache.
options (Object)
| Option | Default | Description |
|---|---|---|
log | true | Displays the command in the Command log |
timeout | pageLoadTimeout | Time to wait for cy.reload() to resolve before timing out Note: Network requests are limited by the underlying operating system, and may still time out if this value is increased. |
Yields β
cy.reload()yields thewindowobject after the page finishes loading.- It is unsafe
to chain further commands that rely on the yielded
windowaftercy.reload().
Examplesβ
No Argsβ
Reload the page as if the user clicked 'Refresh'β
cy.visit('http://localhost:3000/admin')
cy.get('#undo-btn').click().should('not.be.visible')
cy.reload()
cy.get('#undo-btn').click().should('not.be.visible')
Force Reloadβ
Reload the page without using the cacheβ
cy.visit('http://localhost:3000/admin')
cy.reload(true)
Rulesβ
Requirements β
cy.reload()requires being chained off ofcy.cy.reload()requires the response to becontent-type: text/html.cy.reload()requires the response code to be2xxafter following redirects.cy.reload()requires the loadloadevent to eventually fire.
Assertions β
cy.reload()will automatically wait for assertions you have chained to pass.
Timeouts β
cy.reload()can time out waiting for the page to fire itsloadevent.cy.reload()can time out waiting for assertions you've added to pass.
Command Logβ
Reload the page
cy.reload()
The commands above will display in the Command Log as:

When clicking on reload within the command log, the console outputs the
following:
