Set a debugger and log what the previous command yields.
You need to have your Developer Tools open for
.debug()to hit the breakpoint.
.debug()
.debug(options)
// ---or---
cy.debug()
cy.debug(options)
Correct Usage
cy.debug().getCookie('app') // Pause to debug at beginning of commands
cy.get('nav').debug() // Debug the `get` command's yield
options (Object)
Pass in an options object to change the default behavior of .debug().
| Option | Default | Description |
|---|---|---|
log |
true |
Displays the command in the Command log |
.debug() yields the same subject it was given from the previous command. .get()
cy.get('a').debug().should('have.attr', 'href')
.debug() can be chained off of cy or off another command. .debug() is a utility command. .debug() will not run assertions. Assertions will pass through as if this command did not exist. .debug() cannot time out. Log out the current subject for debugging
cy.get('.ls-btn').click({ force: true }).debug()
The commands above will display in the Command Log as:
When clicking on the debug command within the command log, the console outputs the following:
© 2017 Cypress.io
Licensed under the MIT License.
https://docs.cypress.io/api/commands/debug