cypress-plugin-tab

1.0.5 • Public • Published

cypress-plugin-tab beta

A Cypress plugin to add a tab command

⚠️ this module is in beta, and might cause some strange failures. Please report bugs in the issues of this repo.

Note: please refer to this issue for updates about official cypress tab support

Installation

Add the plugin to devDependencies

npm install -D cypress-plugin-tab

At the top of cypress/support/index.js:

require('cypress-plugin-tab')

Usage

  • .tab() must be chained off of a tabbable(focusable) subject, or the body
  • .tab() changes the subject to the newly focused element after pressing tab
  • .tab({ shift: true }) sends a shift-tab to the element
  cy.get('input').type('foo').tab().type('bar') // type foo, then press tab, then type bar
  cy.get('body').tab() // tab into the first tabbable element on the page
  cy.focused().tab() // tab into the currently focused element

shift+tab:

cy.get('input')
  .type('foop').tab()
  .type('bar').tab({ shift: true })
  .type('foo') // correct your mistake

License

MIT

Dependents (13)

Package Sidebar

Install

npm i cypress-plugin-tab

Weekly Downloads

254,355

Version

1.0.5

License

MIT

Unpacked Size

7.22 kB

Total Files

6

Last publish

Collaborators

  • bkucera