Install Cypress

Prerequisite

Node.js

Cypress needs nodejs, goto https://nodejs.org/en/ , download and install latest LTS version.

After installation, if you need to set proxy :

npm config set proxy http://xxx.xx:nn
npm config set https-proxy http://xxx.xx:nn

Visual Studio Code

To edit code, goto https://code.visualstudio.com/ , download and install latest version.

Get Cypress

Open Command Prompt, goto your project folder and execute this command to install Cypress :

npm install cypress

After installation, we can now open Cypress by executing this command :

npx cypress open
Cypress will also provide some test examples in integration\examples folder

Configuration

Open Cypress

To use npm to open cypress in place of npx command, update package.json, add “cypress:open”

Close cypress, in Command Prompt open it again by executing this command :

npm run cypress:open

Visual Studio Code IntelliSense

To benefits code-completion, create a new file tsconfig.json in cypress folder.
Copy code below and save file.

{
    "compilerOptions": {
      "strict": true,
      "baseUrl": "../node_modules",
      "target": "es5",
      "lib": ["es5", "dom"],
      "types": ["cypress"]
    },
    "include": [
      "**/*.ts"
    ]
}

Restart Visual Studio Code.

That’s all Folks!