Sha256: bad5a7c805b84999ffe02498fcc4e9f550a97fb3de4f8cf78b24084d25772f6a

Contents?: true

Size: 1.9 KB

Versions: 20

Compression:

Stored size: 1.9 KB

Contents

/// <reference types="Cypress" />

context('Misc', () => {
  beforeEach(() => {
    cy.visit('https://example.cypress.io/commands/misc')
  })

  it('.end() - end the command chain', () => {
    // https://on.cypress.io/end

    // cy.end is useful when you want to end a chain of commands
    // and force Cypress to re-query from the root element
    cy.get('.misc-table').within(() => {
      // ends the current chain and yields null
      cy.contains('Cheryl').click().end()

      // queries the entire table again
      cy.contains('Charles').click()
    })
  })

  it('cy.exec() - execute a system command', () => {
    // https://on.cypress.io/exec

    // execute a system command.
    // so you can take actions necessary for
    // your test outside the scope of Cypress.
    cy.exec('echo Jane Lane')
      .its('stdout').should('contain', 'Jane Lane')

    // we can use Cypress.platform string to
    // select appropriate command
    // https://on.cypress/io/platform
    cy.log(`Platform ${Cypress.platform} architecture ${Cypress.arch}`)

    if (Cypress.platform === 'win32') {
      cy.exec('print cypress.json')
        .its('stderr').should('be.empty')
    } else {
      cy.exec('cat cypress.json')
        .its('stderr').should('be.empty')

      cy.exec('pwd')
        .its('code').should('eq', 0)
    }
  })

  it('cy.focused() - get the DOM element that has focus', () => {
    // https://on.cypress.io/focused
    cy.get('.misc-form').find('#name').click()
    cy.focused().should('have.id', 'name')

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

  it('cy.screenshot() - take a screenshot', () => {
    // https://on.cypress.io/screenshot
    cy.screenshot('my-image')
  })

  it('cy.wrap() - wrap an object', () => {
    // https://on.cypress.io/wrap
    cy.wrap({ foo: 'bar' })
      .should('have.property', 'foo')
      .and('include', 'bar')
  })
})

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
cypress-on-rails-1.12.1 lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/misc.spec.js
cypress-on-rails-1.12.0 lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/misc.spec.js
cypress-on-rails-1.11.0 lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/misc.spec.js
cypress-on-rails-1.10.1 lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/misc.spec.js
cypress-on-rails-1.9.1 lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/misc.spec.js
cypress-on-rails-1.9.0 lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/misc.spec.js
cypress-on-rails-1.8.1 lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/misc.spec.js
cypress-on-rails-1.8.0 lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/misc.spec.js
cypress-on-rails-1.7.0 lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/misc.spec.js
cypress-on-rails-1.6.0 lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/misc.spec.js
cypress-on-rails-1.5.1 lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/misc.spec.js
cypress-on-rails-1.5.0 lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/misc.spec.js
cypress-on-rails-1.4.2 lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/misc.spec.js
cypress-on-rails-1.4.1 lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/misc.spec.js
cypress-on-rails-1.4.0 lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/misc.spec.js
cypress-on-rails-1.3.0 lib/generators/cypress_dev/templates/spec/cypress/integration/examples/misc.spec.js
cypress-on-rails-1.2.1 lib/generators/cypress_dev/templates/spec/cypress/integration/examples/misc.spec.js
cypress-on-rails-1.2.0 lib/generators/cypress_dev/templates/spec/cypress/integration/examples/misc.spec.js
cypress-on-rails-1.1.1 lib/generators/cypress_dev/templates/spec/cypress/integration/examples/misc.spec.js
cypress-on-rails-1.1.0 lib/generators/cypress_dev/templates/spec/cypress/integration/examples/misc.spec.js