Cypress reload command reloads the web page.
Syntax
cy.reload()
cy.reload(forceReload)
cy.reload(options)
cy.reload(forceReload, options)
Arguments Used In Reload Command
- force-reload: This argument reloads the page without using the cache. True forces the reload without cache.
- Options: Log: To display the command in the command log. Timeout: Wait for some particular thing to get finished before timing out.
- The reload command must be chained off with only cy.
- It requires the response type to be content-type: text/HTML.
- It requires the load event to fire.
- cy.reload automatically waits for assertions that's chained to pass.
Reload Correct Use:
cy.reload()
cy.reload() yields the window object after the page reloading.
Let us take a look at some of the examples with arguments:
describe('Automate AutoPract',()=>{
it('Should load the url',()=>{
cy.visit('http://www.autopract.com/#/home/fashion')
cy.reload()
})
This will reload the page autopract.
describe('Automate AutoPract',()=>{
it('Should load the url',()=>{
cy.visit('http://www.autopract.com/#/home/fashion')
cy.reload(true)
})
This will force reload the page without cache as the true argument is passed inside.
- Log in to post comments