# Misc

Examples of miscellaneous commands in Cypress, for a full reference of commands, go to docs.cypress.io

#### cy.end()

To end the command chain, use the `cy.end()` command.

    cy
      .get('.misc-table').within(function(){
        cy
          // ends the current chain and returns null
          .contains("Cheryl").click().end()

          // queries the entire table again
          .contains("Charles").click()

      })

Table
User: Cheryl
User: Charles
User: Darryl

#### cy.focused()

To get the DOM element that has focus, use the `cy.focused()` command.

    cy
      .get('.misc-form').find('#name').click()
      .focused().should('have.id', 'name')

      .get('.misc-form').find('#description').click()
      .focused().should('have.id', 'description')

Name
Description

#### cy.wrap()

To wrap an object, use the `cy.wrap()` command.

    cy
      .wrap({foo: 'bar'})
        .should('have.property', 'foo')
        .and('include', 'bar')

`{foo: bar}`