Prerequisites
Before installing the framework, ensure you have the following installed:Node.js
Version 14.x or higher (LTS recommended)
npm
Comes with Node.js installation
Git
For cloning the repository
Code Editor
VS Code recommended for TypeScript support
Installation Steps
Install Dependencies
Install all required npm packages:This will install:
- cypress (^14.5.4) - The core testing framework
- typescript (^5.9.3) - TypeScript compiler and type definitions
- cypress-xpath (^2.0.1) - XPath selector support
Project Dependencies
Here’s what gets installed withnpm install:
package.json
Dependency Details
- cypress: The main testing framework that provides the test runner, assertion library, and browser automation capabilities.
- typescript: Adds static typing to your tests, improving code quality and developer experience.
- cypress-xpath: Extends Cypress with XPath selector support, useful for legacy applications or complex DOM traversal.
Browser Setup
Cypress supports multiple browsers out of the box:Running with Different Browsers
IDE Setup (Optional but Recommended)
Visual Studio Code
For the best development experience with TypeScript:-
Install the following VS Code extensions:
- Cypress Snippets - Code snippets for Cypress commands
- ESLint - Linting support
- TypeScript and JavaScript Language Features (built-in)
- VS Code will automatically detect TypeScript and provide IntelliSense for Cypress commands.
Troubleshooting
Cypress verification fails
Cypress verification fails
If
npx cypress verify fails, try:TypeScript errors in test files
TypeScript errors in test files
Ensure your IDE is using the workspace TypeScript version:In VS Code:
Cmd/Ctrl + Shift + P → “TypeScript: Select TypeScript Version” → “Use Workspace Version”Permission errors on macOS/Linux
Permission errors on macOS/Linux
If you encounter permission errors, avoid using
sudo. Instead:Verify Your Setup
After installation, verify everything is working:You should see Cypress version 14.5.4 or higher, Node.js 14.x or higher, and npm 6.x or higher.
Next Steps
Quickstart Guide
Run your first test and see the framework in action
Project Structure
Learn how the project is organized