cypress-react-unit-test
Unit test React components using Cypress
Use
import { HelloState } from '../../src/hello-x.jsx'
import React from 'react'
import { mount } from 'cypress-react-unit-test'
describe('HelloState component', () => {
it('works', () => {
mount(<HelloState />)
cy.contains('Hello Spider-man!')
Cypress.component().invoke('setState', {name: 'React'})
Cypress.component().its('state').should('deep.equal', {
name: 'React'
})
cy.contains('Hello React!')
})
})
Examples
All components are in src folder. All tests are in cypress/integration folder.