title |
---|
pause |
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 {% url .debug()
debug %}
{% endnote %}
.pause()
.pause(options)
cy.pause()
cy.pause(options)
{% fa fa-check-circle green %} Correct Usage
cy.pause().getCookie('app') // Pause at the beginning of commands
cy.get('nav').pause() // Pause after the 'get' commands yield
{% fa fa-angle-right %} options (Object)
Pass in an options object to change the default behavior of .pause()
.
Option | Default | Description |
---|---|---|
log |
true |
{% usage_options log %} |
{% yields same_subject .pause %}
cy.get('a').should('have.attr', 'href').and('match', /dashboard/).pause()
cy.get('button').should('not.be.disabled')
{% requirements dual .pause %}
{% assertions utility .pause %}
{% timeouts none .pause %}
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 Command Log as:
{% imgTag /img/api/pause/initial-pause-in-gui-highlights-the-pause-command.png "Pause command on intial pause" %}
When clicking on "Next: 'click'" at the top of the Command Log, the Command Log will run only the next command and pause again.
{% imgTag /img/api/pause/next-goes-on-to-next-command-during-pause.png "Pause command after clicking next" %}
{% imgTag /img/api/pause/continue-in-pause-command-just-like-debugger.png "Continue to next command during pause" %}
{% imgTag /img/api/pause/pause-goes-to-show-next-click.png "Pause command" %}
{% imgTag /img/api/pause/clicking-on-canvas-continues-as-we-click-next.png "Pause command" %}
{% imgTag /img/api/pause/last-next-click-before-out-test-is-finished.png "Pause command" %}
{% imgTag /img/api/pause/next-then-resume-shows-our-test-has-ended.png "Pause command" %}
- {% url 'Dashboard' https://on.cypress.io/dashboard %}
- {% url
cy.debug()
debug %} - {% url
cy.log()
log %} - {% url
cy.screenshot()
screenshot %}