Skip to content

Latest commit

 

History

History
78 lines (50 loc) · 1.38 KB

File metadata and controls

78 lines (50 loc) · 1.38 KB
title description sidebar_label
end | Cypress Documentation
End a chain of commands in Cypress.
end

end

End a chain of commands.

Syntax

.end()

Usage

Correct Usage

cy.contains('ul').end() // Yield 'null' instead of 'ul' element

Incorrect Usage

cy.end()
  • .end() yields null.

Examples

.end() is useful when you want to end a chain of commands and force the next command to not receive what was yielded in the previous command.

cy.contains('User: Cheryl')
  .click()
  .end() // yield null
  .contains('User: Charles')
  .click() // contains looks for content in document now

Alternatively, you can always start a new chain of commands off of cy.

cy.contains('User: Cheryl').click()
cy.contains('User: Charles').click() // contains looks for content in document now

Rules

  • .end() requires being chained off a previous command.
  • .end() cannot have any assertions chained.
  • .end() cannot time out.

Command Log

  • .end() does not log in the Command Log

See also