Install the following:
- VS Code
- Node JS v16.16.0
- NPM v8.11.0
- Yarn
npm init -y
yarn set version stable
Create the file with following content:
yarnPath: .yarn/releases/yarn-3.2.3.cjs
yarn add cypress
yarn add -D typescript
.pnp.*
**/.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!**/.yarn/sdks
cypress/screenshots
cypress/videos
"scripts": {
"open": "cypress open",
"test": "cypress run"
}
yarn open
- When UI opens, select
E2E Testing
- Few files will get created
- Click
Continue
at the bottom of the page - Select the desired browser, recommended
Chrome
- Click on
Start E2E Testing in Chrome
button - Click on
Scaffold example specs
- Some sample tests will be created
- Click on
Okay, I got it
button
{
"compilerOptions": {
"target": "es5",
"lib": ["ESNext", "DOM"],
"types": ["cypress", "node"],
"strict": true
},
"include": ["cypress/**/*.ts"]
}
Rename all test files located at cypress/e2e
and cypress/support
folders from .js
to .ts
Install ZipFS
VS Code extension.
yarn dlx @yarnpkg/sdks vscode
Open any .ts
file and press Cmd
+ Shift
+ P
, type and select Select TypeScript Version
option and then select Workspace version
yarn test
yarn plugin import interactive-tools
yarn upgrade-interactive