Updated 3rd Sept 2020
-
yarn add cypress -D -
yarn run cypress open2.1 Wait for cypress to completely load and then close it. We're just running this to instantiate the files we need.
-
Follow these steps for TypeScript or basically just follow the below:
3.1. Basically make sure that
tsconfig.jsonexists in the./cypressfolder with the minimum below:{ "compilerOptions": { "target": "es5", "lib": ["es5", "dom"], "types": ["cypress"] }, "include": [ "**/*.ts" ] }3.2. Then change all files in
./cypress/support/from*.jsto*.tsand things should work. -
Add these to .gitignore:
cypress/screenshots/* cypress/videos/* -
Add
*.spec.tsfiles incypress/integration/folder because Cypress is meant for integration tests and not unit tests. -
Ensure that there is also an empty
.babelrc.jsfile in/cypressif your root project uses Babel because Cypress will error out after reading your root project's.babelrc.js. -
To run, run
yarn run cypress openagain. -
Environmental variables should be put in
cypress.json. -
Custom commands should be put in
./cypress/support/commands.ts.