mirror of
https://github.com/cypress-io/cypress.git
synced 2026-01-27 17:39:10 -06:00
Co-authored-by: Дмитрий Коваленко <dmitrijkovalenko@Dmitrijs-MacBook-Pro.local> Co-authored-by: Dmitriy Kovalenko <dmtr.kovalenko@outlook.com>
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.
Usage
- Make sure the root project has been built .
# in the root of the project
npm install
npm run build
- Run
npm installin this folder to symlink the@cypress/reactdependency.
# in this folder
npm install
- Start Cypress
npm run cy:open
# or just run headless tests
npm test
Example
import React from 'react'
import { mount } from '@cypress/react'
describe('components', () => {
it('works', () => {
mount(<div>Text</div>)
cy.contains('Text')
})
})
More tests are in the cypress/component folder.
