Files
cypress/docs/source/api/commands/title.md
2017-06-09 14:04:20 -04:00

1.6 KiB

title, comments
title comments
title true

Get the title of the document.

Syntax

cy.title()
cy.title(options)

Usage

cy.title() 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.title()    

Arguments

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

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

Option Default Notes
log true Whether to display command in Command Log

Yields

cy.title() yields the document title as a string.

Timeout

cy.title() will continue to retry for the duration of the defaultCommandTimeout

Examples

Title

Assert that the document's title is "My Awesome Application"

cy.title().should('eq', 'My Awesome Application')

Command Log

Assert that the document's title includes 'New User'

cy.title().should('include', 'New User')

The commands above will display in the command log as:

screen shot 2015-11-29 at 2 12 54 pm

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

screen shot 2015-11-29 at 2 13 06 pm

See also

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