Recipes


This repo contains various recipes for testing common scenarios using Cypress: Fundamentals, Testing the DOM, Logging in, Preprocessors, Blogs, Stubbing and spying, Unit Testing, Server Communication, Other Cypress Recipes, Community Recipes
Fundamentals
Testing the DOM
Logging in recipes
Also see Authentication plugins and watch video “Organizing Tests, Logging In, Controlling State”
Preprocessors
Blogs
Demo recipes from the blog posts at www.cypress.io/blog
Network stubbing and spying
JS-level stubbing and spying
Unit Testing
Note: looking for the React/Vue component testing recipes? Read the Introducing the Cypress Component Test Runner– new in 7.0.0 blog post.
Server Communication
Other Cypress Recipes
Overview
- This repo is structured similar to how other “Monorepos” work.
- Each
example project has its own Cypress configuration, tests, backend and frontend assets.
- Each of these
example projects share a single “root” Cypress that is installed in the root node_modules folder.
- This structure looks different from normal projects, but its the easiest way to manage multiple projects without installing Cypress independently for each one.
Installation
## install all dependencies from the root directory
npm install
Opening Cypress App
cd ./examples/testing-dom__drag-drop
# start local server
npm start &
# open Cypress App
npm run cypress:open
Running from the CLI
Same as running Cypress GUI but with cypress run command (and any CLI arguments)
cd ./examples/testing-dom__drag-drop
# start local server
npm start &
# run Cypress tests headlessly
npm run cypress:run
### runs all example projects in specific browser
### similar to cypress run --browser <name>
npm run cypress:run -- --browser chrome
### sends test results, videos, screenshots
### to Cypress dashboard
npm run cypress:run -- --record
You can find the recording at the Cypress Dashboard linked below

Development
See Development.md
评论