Skip to content
A cypress plugin to add a tab command
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cypress initial release Mar 5, 2019
docs cleanup files Mar 5, 2019
src fix #1: add "declare" to .d.ts file May 23, 2019
.eslintrc.json initial release Mar 5, 2019
.gitignore
.npmignore initial release Mar 5, 2019
LICENSE initial release Mar 5, 2019
README.md update readme Mar 5, 2019
cypress.json initial release Mar 5, 2019
package-lock.json 1.0.1 May 23, 2019
package.json 1.0.1 May 23, 2019

README.md

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

You can’t perform that action at this time.