Cypress Page Object Model Framework 2026 标志

Cypress Page Object Model Framework 2026

社区
padmarajnidagundi

Cypress Page Object Model Framework 2026 | MCP | ChatMode | E2E | AI

发布者padmarajnidagundi
代码仓库Cypress-POM-Ready-To-Use
语言JavaScript
复刻数
17
星标数
14
可用工具
0
传输类型stdio
分类
链接
  • 将工具接入 AI 工作流

    Cypress Page Object Model Framework 2026 提供 MCP 功能,可供兼容的 AI 客户端和智能体使用。

  • 0 个可用工具

    浏览下方可调用的操作;如果服务器提供了名称和描述,也会一并显示。

  • 可直接复制的配置

    使用安装配置片段,在您首选的 MCP 客户端中配置此服务器。

  • 开源社区热度

    关联的代码仓库有 14 个星标和 17 个复刻。

Cypress Page Object Model Framework 2026 | MCP | ChatMode | Complete E2E Testing Guide

Production-Ready Cypress Automation Framework with TypeScript, API Testing & CI/CD Integration

Last Updated: August 9, 2026 | Version: 2.1.0 | Maintained by QA Professionals

Node.js CI Docker CI npm version License: MIT Cypress.io Docker code style: prettier PRs Welcome Ask DeepWiki

Table of Contents

Overview

A battle-tested, enterprise-grade Cypress automation framework built with TypeScript and the Page Object Model design pattern. This framework provides everything you need for modern web application testing including UI testing, API testing, accessibility validation, and comprehensive reporting.

Perfect for: QA Engineers, Test Automation Engineers, DevOps Teams, and Development Teams looking to implement robust end-to-end testing.

Why This Framework?

  • ✅ Production-Ready: Used in real-world projects with proven reliability
  • ✅ Best Practices Built-In: Follows industry standards and design patterns
  • ✅ Comprehensive Documentation: Extensive guides and examples
  • ✅ Active Maintenance: Regular updates and security patches
  • ✅ Community Support: Growing community of contributors

Key Features

  • 🐳 Docker Support: Fully containerized testing environment
  • 📦 TypeScript support with type definitions
  • 🤖 ChatGPT interface testing suite
  • ♿ Comprehensive accessibility testing
  • 🏗️ Page Object Model implementation
  • 🔌 API testing capabilities with custom commands
  • ⚡ Parallel test execution
  • 🚀 CI/CD ready with GitHub Actions and Docker
  • ⚙️ Environment-based configuration
  • 📊 Comprehensive reporting with Mochawesome
  • 🔄 Built-in retry mechanisms for flaky tests
  • 🐋 Docker Compose for easy orchestration

Framework Comparison

Cypress Advantages & Disadvantages

AdvantagesDisadvantages
✅ Real-time reload and time travel debugging❌ Single browser tab execution
✅ Automatic waiting and retry mechanisms❌ Limited cross-domain testing
✅ Consistent and reliable tests❌ No support for multiple browser windows
✅ Built-in screenshots and videos❌ Limited iframe support
✅ Excellent developer experience and debugging❌ No native mobile testing support
✅ Modern JavaScript stack and syntax❌ Same-origin policy limitations
✅ Rich ecosystem of plugins❌ CPU/Memory intensive for large suites
✅ Comprehensive documentation❌ Limited support for file downloads
✅ Active community support❌ Requires JavaScript knowledge
✅ Built-in network stubbing❌ Browser support limited to Chrome-family
✅ Native access to browser APIs❌ Not suitable for native mobile apps
✅ Simple setup and configuration❌ Complex iframe handling
✅ API testing capabilities❌ Limited parallel testing in open source
✅ TypeScript support❌ Higher resource usage than Selenium
✅ Command chaining for better readability❌ Learning curve for non-JS developers

When to Choose Cypress

  1. Best For:

    • Modern web applications
    • Single page applications (SPAs)
    • Real-time testing feedback
    • JavaScript/TypeScript projects
    • E2E and Component testing
    • API testing
  2. Not Ideal For:

    • Native mobile testing
    • Multi-tab scenarios
    • Complex iframe operations
    • Cross-browser testing at scale
    • Non-JavaScript applications
    • Limited resource environments

Quick Start Guide

Prerequisites

  • Node.js: Version 18.x or higher
  • npm: Version 8.x or higher
  • Git: For version control
  • Operating System: Windows, macOS, or Linux
  • Docker (Optional): For containerized testing

Installation Steps

  1. Clone and Install
bash
git clone https://github.com/padmarajnidagundi/Cypress-POM-Ready-To-Use
cd Cypress-POM-Ready-To-Use
  1. Setup Project
bash
npm run presetup     # Install all dependencies
npm run setup       # Install Cypress
npm run verify      # Verify Cypress installation
  1. Open Cypress
bash
npm run cypress:open  # Open Cypress Test Runner
  1. Run Tests
bash
npm run test:ui          # Run UI tests
npm run test:api         # Run API tests
npm run test:parallel    # Run all tests in parallel
npm run test:ci         # Run tests in CI mode

Troubleshooting Installation

If you encounter the error 'cypress' is not recognized as an internal or external command, follow these steps:

  1. Clear npm cache and node_modules:
bash
npm cache clean --force
rm -rf node_modules
rm -rf package-lock.json
  1. Reinstall dependencies:
bash
npm run presetup
  1. Verify installation:
bash
npm run verify

Docker Setup

This framework is fully Docker-ready for containerized testing. Run tests in isolated environments without local Node.js or Cypress installation.

Docker Installation (Alternative)

If you prefer using Docker, you can run the entire test suite in a containerized environment:

  1. Using Docker Compose (Recommended)
bash
# Build and run tests
docker-compose up --build cypress

# Run tests in detached mode
docker-compose up -d cypress

# View test reports
docker-compose up cypress-reports
# Access reports at http://localhost:8080
  1. Using Docker directly
bash
# Build Docker image
docker build -t cypress-pom-tests .

# Run tests
docker run --rm cypress-pom-tests

# Run specific test suite
docker run --rm cypress-pom-tests npm run test:api
docker run --rm cypress-pom-tests npm run test:ui

# Mount local directory for development
docker run --rm -v ${PWD}/cypress:/e2e/cypress cypress-pom-tests
  1. Custom test commands
bash
# Run with environment variables
docker run --rm -e CYPRESS_BASE_URL=https://your-app.com cypress-pom-tests

# Run specific spec file
docker run --rm cypress-pom-tests npx cypress run --spec "cypress/e2e/ui/chatgpt.cy.js"

# Run with custom browser
docker run --rm cypress-pom-tests npm run test -- --browser chrome
  1. Access test artifacts
bash
# Copy reports from container
docker run --rm -v ${PWD}/reports:/e2e/cypress/reports cypress-pom-tests

# Or use docker-compose volumes (configured automatically)
docker-compose up cypress
# Reports will be available in ./cypress/reports and ./mochawesome-report

Docker Benefits:

  • ✅ Consistent test environment across all machines
  • ✅ No local Node.js or Cypress installation required
  • ✅ Easy CI/CD integration
  • ✅ Isolated dependencies and configurations
  • ✅ Quick setup and teardown

Docker NPM Scripts

Convenient npm commands for Docker operations:

bash
npm run docker:build              # Build Docker image
npm run docker:run                # Run all tests in Docker
npm run docker:run:api            # Run API tests only
npm run docker:run:ui             # Run UI tests only
npm run docker:compose:up         # Start with docker-compose
npm run docker:compose:reports    # View reports in browser (port 8080)
npm run docker:compose:down       # Stop and clean up containers

📖 For detailed Docker documentation, see DOCKER.md

  1. Test Cypress:
bash
npm run cypress:open

For QA Engineers

Writing UI Tests

  1. Create Page Objects
typescript
// cypress/pageObjects/pages/loginPage.ts
import BasePage from '../basePage'

class LoginPage extends BasePage {
  private selectors = {
    username: '#username',
    password: '#password',
    submitBtn: '[data-testid="login-btn"]'
  }

  login(username: string, password: string) {
    this.getElement(this.selectors.username).type(username)
    this.getElement(this.selectors.password).type(password)
    this.getElement(this.selectors.submitBtn).click()
  }
}
  1. Write Tests
typescript
// cypress/e2e/ui/login.cy.ts
import LoginPage from '../../pageObjects/pages/loginPage'

describe('Login Tests', () => {
  const loginPage = new LoginPage()

  beforeEach(() => {
    loginPage.visit('/login')
  })

  it('should login successfully', () => {
    loginPage.login('testuser', 'password')
    // assertions
  })
})

API Testing

Our framework supports comprehensive API testing across multiple categories:

Test Categories

  1. Unit Tests - Basic API endpoint validation
javascript
describe('[Unit] User API Operations', () => {
  it('[Unit] should retrieve user with valid data structure', () => {
    cy.apiRequest('GET', '/users/1').then((response) => {
      expect(response.status).to.eq(200)
      expect(response.body.data).to.have.all.keys(
        'id',
        'email',
        'first_name',
        'last_name',
        'avatar'
      )
    })
  })
})
  1. Integration Tests - End-to-end API workflows
javascript
describe('[Integration] User Management Workflow', () => {
  it('[Integration] should perform complete user CRUD operations', () => {
    cy.apiRequest('POST', '/users', {
      body: { name: 'Test User', job: 'QA Engineer' }
    }).then((response) => {
      expect(response.status).to.eq(201)
    })
  })
})
  1. Performance Tests - Response time validation
javascript
describe('[Performance] API Response Times', () => {
  it('[Performance] should meet response time SLA', () => {
    cy.apiRequest('GET', '/users').then((response) => {
      expect(response.duration).to.be.lessThan(1000)
    })
  })
})
  1. Security Tests - Authentication & authorization
javascript
describe('[Security] API Authentication', () => {
  it('[Security] should enforce authentication', () => {
    cy.apiRequest('GET', '/protected', {
      headers: { Authorization: 'Bearer invalid_token' }
    }).then((response) => {
      expect(response.status).to.eq(401)
    })
  })
})
  1. Validation Tests - Input validation checks
javascript
describe('[Validation] API Input Validation', () => {
  it('[Validation] should enforce required fields', () => {
    cy.apiRequest('POST', '/register', {
      body: {}
    }).then((response) => {
      expect(response.status).to.eq(400)
    })
  })
})
  1. Interoperability Tests - Cross-platform compatibility
javascript
describe('[Interop] API Compatibility', () => {
  it('[Interop] should support multiple formats', () => {
    cy.apiRequest('GET', '/users', {
      headers: { Accept: 'application/json' }
    }).then((response) => {
      expect(response.headers['content-type']).to.include('application/json')
    })
  })
})
  1. Mock Tests - Response stubbing & mocking
javascript
describe('[Mock] API Response Mocking', () => {
  it('[Mock] should handle mocked responses', () => {
    cy.intercept('GET', '/users', {
      fixture: 'users.json'
    }).as('getUsers')

    cy.apiRequest('GET', '/users').then((response) => {
      expect(response.status).to.eq(200)
      cy.wait('@getUsers')
    })
  })
})

API Test Organization Structure

cypress/e2e/api/
├── unit-tests/           # Basic API operations
├── integration-tests/    # End-to-end workflows
├── performance-tests/    # Response times & load
├── security-tests/      # Auth & security checks
├── validation-tests/    # Input validation
├── mock-tests/         # Response mocking & stubbing
└── interop-tests/      # Compatibility tests

Custom API Commands

Our framework provides built-in commands for API testing:

javascript
// Make API requests with default configuration
cy.apiRequest(method, path, options)

// Example usage
cy.apiRequest('POST', '/users', {
  body: { name: 'Test User' },
  headers: { Authorization: 'Bearer token' }
})

API Testing Best Practices

  1. Test Structure

    • Use descriptive category prefixes: [Unit], [Integration], etc.
    • Group related tests in appropriate folders
    • Follow the single responsibility principle
  2. Assertions

    • Verify status codes and response structure
    • Check response times for performance
    • Validate security headers and tokens
    • Test edge cases and error conditions
  3. Data Management

    • Use fixtures for test data
    • Clean up test data after tests
    • Handle environment-specific configurations

Accessibility Testing

Built-in accessibility testing with cypress-axe ensures your application meets WCAG standards:

javascript
describe('Accessibility Tests', () => {
  it('should pass accessibility checks', () => {
    cy.visit('/')
    cy.injectAxe()
    cy.checkA11y()
  })
})

Run accessibility tests:

bash
npm run test:a11y

Visual Regression Testing

Automated visual comparison to catch unintended UI changes:

javascript
describe('Visual Tests', () => {
  it('should match homepage screenshot', () => {
    cy.visit('/')
    cy.matchImageSnapshot('homepage')
  })
})

Run visual tests:

bash
npm run test:visual

Chat Mode Documentation

What is Chat Mode?

The cypress/chatmode/ folder contains professional testing templates and comprehensive guides designed to help QA engineers and teams standardize their testing documentation and follow industry best practices.

Data Management

Test Data Generators:

javascript
import { TestDataGenerator } from '../support/helpers/testDataGenerator'

// Generate random user
const user = TestDataGenerator.genera

```groovy
pipeline {
    agent any
    stages {
        stage('Test') {
            steps {
                sh 'npm ci'
                sh 'npm run test:ci'
            }
        }
    }
}

Test Reporting

This framework uses Mochawesome for comprehensive HTML reporting. Get detailed insights with screenshots, videos, and test execution metrics.

  1. Available Report Commands
bash
npm run report:clean     # Clean previous reports
npm run report:merge     # Merge multiple report JSONs
npm run report:generate  # Generate HTML from JSON
npm run test:report      # Full test execution with reports
  1. Report Features

    • Interactive HTML dashboard
    • Test execution timeline
    • Suite and test-level statistics
    • Failure screenshots embedded in report
    • Test execution videos
    • Performance metrics
    • Filter and search capabilities
    • Responsive design for mobile viewing
  2. Report Structure

cypress/reports/
├── html/               # HTML reports
│   ├── assets/        # Screenshots, videos
│   ├── report.html    # Main report
│   └── report.json    # Combined results
└── json/              # Individual test JSONs
  1. Reporter Configuration Add these options to cypress.config.js:
javascript
module.exports = defineConfig({
  reporter: 'cypress-mochawesome-reporter',
  reporterOptions: {
    charts: true, // Enable charts
    reportPageTitle: 'Test Report', // Custom title
    embeddedScreenshots: true, // Inline screenshots
    inlineAssets: true, // Inline assets
    saveAllAttempts: false, // Save only failures
    reportDir: 'cypress/reports/html',
    overwrite: false,
    html: true,
    json: true
  }
})
  1. Viewing Reports

    • Open cypress/reports/html/report.html in any browser
    • Reports are self-contained and can be shared
    • Support offline viewing
    • Can be hosted on any static server
  2. CI/CD Integration

yaml
- name: Generate Test Report
  if: always()
  run: npm run test:report

- name: Upload Test Report
  if: always()
  uses: actions/upload-artifact@v4
  with:
    name: test-report
    path: cypress/reports/html

Advanced Features

Visual Regression Testing

The framework includes visual regression testing capabilities:

javascript
// Visual regression test example
describe('Visual Tests', () => {
  it('should match homepage screenshot', () => {
    cy.visit('/')
    cy.matchImageSnapshot('homepage')
  })
})

Configuration in cypress.config.js:

  • Visual regression path: cypress/snapshots
  • Visual threshold: 0.1

Run visual tests:

bash
npm run test:visual

Accessibility Testing

Built-in accessibility testing with cypress-axe:

javascript
describe('Accessibility Tests', () => {
  it('should pass accessibility checks', () => {
    cy.visit('/')
    cy.injectAxe()
    cy.checkA11y()
  })
})

Run accessibility tests:

bash
npm run test:a11y

Network Stubbing

Enhanced network mocking capabilities:

javascript
// Mock REST API
cy.mockNetworkResponse('GET', '/api/users', { users: [] })

// Mock GraphQL
cy.mockGraphQL('GetUsers', { data: { users: [] } })

Test Data Management

Factory pattern for test data generation:

javascript
import UserFactory from '../support/factories/userFactory'

describe('User Tests', () => {
  it('should create user', () => {
    const user = UserFactory.generate()
    // Use generated user data in tests
  })

  it('should create multiple users', () => {
    const users = UserFactory.generateMany(3)
    // Use generated users data in tests
  })
})

Additional Dependencies

New testing capabilities are provided by:

json
{
  "@simonsmith/cypress-image-snapshot": "^10.0.4",
  "cypress-axe": "^1.7.0",
  "@testing-library/cypress": "^10.1.3",
  "cypress-real-events": "^1.15.0"
}

Debugging Tips

  1. Time Travel

    • Use Cypress Time Travel feature
    • Check screenshots in cypress/screenshots
    • Review videos in cypress/videos
  2. Logging

    • Use cy.log() for debug information
    • Enable Chrome DevTools in interactive mode
  3. Interactive Debugging

javascript
// Pause test execution
cy.pause()

// Debug specific command
cy.get('button').debug()

// Log variables
cy.log('User data:', user)

Contributing

We welcome contributions! This project follows industry best practices and is maintained by experienced QA professionals.

Assertion Helpers:

javascript
import AssertionHelpers from '../support/helpers/assertionHelpers'

// Assert API response
AssertionHelpers.assertApiResponse(response, 200, ['id', 'name', 'email'])

// Assert element state
AssertionHelpers.assertElementState('[data-testid="button"]', {
  visible: true,
  enabled: true,
  text: 'Submit'
})

Troubleshooting

Common Issues & Solutions

1. Installation Problems

Cypress not recognized:

bash
# Clear cache and reinstall
npm cache clean --force
rm -rf node_modules package-lock.json
npm run presetup

Permission errors:

bash
# Linux/Mac: Fix permissions
sudo chown -R $(id -u):$(id -g) ~/.cache/Cypress

2. Docker Issues

Permission denied (Linux/Mac):

bash
# Fix file permissions
sudo chown -R $(id -u):$(id -g) cypress/reports
sudo chown -R $(id -u):$(id -g) node_modules

# Or run with proper user
docker run --rm --user $(id -u):$(id -g) cypress-pom-tests

Out of memory:

bash
# Increase Docker memory
docker run --rm --memory=4g cypress-pom-tests

# Or in docker-compose.yml add:
# mem_limit: 4g

Slow Docker builds:

bash
# Use BuildKit for faster builds
DOCKER_BUILDKIT=1 docker build -t cypress-pom-tests .

# Or use docker-compose with parallel builds
docker-compose build --parallel

Network connectivity issues:

bash
# Check DNS resolution
docker run --rm cypress-pom-tests nslookup google.com

# Use host network (Linux only)
docker run --rm --network=host cypress-pom-tests

Video/screenshot issues:

bash
# Disable video recording to save resources
docker run --rm -e CYPRESS_VIDEO=false cypress-pom-tests

📖 For more Docker troubleshooting, see DOCKER.md

3. Test Execution Issues

Flaky tests:

  • Enable retry mechanism in cypress.config.js
  • Use proper waits instead of hard-coded delays
  • Check network stability

Timeout errors:

javascript
// Increase timeout in cypress.config.js
defaultCommandTimeout: 10000,
pageLoadTimeout: 60000

Chat Mode Documentation

1. Test Case Template (test-case-template.md)

A standardized template for documenting test cases including:

  • Test ID and priority
  • Test type classification
  • Prerequisites and setup
  • Detailed test steps
  • Expected vs actual results
  • Test data and environment info
  • Status tracking

Usage:

bash
# Copy template for new test case
cp cypress/chatmode/test-case-template.md docs/test-cases/TC-001.md

2. Bug Report Template (bug-report-template.md)

Comprehensive bug reporting format with:

  • Severity and priority classification
  • Environment details
  • Reproduction steps
  • Expected vs actual behavior
  • Screenshots and console errors
  • Impact assessment

Usage:

bash
# Create new bug report
cp cypress/chatmode/bug-report-template.md docs/bugs/BUG-001.md

3. Test Execution Report (test-execution-report.md)

Professional test execution summary including:

  • Test statistics and metrics
  • Pass/fail breakdown by category
  • Performance metrics
  • Defect summary
  • Risk assessment
  • Recommendations

Usage: Use this template to generate weekly/sprint test reports for stakeholders.

4. API Testing Checklist (api-testing-checklist.md)

Complete API testing checklist covering:

  • Functional testing
  • Error handling (4xx, 5xx)
  • Security testing
  • Performance validation
  • Data validation
  • Edge cases

Usage: Reference during API test planning and execution to ensure comprehensive coverage.

5. UI Testing Best Practices (ui-testing-best-practices.md)

In-depth guide including:

  • Test design principles
  • Selector best practices
  • Assertion strategies
  • Waiting mechanisms
  • Common pitfalls
  • Debugging techniques

Usage: Share with team members and reference during code reviews.

How to Use Chat Mode Files

For Individual QA Engineers:

  1. Test Planning Phase:

    bash
    # Review best practices
    cat cypress/chatmode/ui-testing-best-practices.md
    cat cypress/chatmode/api-testing-checklist.md
  2. Test Execution:

    bash
    # Document your tests
    cp cypress/chatmode/test-case-template.md my-test-cases/TC-LOGIN-001.md
  3. Bug Reporting:

    bash
    # Report issues using standard format
    cp cypress/chatmode/bug-report-template.md bugs/BUG-PAYMENT-001.md

For QA Teams:

  1. Onboarding New Team Members:

    • Share the ui-testing-best-practices.md as training material
    • Use templates to standardize documentation
    • Reference during code reviews
  2. Sprint Planning:

    • Use api-testing-checklist.md for test coverage planning
    • Estimate testing effort using templates
    • Create test cases from templates
  3. Sprint Reviews:

    • Generate reports using test-execution-report.md
    • Present standardized metrics to stakeholders
    • Track quality trends over time

For Test Automation Projects:

bash
# Set up documentation structure
mkdir -p docs/{test-cases,bugs,reports}

# Copy templates
cp cypress/chatmode/test-case-template.md docs/test-cases/
cp cypress/chatmode/bug-report-template.md docs/bugs/
cp cypress/chatmode/test-execution-report.md docs/reports/

# Create your first documented test case
cp cypress/chatmode/test-case-template.md docs/test-cases/TC-001-user-login.md

Integration with IDE/Chat Tools

The chat mode templates are designed to work with:

  • AI Code Assistants: Copy templates into your AI assistant for context-aware test generation
  • Documentation Tools: Import into Confluence, Notion, or other wikis
  • Version Control: Track documentation changes alongside code
  • Code Reviews: Reference during PR reviews for quality standards

Customization

All templates are Markdown-based and fully customizable:

bash
# Customize for your project
vim cypress/chatmode/test-case-template.md

# Add your own templates
touch cypress/chatmode/my-custom-template.md

Test Reporting

Mochawesome HTML Reports

This framework uses Mochawesome for comprehensive HTML reporting with embedded screenshots and videos.

  1. Selectors

    • Use data-testid attributes: [data-testid="login-button"]
    • Store selectors in page objects.
    • Use meaningful selector names.
  2. Test Organization

cypress/
├── e2e/
│   ├── api/           # API Tests
│   │   ├── users/
│   │   └── auth/
│   └── ui/            # UI Tests
│       ├── login/
│       └── dashboard/
├── pageObjects/
│   ├── components/    # Reusable components
│   └── pages/         # Page specific objects
└── fixtures/          # Test data
  1. Custom Commands
    • Create reusable commands for common operations
    • Use TypeScript for better type checking
    • Document command parameters

Environment Configuration

javascript
// cypress.config.js
module.exports = {
  env: {
    apiUrl: 'https://api.dev.example.com',
    userRole: 'admin',
    featureFlags: {
      newUI: true
    }
  }
}

Running Tests in CI

  1. GitHub Actions (pre-configured)
bash
npm run test:ci
  1. Docker in CI/CD
yaml
# GitHub Actions with Docker
- name: Run Cypress Tests in Docker
  run: |
    docker-compose up --build --abort-on-container-exit cypress

# GitLab CI with Docker
test:
  image: cypress/included:15.14.2
  script:
    - npm ci
    - npm run test:ci
  artifacts:
    paths:
      - cypress/reports
      - cypress/screenshots
      - cypress/videos

# Jenkins with Docker
docker.image('cypress/included:15.14.2').inside {
    sh 'npm ci'
    sh 'npm run test:ci'
}
  1. Jenkins (sample configuration)
groovy
pipeline {
    agent any
    stages {
        stage('Test') {
            steps {
                sh 'npm ci'
                sh 'npm run test:ci'
            }
        }
    }
}

Test Reporting

This framework uses Mochawesome for comprehensive HTML reporting. Get detailed insights with screenshots, videos, and test execution metrics.

  1. Available Report Commands
bash
npm run report:clean     # Clean previous reports
npm run report:merge     # Merge multiple report JSONs
npm run report:generate  # Generate HTML from JSON
npm run test:report      # Full test execution with reports
  1. Report Features

    • Interactive HTML dashboard
    • Test execution timeline
    • Suite and test-level statistics
    • Failure screenshots embedded in report
    • Test execution videos
    • Performance metrics
    • Filter and search capabilities
    • Responsive design for mobile viewing
  2. Report Structure

cypress/reports/
├── html/               # HTML reports
│   ├── assets/        # Screenshots, videos
│   ├── report.html    # Main report
│   └── report.json    # Combined results
└── json/              # Individual test JSONs
  1. Reporter Configuration Add these options to cypress.config.js:
javascript
module.exports = defineConfig({
  reporter: 'cypress-mochawesome-reporter',
  reporterOptions: {
    charts: true, // Enable charts
    reportPageTitle: 'Test Report', // Custom title
    embeddedScreenshots: true, // Inline screenshots
    inlineAssets: true, // Inline assets
    saveAllAttempts: false, // Save only failures
    reportDir: 'cypress/reports/html',
    overwrite: false,
    html: true,
    json: true
  }
})
  1. Viewing Reports

    • Open cypress/reports/html/report.html in any browser
    • Reports are self-contained and can be shared
    • Support offline viewing
    • Can be hosted on any static server

Get Help

Community

  • Stars: Star this repo if you find it useful
  • Fork: Fork and customize for your needs
  • Contribute: Submit PRs with improvements
  • Share: Share with your QA community

Changelog

Version 2.1.0 (May 2026)

  • ⬆️ Updated Cypress from 13.17.0 to 15.14.2
  • ⬆️ Updated @typescript-eslint/eslint-plugin and parser to 8.59.2
  • ⬆️ Updated @testing-library/cypress to 10.1.3
  • ⬆️ Updated @types/node to 22.19.18
  • ⬆️ Updated cypress-real-events to 1.15.0
  • ⬆️ Updated eslint-plugin-cypress to 6.4.1
  • ⬆️ Updated mochawesome to 7.1.4
  • ⬆️ Updated mochawesome-report-generator to 6.3.2
  • ⬆️ Updated prettier to 3.8.3
  • ⬆️ Updated typescript to 5.9.3
  • ⬆️ Updated lint-staged to 15.5.2

Version 2.0.0 (January-February 2026)

  • 🐳 Added full Docker support with Dockerfile and docker-compose.yml
  • 🐳 Created comprehensive Docker documentation (DOCKER.md)
  • 🐳 Added Docker CI/CD workflow (.github/workflows/docker.yml)
  • 🐳 Added Docker npm scripts for easy container management
  • ✨ Added ESLint 9 flat config support
  • ✨ Integrated Husky 9 for pre-commit hooks
  • ✨ Added comprehensive test helpers (data generators, assertions, retry logic)
  • ✨ Created chatmode templates for documentation
  • 📝 Enhanced README with E-E-A-T guidelines and Docker sections
  • 🔧 Updated dependencies (cypress-axe, cypress-mochawesome-reporter)
  • 🔧 Added dependabot configuration
  • 🔧 Improved GitHub Actions workflow
  • 📚 Added CONTRIBUTING.md
  • 📚 Added .dockerignore for optimized builds

Version 1.x

  • Initial release with Page Object Model
  • Basic UI and API testing support

Frequently Asked Questions (FAQ)

Advanced Features

Visual Regression Testing

The framework includes visual regression testing capabilities:

javascript
// Visual regression test example
describe('Visual Tests', () => {
  it('should match homepage screenshot', () => {
    cy.visit('/')
    cy.matchImageSnapshot('homepage')
  })
})

Configuration in cypress.config.js:

  • Visual regression path: cypress/snapshots
  • Visual threshold: 0.1

Run visual tests:

bash
npm run test:visual

Accessibility Testing

Built-in accessibility testing with cypress-axe:

javascript
describe('Accessibility Tests', () => {
  it('should pass accessibility checks', () => {
    cy.visit('/')
    cy.injectAxe()
    cy.checkA11y()
  })
})

Run accessibility tests:

bash
npm run test:a11y

Network Stubbing

Enhanced network mocking capabilities:

javascript
// Mock REST API
cy.mockNetworkResponse('GET', '/api/users', { users: [] })

// Mock GraphQL
cy.mockGraphQL('GetUsers', { data: { users: [] } })

Test Data Management

Factory pattern for test data generation:

javascript
import UserFactory from '../support/factories/userFactory'

describe('User Tests', () => {
  it('should create user', () => {
    const user = UserFactory.generate()
    // Use generated user data in tests
  })

  it('should create multiple users', () => {
    const users = UserFactory.generateMany(3)
    // Use generated users data in tests
  })
})

Additional Dependencies

New testing capabilities are provided by:

json
{
  "@simonsmith/cypress-image-snapshot": "^10.0.4",
  "cypress-axe": "^1.7.0",
  "@testing-library/cypress": "^10.1.3",
  "cypress-real-events": "^1.15.0"
}

Debugging Tips

  1. Time Travel

    • Use Cypress Time Travel feature
    • Check screenshots in cypress/screenshots
    • Review videos in cypress/videos
  2. Logging

    • Use cy.log() for debug information
    • Enable Chrome DevTools in interactive mode

Contributing

We welcome contributions that help improve this Cypress Page Object Model framework! Here's how you can contribute:

Types of Contributions

  1. Page Objects

    • New page object implementations
    • Improvements to existing page objects
    • Utility functions for common actions
  2. Test Examples

    • UI test examples
    • API test examples
    • Integration test patterns
  3. Documentation

    • Usage examples
    • Best practices
    • Troubleshooting guides

How to Contribute

  1. Fork and Clone

    bash
    # Fork this repository on GitHub
    git clone https://github.com/YOUR_USERNAME/Cypress-POM-Ready-To-Use.git
    cd Cypress-POM-Ready-To-Use
    npm install
  2. Create a Branch

    bash
    git checkout -b feature/your-feature-name
  3. Make Changes

    • Follow the existing code structure
    • Add tests for new features
    • Update documentation as needed
  4. Contribution Guidelines

    • Use TypeScript for new files
    • Follow the page object pattern
    • Add JSDoc comments for methods
    • Include test cases for new features
    typescript
    /**
     * Example of a well-documented page object
     */
    class ExamplePage extends BasePage {
      private selectors = {
        submitButton: '[data-testid="submit"]'
      }
    
      /**
       * Submits the form with given data
       * @param {string} data - The data to submit
       * @returns {Cypress.Chainable}
       */
      submitForm(data: string) {
        return this.getElement(this.selectors.submitButton).click()
      }
    }
  5. Run Tests

    bash
    npm run test        # Run all tests
    npm run lint        # Check code style
    npm run build       # Ensure build passes
  6. Submit PR

    • Create a Pull Request against the main branch
    • Provide a clear description of changes
    • Reference any related issues
    • Wait for review and address feedback

Directory Structure for Contributions

cypress/
├── e2e/                    # Add tests here
│   ├── api/               # API test examples
│   └── ui/                # UI test examples
├── pageObjects/           # Add page objects here
│   ├── components/        # Reusable components
│   └── pages/            # Page implementations
└── support/              # Add custom commands here
    └── commands/         # Custom command implementations

Code Style Guide

  1. Naming Conventions

    • Use PascalCase for page objects: LoginPage.ts
    • Use camelCase for methods: submitForm()
    • Use descriptive test names: 'should successfully submit form'
  2. File Organization

    • One page object per file
    • Group related tests in describe blocks
    • Keep selectors in a separate object
  3. Testing Standards

    • Write atomic tests
    • Use meaningful assertions
    • Avoid hard-coded waits

Need Help?

  • Check existing issues
  • Join our [Discord community]
  • Read our [documentation]

Support

  • Documentation: See docs/ folder
  • Issues: GitHub Issues
  • Community: [Join our Discord]

FAQ

Common Configuration Issues

  1. Error with cypress.config.js

    javascript
    const { defineConfig } = require('cypress')

    Solution: Ensure proper configuration setup:

    • Install browserify preprocessor: npm install @cypress/browserify-preprocessor --save-dev
    • Use the complete configuration:
    javascript
    const { defineConfig } = require('cypress')
    const createBundler = require('@cypress/browserify-preprocessor')
    
    module.exports = defineConfig({
      viewportWidth: 1920,
      viewportHeight: 1080,
      watchForFileChanges: false
      // ... other configurations
    })
  2. TypeScript Support

    • Ensure these dependencies are installed:
    json
    {
      "devDependencies": {
        "@cypress/browserify-preprocessor": "^3.0.2",
        "@types/node": "^22.19.18",
        "typescript": "^5.9.3"
      }
    }
  3. Running Tests

    • For UI tests: npm run test:ui
    • For API tests: npm run test:api
    • For parallel execution: npm run test:parallel
  4. Environment Configuration

    • Default environments are:
      • API URL: https://reqres.in
      • React App URL: https://react-redux.realworld.io
      • Example URL: https://example.cypress.io
  5. Docker Questions

    Q: Do I need Docker installed to run tests?

    • No, Docker is optional. You can run tests locally with Node.js or use Docker for containerized testing.

    Q: How do I run tests in Docker?

    bash
    # Quick start
    docker-compose up --build cypress
    
    # Or using Docker directly
    docker build -t cypress-pom-tests .
    docker run --rm cypress-pom-tests

    Q: Can I access test reports from Docker?

    Q: How do I debug tests in Docker?

    bash
    # Interactive shell
    docker run --rm -it cypress-pom-tests /bin/bash
    
    # Enable debug logs
    docker run --rm -e DEBUG=cypress:* cypress-pom-tests

    Q: Docker builds are slow, how to speed up?

    bash
    # Use BuildKit
    DOCKER_BUILDKIT=1 docker build -t cypress-pom-tests .
    
    # Use cache effectively (already configured in Dockerfile)

Best Practices

  1. Page Object Model

    • Keep selectors in page objects
    • Use data-testid attributes
    • Implement base page for common functions
  2. Test Organization

    • API tests in cypress/e2e/api/
    • UI tests in cypress/e2e/ui/
    • Integration tests in cypress/e2e/integration/
  3. Performance

    • Use cy.session() for login state
    • Enable retries in CI mode
    • Implement proper timeouts

Quick Reference

Essential Commands

CommandDescription
npm run presetupInstall all dependencies
npm run cypress:openOpen Cypress Test Runner
npm run test:uiRun UI tests
npm run test:apiRun API tests
npm run test:ciRun tests in CI mode
npm run test:parallelRun tests in parallel

Docker Commands

CommandDescription
npm run docker:buildBuild Docker image
npm run docker:runRun tests in Docker
npm run docker:compose:upStart with docker-compose
npm run docker:compose:reportsView reports (localhost:8080)
docker-compose up --build cypressBuild and run tests
docker run --rm cypress-pom-testsRun tests (direct)

File Structure

cypress/
├── e2e/                    # Test files
│   ├── api/               # API tests
│   ├── ui/                # UI tests
│   └── accessibility/     # A11y tests
├── pageObjects/           # Page Object Models
├── fixtures/              # Test data
├── support/               # Custom commands & helpers
└── reports/               # Test reports

License

MIT License - feel free to use in your projects

Contact

MCP (Model Context Protocol) Integration

Using ChatMode Templates with MCP

This repository provides MCP-compatible chatmode templates that can be accessed directly by AI assistants and automation tools through the Model Context Protocol. The chatmode folder contains professional testing templates and best practices documentation that can be used for context-aware test generation and documentation.

Available MCP Resources

The following resources are available in the cypress/chatmode/ directory for MCP integration:

  1. Test Case Template (test-case-template.md)

    • Standardized test case documentation format
    • Use for generating consistent test documentation
    • Includes: Test ID, priority, steps, expected results
  2. Bug Report Template (bug-report-template.md)

    • Professional bug reporting structure
    • Severity and priority classification
    • Reproduction steps and impact assessment
  3. Test Execution Report (test-execution-report.md)

    • Comprehensive test execution summary
    • Statistics, metrics, and defect tracking
    • Stakeholder-ready reporting format
  4. API Testing Checklist (api-testing-checklist.md)

    • Complete API testing coverage checklist
    • Security, performance, and validation checks
    • Best practices and edge cases
  5. UI Testing Best Practices (ui-testing-best-practices.md)

    • Detailed testing guidelines and patterns
    • Selector strategies and debugging techniques
    • Common pitfalls and solutions

MCP Integration Guide

For AI Assistants (Claude, ChatGPT, etc.)

AI assistants can reference these templates when helping users:

Repository: padmarajnidagundi/Cypress-POM-Ready-To-Use
Path: cypress/chatmode/
Branch: main

Available Templates:
- test-case-template.md
- bug-report-template.md
- test-execution-report.md
- api-testing-checklist.md
- ui-testing-best-practices.md

For MCP Servers

Create an MCP server configuration to expose chatmode templates:

json
{
  "mcpServers": {
    "cypress-chatmode": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "./cypress/chatmode"],
      "env": {
        "ALLOWED_DIRECTORIES": "./cypress/chatmode"
      }
    }
  }
}

Usage Examples

1. Generate Test Case:

bash
# AI can read template and generate test case
mcp read cypress/chatmode/test-case-template.md

2. Create Bug Report:

bash
# Use template to structure bug reports
mcp read cypress/chatmode/bug-report-template.md

3. Access Best Practices:

bash
# Reference guidelines during test development
mcp read cypress/chatmode/ui-testing-best-practices.md

Direct File Access via GitHub

Templates can be accessed directly via GitHub URLs for MCP tools:

https://raw.githubusercontent.com/padmarajnidagundi/Cypress-POM-Ready-To-Use/main/cypress/chatmode/test-case-template.md
https://raw.githubusercontent.com/padmarajnidagundi/Cypress-POM-Ready-To-Use/main/cypress/chatmode/bug-report-template.md
https://raw.githubusercontent.com/padmarajnidagundi/Cypress-POM-Ready-To-Use/main/cypress/chatmode/test-execution-report.md
https://raw.githubusercontent.com/padmarajnidagundi/Cypress-POM-Ready-To-Use/main/cypress/chatmode/api-testing-checklist.md
https://raw.githubusercontent.com/padmarajnidagundi/Cypress-POM-Ready-To-Use/main/cypress/chatmode/ui-testing-best-practices.md

MCP Use Cases

1. Context-Aware Test Generation

AI assistants can use chatmode templates as context to generate:

  • Structured test cases following your team's format
  • Bug reports with all required information
  • Test execution summaries with proper metrics

2. Documentation Automation

Automatically generate testing documentation using templates:

  • Convert test code to documentation format
  • Create test reports from execution results
  • Generate checklists for test planning

3. Code Review & Quality Checks

Reference best practices during code review:

  • Validate test structure against guidelines
  • Check API testing coverage
  • Ensure proper selector usage

4. Team Onboarding

Use templates for training new team members:

  • Provide standardized documentation format
  • Share testing best practices
  • Establish consistent workflows

Setting Up MCP for This Repository

Step 1: Clone the Repository

bash
git clone https://github.com/padmarajnidagundi/Cypress-POM-Ready-To-Use.git
cd Cypress-POM-Ready-To-Use

Step 2: Configure MCP Server (for Cline, Claude Desktop, etc.)

Add to your MCP configuration file (e.g., cline_mcp_settings.json):

json
{
  "mcpServers": {
    "cypress-templates": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/absolute/path/to/Cypress-POM-Ready-To-Use/cypress/chatmode"
      ]
    }
  }
}

Step 3: Use Templates in Your Workflow

Once configured, AI assistants can:

  • Read templates to understand your documentation standards
  • Generate new documents based on templates
  • Reference best practices during test development
  • Provide context-aware suggestions

Benefits of MCP Integration

  1. Consistency: All generated documentation follows your templates
  2. Efficiency: Faster test documentation and report generation
  3. Quality: AI-generated content adheres to best practices
  4. Collaboration: Team members get consistent guidance
  5. Scalability: Easy to extend with more templates

Future MCP Enhancements

Planned features for enhanced MCP integration:

  • Dynamic Page Objects: MCP-aware page object generation
  • Test Orchestration: Cross-layer test flow automation
  • Live Context Switching: Dynamic environment and context management
  • CI/CD Integration: MCP endpoints for build systems
  • Custom Commands: Cypress commands for MCP interaction
  • Real-time Reporting: Stream test results via MCP

Contributing MCP Templates

We welcome contributions of additional templates:

  1. Create new .md template in cypress/chatmode/
  2. Follow existing template structure
  3. Add usage examples
  4. Submit pull request

Template Guidelines:

  • Use clear, descriptive headers
  • Include examples and placeholders
  • Add usage instructions
  • Keep format consistent

Status: MCP integration is ACTIVE - chatmode templates are ready to use with any MCP-compatible tool!


AI Agents

Overview

This framework is designed to work seamlessly with AI coding agents such as GitHub Copilot (VS Code), Cursor, Cline, Claude, and similar tools. The cypress/chatmode/ templates and the MCP server configuration give any agent the context it needs to generate, review, and maintain your Cypress tests automatically.


GitHub Copilot Agent (VS Code)

What the Agent Does

CapabilityDescription
Generate TestsAsk Copilot to write new Cypress specs using existing page objects
Fix Failing TestsPaste error output and let Copilot suggest a fix
Scaffold Page ObjectsDescribe a page and Copilot produces a typed POM class
Add Custom CommandsRequest new cy.* commands in cypress/support/commands/
Review Test QualityAsk Copilot to audit selectors, waits, and assertions
Generate FixturesProduce realistic JSON test-data files under cypress/fixtures/

Quick Start — Copilot Chat

  1. Open the Copilot Chat panel in VS Code (Ctrl+Alt+I / Cmd+Alt+I).
  2. Open the relevant spec or page-object file so Copilot has file context.
  3. Type a natural-language request:
@workspace Generate a Cypress spec for the Login page using the ReactLogin page object.
@workspace Add a custom command cy.loginAsAdmin() that calls POST /api/login and stores
the token in localStorage.
@workspace Review cypress/e2e/api/users.cy.js and suggest improvements for selector
strategy and assertion depth.

Copilot Agent Mode

Enable Agent mode (GitHub Copilot Edits) for multi-file changes:

  1. Click the Copilot icon in the VS Code sidebar → Open Copilot Edits.
  2. Type your intent across multiple files, e.g.:
Create a new page object for the Pricing page, add a spec that validates all plan cards,
and register a custom Cypress command `cy.checkPricingCard(planName)`.

Copilot will propose edits across pageObjects/, e2e/, and support/commands/ simultaneously.

Inline Completions in Test Files

Copilot provides real-time completions inside spec files:

javascript
// Start typing — Copilot completes the full test body
it

安装

TypingMind
前提条件:

Node.js 18+

{
  "mcpServers": {
    "padmarajnidagundi-cypress-pom-ready-to-use": {
      "command": "",
      "args": []
    }
  }
}

将 Cypress Page Object Model Framework 2026 MCP 与多个 AI 模型配合使用

TypingMind 在工作区级别连接 MCP 工具,因此连接 Cypress Page Object Model Framework 2026 后,您就可以在 TypingMind 中搭配不同的 AI 模型使用,无需为每个模型单独设置。 此 MCP 通过您设备上的 TypingMind MCP 连接器在本地运行。

本地连接器设置指南

如果 MCP 服务器需要访问您电脑上的本地文件、应用或私有资源,请选择此方式。

1

打开 MCP 设置

在 TypingMind 中,依次前往“设置”、“高级设置”和“模型上下文协议”,然后选择“设置连接器”。

  1. 在您的浏览器中打开 TypingMind。
  2. 点击“设置”图标。
  3. 进入“高级设置”。
  4. 打开“模型上下文协议”部分。
  5. 点击“设置连接器”,然后选择“此设备”。
TypingMind MCP 连接器设置界面,已选择“此设备”
2

运行连接器命令

选择“此设备”,从 TypingMind 复制命令并在终端中运行。使用 MCP 时,请保持该进程运行。

  1. 复制 TypingMind 显示的设置命令。
  2. 在 macOS 上打开“终端”,或在 Windows 上打开 Windows Terminal。
  3. 粘贴并运行命令。
  4. 如果终端询问您是否继续,请确认安装软件包。
  5. 使用 MCP 工具时,请勿关闭终端窗口或停止其中的连接器进程。
3

将 Cypress Page Object Model Framework 2026 添加为服务器

当连接器状态为“就绪”时,点击“编辑服务器”,然后粘贴 MCP 服务器配置。

  1. 等待连接器状态显示为“就绪”。
  2. 点击“编辑服务器”。
  3. 粘贴 Cypress Page Object Model Framework 2026 MCP 服务器配置。
  4. 保存服务器列表。
  5. 如需确认连接器是否仍处于就绪状态,请刷新。
TypingMind MCP 设置界面,显示正在运行的服务器和“编辑服务器”按钮
{
  "mcpServers": {
    "padmarajnidagundi-cypress-pom-ready-to-use": {
      "command": "npx",
      "args": [
        "-y",
        "cypress-page-object-model"
      ]
    }
  }
}
4

在不同模型中使用同一连接

保存服务器列表,打开“插件”,启用 Cypress Page Object Model Framework 2026 MCP 工具,然后在 TypingMind 中选择任意受支持的 AI 模型,即可在聊天中使用这些工具,或将其分配给智能体。

  1. 在 TypingMind 中打开“插件”页面。
  2. 启用 Cypress Page Object Model Framework 2026 MCP 工具。
  3. 开始聊天并选择您想使用的 AI 模型。
  4. 在聊天中使用 MCP 工具,或将其分配给 AI 智能体。
  5. 根据需要随时切换到其他 AI 模型,无需重新连接 MCP。
在 TypingMind 聊天中使用已启用的 MCP 工具和选定的 AI 模型
您能使用 Cypress Page Object Model Framework 2026 帮我完成这项任务吗?
Cypress Page Object Model Framework 2026
当然,我看过了。
以下是我使用 Cypress Page Object Model Framework 2026 得到的结果。

常见问题

Cypress Page Object Model Framework 2026 MCP 服务器有什么用途?

Cypress Page Object Model Framework 2026 是一个 MCP 服务器,可让兼容的 AI 客户端连接外部工具并获取上下文。在 TypingMind 中,只需添加一次此 MCP 服务器,即可在您的 AI 工作区中使用其工具。

可以在 TypingMind 中让多个 AI 模型使用 Cypress Page Object Model Framework 2026 MCP 吗?

可以。TypingMind 在工作区层面连接 MCP 工具,因此您无需为每个模型单独配置 MCP 服务器,就能在 Claude、ChatGPT、Gemini 或您在 TypingMind 中配置的其他 AI 模型中使用 Cypress Page Object Model Framework 2026。

为什么在 TypingMind 中使用 Cypress Page Object Model Framework 2026 MCP?

TypingMind 将多个 AI 模型、提示词、插件、AI 智能体、API 密钥和 MCP 工具整合到同一个工作区中,是最出色的大语言模型聊天前端之一。连接 Cypress Page Object Model Framework 2026 后,您可以在偏好的不同模型中使用其 MCP 工具,同时在 TypingMind 中井然有序地管理聊天工作流程。

如何将 Cypress Page Object Model Framework 2026 MCP 连接到 TypingMind?

Cypress Page Object Model Framework 2026 通过 TypingMind 本地 MCP 连接器运行。当 MCP 服务器需要访问您计算机上的本地文件、桌面应用、命令行工具或私有资源时,这种方式最合适。

Cypress Page Object Model Framework 2026 MCP 在 TypingMind 中提供哪些工具?

Cypress Page Object Model Framework 2026 提供 MCP 功能,您可以在 TypingMind 的插件页面启用这些功能,然后在聊天中使用,或将其分配给 AI 智能体。

使用 Cypress Page Object Model Framework 2026 MCP 需要向 TypingMind 提供我的 API 密钥吗?

不需要。TypingMind 采用本地优先的设计,让您自行选择模型提供商,并自行管理 API 密钥、提示词和 MCP 配置。如果 Cypress Page Object Model Framework 2026 需要身份验证,请在创建连接时,为该 MCP 服务器添加所需的请求头、OAuth 设置或本地配置。

相关 MCP 服务器

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇