Files
cypress/docs/source/api/commands/title.md
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
title false

Get the document.title property of the page that is currently active.

Syntax

cy.title()
cy.title(options)

Usage

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

cy.title()    // Yields the documents title as a string

Arguments

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

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

Option Default Description
log true {% usage_options log %}
timeout {% url defaultCommandTimeout configuration#Timeouts %} {% usage_options timeout cy.title %}

Yields {% helper_icon yields %}

{% yields sets_subject cy.title 'yields the document.title property of the current page' %}

Examples

No Args

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

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

Rules

Requirements {% helper_icon requirements %}

{% requirements parent cy.title %}

Assertions {% helper_icon assertions %}

{% assertions retry cy.title %}

Timeouts {% helper_icon timeout %}

{% timeouts assertions cy.title %}

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:

Command Log

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

Console Log

See also

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