Skip to content

Latest commit

 

History

History
26 lines (20 loc) · 755 Bytes

File metadata and controls

26 lines (20 loc) · 755 Bytes

example: webpack-options

The Webpack preprocessor in cypress/plugins/index.js adds the Babel React preset to the list of default Webpack plugins. This allows Cypress to transpile JSX code in cypress/component/Test.cy-spec.js file.

Note: run npm install in this folder to symlink cypress-react-unit-test dependency.

npm run cy:open
# or run headless tests
npm test
import React from 'react'
import { mount } from 'cypress-react-unit-test'
describe('components', () => {
  it('works', () => {
    mount(<div>Text</div>)
    cy.contains('Text')
  })
})

Test screenshot

More tests are in the cypress/component folder.