Skip to content

๐Ÿ… Simple and complete custom Cypress commands and utilities that encourage good testing practices.

License

Notifications You must be signed in to change notification settings

npeterkamps/cypress-testing-library

ย 
ย 

Repository files navigation

cypress-testing-library

tiger

Simple and complete custom Cypress commands and utilities that encourage good testing practices.


Build Status Code Coverage version downloads MIT License

All Contributors PRs Welcome Code of Conduct

Watch on GitHub Star on GitHub Tweet

The problem

You want to use dom-testing-library methods in your Cypress tests.

This solution

This allows you to use all the useful dom-testing-library methods in your tests.

Table of Contents

Installation

This module is distributed via npm which is bundled with node and should be installed as one of your project's devDependencies:

npm install --save-dev cypress-testing-library

Usage

cypress-testing-library extends Cypress' cy command.

Add this line to your project's cypress/support/commands.js:

import 'cypress-testing-library/add-commands';

You can now use all of dom-testing-library's getBy, getAllBy, queryBy and queryAllBy commands. See dom-testing-library repo for reference

To show some simple examples (from cypress/integration/commands.spec.js):

cy.getAllByText('Jackie Chan').click()
cy.queryByText('Button Text').should('exist')
cy.queryByText('Non-existing Button Text').should('not.exist')

Other Solutions

I'm not aware of any, if you are please make a pull request and add it here!

Contributors

Thanks goes to these people (emoji key):


Kent C. Dodds

๐Ÿ’ป ๐Ÿ“– ๐Ÿš‡ โš ๏ธ

Ivan Babak

๐Ÿ’ป ๐Ÿค”

ลukasz Gandecki

๐Ÿ’ป โš ๏ธ

This project follows the all-contributors specification. Contributions of any kind welcome!

LICENSE

MIT

About

๐Ÿ… Simple and complete custom Cypress commands and utilities that encourage good testing practices.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 70.2%
  • HTML 29.8%