Files
cypress/docs/source/api/commands/pause.md
Jennifer Shehane cbec33d637 Converted 'its' - 'pause'
- Updated some existing api docs to reflect structure changes
- Added missing ‘pause’ command to sidebar and .yml english.
2017-05-26 14:31:41 -04:00

3.0 KiB

title, comments, description
title comments description
pause true

Stop cy commands from running and allow interaction with the application under test. You can then "resume" running all commands or choose to step through the "next" commands from the Command Log.

{% note info %} This does not set a debugger in your code, unlike .debug() {% endnote %}

Syntax

.pause()
.pause(options)

Usage

.pause() can be chained off of cy or any cy command.

{% fa fa-check-circle green %} Valid Usage

cy.pause().getCookie('app') // Pause at the beginning of commands
cy.get('nav').pause()       // Pause after the `get` commands yield

Arguments

{% fa fa-angle-right %} options (Object)

Pass in an options object to change the default behavior of .pause().

Option Default Notes
log true whether to display command in command log

Yields

.pause() yields the previous command's yield.

Timeout

Examples

Pause

Pause after assertion

cy.get('a').should('have.attr', 'href').and('match', /dashboard/).pause()
cy.get('button').should('not.be.disabled')

Command Log

Pause and step through each .click() command

cy.get('#action-canvas')
  .click(80, 75)
  .pause()
  .click(170, 75)
  .click(80, 165)
  .click(100, 185)
  .click(125, 190)
  .click(150, 185)
  .click(170, 165)

The commands above will display in the GUI as:

screen shot 2017-05-26 at 2 18 10 pm

When clicking on "Next: 'click'" at the top of the Command Log, the Command Log will run only the next command and pause again.

Click "Next"

screen shot 2017-05-26 at 2 18 15 pm

Click "Next" again

screen shot 2017-05-26 at 2 18 24 pm

Click "Next" again

screen shot 2017-05-26 at 2 18 29 pm

Click "Next" again

screen shot 2017-05-26 at 2 18 33 pm

Click "Next" again

screen shot 2017-05-26 at 2 18 36 pm

Click "Next" again, then 'Resume'

screen shot 2017-05-26 at 2 18 51 pm

See also