Files
cypress/docs/source/api/commands/log.md
T
Brian Mann 91bb010fd6 docs: fixes #231, cleanup all the API docs + notes
- go into more detail on trigger vs action commands
- explain actionability further
- better format notes + examples
- consistent no arg / arg examples
- es6 all the functions
- remove duplicated intractability content
- remove simulated events garbage
- go into more detail on pseudo action commands
- much better cy.contains usage
2017-06-30 18:33:52 -04:00

1.6 KiB

title, comments
title comments
log false

Print a message to the Cypress Command Log.

Syntax

cy.log(message)
cy.log(message, args...)

Usage

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

cy.log('created new user')    

Arguments

{% fa fa-angle-right %} message (String)

Message to be printed to Cypress Command Log.

{% fa fa-angle-right %} args...

Additional arguments to be printed to the Cypress Command Log. There is no limit to the number of arguments.

Yields {% helper_icon yields %}

{% yields null cy.log %}

Examples

Message

Print a message to the Command Log.

cy.click('Login')
cy.url().should('not.include', 'login')
cy.log('Login successful')

Args

Print a message with arguments to the Command Log.

cy.log('events triggered', events)

Rules

Requirements {% helper_icon requirements %}

{% requirements parent cy.log %}

Assertions {% helper_icon assertions %}

{% assertions none cy.log %}

Timeouts {% helper_icon timeout %}

{% timeouts none cy.log %}

Command Log

Print messages with arguments to the Command Log.

cy.log('log out any message we want here')
cy.log('another message', ['one', 'two', 'three'])

The commands above will display in the command log as:

Command Log log

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

Console log log

See also

  • {% url cy.exec() exec %}