1.9 KiB
title, comments
| title | comments |
|---|---|
| reload | false |
Reload the page.
Syntax
cy.reload()
cy.reload(forceReload)
cy.reload(options)
cy.reload(forceReload, options)
Usage
cy.reload() cannot be chained off any other cy commands, so should be chained off of cy for clarity.
{% fa fa-check-circle green %} Valid Usage
cy.reload()
Arguments
{% fa fa-angle-right %} forceReload (Boolean)
Whether to reload the current page without using the cache. true forces the reload without cache.
{% fa fa-angle-right %} options (Object)
| Option | Default | Notes |
|---|---|---|
log |
true |
Whether to display command in Command Log |
timeout |
{% url pageLoadTimeout configuration#Timeouts %} |
Total time to reload the page |
Yields {% helper_icon yields %}
cy.reload() yields the window object of the newly loaded page.
Timeout {% helper_icon timeout %}
cy.reload() will wait for the load event of the newly loaded page for the duration of the {% url pageLoadTimeout configuration#Timeouts %} or the duration of the timeout specified in the command's options.
Examples
Reload
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)
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:
See also
- {% url
cy.go()go %} - {% url
cy.location()location %} - {% url
cy.visit()visit %}

