Skip to content
cy shorthand notation for cypress get and find functions
JavaScript HTML
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src fix 1st test and refactor - put constants on top Nov 8, 2019
test
.eslintrc
.gitignore ignore cypress videos files Nov 7, 2019
.npmignore
.prettierrc.js remove double configs and replace it by an output array Oct 30, 2019
.travis.yml
LICENSE Create LICENSE Nov 2, 2019
README.md Some minor edits, formatting + js syntax highlighting Nov 4, 2019
babel.config.js
cypress.json
package-lock.json use rollup to package the cypress commands Oct 29, 2019
package.json fix 1st test and refactor - put constants on top Nov 8, 2019
rollup.config.js fix rollup config Nov 7, 2019
yarn.lock

README.md

Build Status

cypress-cy-select

data-cy shorthand notation for cypress .get() and .find() commands.

Install

npm i --save-dev cypress-cy-select

Usage

In support/commands.js or support/index.js:

import setup from 'cypress-cy-select';
setup();

Use cy.get() as you would normally use it, but you can now select data-cy with a shorthand notation: cy|mySelector

This:

cy.get("cy|mySelector .myClass1 > .myClass2 tagName")

will be actually formatted to:

cy.get('[data-cy="mySelector"] .myClass1 > .myClass2 tagName')

Alternatively, if you don't want the defaults, you can pass a configuration object:

const config = {
  name: 'e2e',
  separator: ':'
}
setup(config);

This:

cy.get("e2e:mySelector .myClass1 > .myClass2 tagName")

will be actually formatted to:

cy.get('[data-e2e="mySelector"] .myClass1 > .myClass2 tagName')
You can’t perform that action at this time.