document.title property of the page that is currently active.
cy.title() // Yields the documents title as a string
Pass in an options object to change the default behavior of
||Displays the command in the Command log|
||Time to wait for
document.titleproperty of the current page.
Assert that the document’s title is “My Awesome Application”
cy.title().should('eq', 'My Awesome Application')
cy.title()requires being chained off of
cy.title()will automatically retry itself until assertions you've chained all pass.
cy.title()can time out waiting for assertions you've added to pass.
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: