Skip to content

Latest commit

 

History

History
72 lines (43 loc) · 1.29 KB

File metadata and controls

72 lines (43 loc) · 1.29 KB
title
end

End a chain of commands.

Syntax

.end()

Usage

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

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

{% fa fa-exclamation-triangle red %} Incorrect Usage

cy.end()                  // Does not make sense to chain off 'cy'

Yields {% helper_icon yields %}

{% yields null .end %}

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

Requirements {% helper_icon requirements %}

{% requirements child .end %}

Assertions {% helper_icon assertions %}

{% assertions none .end %}

Timeouts {% helper_icon timeout %}

{% timeouts none .end %}

Command Log

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

See also

  • {% url .root() root %}
  • {% url .within() within %}