Files
cypress/docs/source/api/commands/debug.md
2017-05-26 16:10:23 -04:00

1.6 KiB

title, comments, description
title comments description
debug true

Set a debugger and log what the previous command yields.

{% note warning %} You need to have your Developer Tools open for .debug() to hit the breakpoint. {% endnote %}

Syntax

.debug()
.debug(options)

Usage

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

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

cy.debug().getCookie('app') // Pause to debug at beginning of commands
cy.get('nav').debug()       // Debug the `get` commands yield

Arguments

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

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

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

Yields

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

Timeout

Examples

Debug

Pause with debugger after get()

cy.get('a').debug().should('have.attr', 'href')

Command Log

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:

screen shot 2017-05-24 at 4 10 23 pm

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

screen shot 2017-05-24 at 4 10 08 pm

See also