mirror of
https://github.com/cypress-io/cypress.git
synced 2026-02-11 09:40:11 -06:00
- 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
1.6 KiB
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:
When clicking on title within the command log, the console outputs the following:
See also
- {% url
cy.document()document %}

