Learning Cypress
MIT License
Install the following:
npm init -y
yarn set version stable
.yarnrc.yml
Create the file with following content:
yarnPath: .yarn/releases/yarn-3.2.3.cjs
yarn add cypress
yarn add -D typescript
.gitignore
file to ignore unwanted files and folders.pnp.*
**/.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!**/.yarn/sdks
cypress/screenshots
cypress/videos
"scripts": {
"open": "cypress open",
"test": "cypress run"
}
yarn open
E2E Testing
Continue
at the bottom of the pageChrome
Start E2E Testing in Chrome
buttonScaffold example specs
Okay, I got it
buttontsconfig.json
{
"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
to allow interactive package upgradesyarn plugin import interactive-tools
yarn upgrade-interactive