Files
cypress/docs/source/api/commands/reload.md
T

1.8 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 Description
log true {% usage_options log %}
timeout {% url pageLoadTimeout configuration#Timeouts %} {% usage_options timeout cy.reload %}

Yields {% helper_icon yields %}

{% yields new_subject cy.reload 'yields the window object after the page finishes loading' %}

Requirements {% helper_icon defaultAssertion %}

{% requirements page cy.reload %}

Timeouts {% helper_icon timeout %}

{% timeouts page cy.reload %}

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:

Command Log

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

Console Log

See also

  • {% url cy.go() go %}
  • {% url cy.visit() visit %}