Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
cypress-testing-library
Advanced tools
Simple and complete custom Cypress commands and utilities that encourage good testing practices.
Simple and complete custom Cypress commands and utilities that encourage good testing practices.
You want to use dom-testing-library
methods in your Cypress tests.
This allows you to use all the useful dom-testing-library
methods in your tests.
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
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')
cy.queryByLabelText('Label text', {timeout: 7000}).should('exist')
cy.get('form').within(() => {
cy.getByText('Button Text').should('exist')
})
cy.get('form').then(subject => {
cy.getByText('Button Text', {container: subject}).should('exist')
})
cypress-testing-library
supports both jQuery elements and DOM nodes. This is necessary because Cypress uses jQuery elements, while dom-testing-library
expects DOM nodes. When you pass a jQuery element as container
, it will get the first DOM node from the collection and use that as the container
parameter for the dom-testing-library
functions.
I'm not aware of any, if you are please make a pull request and add it here!
Thanks goes to these people (emoji key):
Kent C. Dodds 💻 📖 🚇 ⚠️ | Ivan Babak 💻 🤔 | Łukasz Gandecki 💻 ⚠️ | Peter Kamps 💻 📖 🤔 ⚠️ | Airat Aminev 💻 ⚠️ 🔧 |
---|
This project follows the all-contributors specification. Contributions of any kind welcome!
MIT
FAQs
Unknown package
The npm package cypress-testing-library receives a total of 1,878 weekly downloads. As such, cypress-testing-library popularity was classified as popular.
We found that cypress-testing-library demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.