mirror of
https://github.com/cypress-io/cypress.git
synced 2026-02-22 06:59:30 -06:00
1.6 KiB
1.6 KiB
title, comments
| title | comments |
|---|---|
| log | true |
Print a message to the Cypress Command Log.
Syntax
cy.log(message)
cy.log(message, args...)
Usage
cy.log() cannot be chained off any other cy commands, so should be chained off of cy for clarity.
{% fa fa-check-circle green %} Valid 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
cy.log() yields null.
Timeout
Examples
Message
Print a message to the Command Log.
cy.click('Login')
cy.url().should('not.include', 'login')
cy.log('Login successful')
Arguments
Print a message with arguments to the Command Log.
cy.log('events triggered', events)
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:
When clicking on log within the command log, the console outputs the following:
See also
- {% url
cy.exec()exec %}