Skip to content

Acceptance Testing Framework

The acceptance testing framework provides end-to-end validation of puppeteer-mcp’s capabilities by testing against publicly available, stable websites and APIs. These tests ensure that the system works correctly in real-world scenarios.

  1. Basic Web Interactions (tests/acceptance/basic/)

    • Navigation and page loading
    • Form filling and submission
    • Element selection and interaction
    • Content extraction and validation
  2. API Interactions (tests/acceptance/api/)

    • REST API calls and responses
    • HTTP method testing
    • Error handling and status codes
    • Data parsing and validation
  3. Complex Workflows (tests/acceptance/workflows/)

    • E-commerce complete purchase flows
    • Authentication and session management
    • Multi-step business processes
    • State management across pages

All tests use publicly available, testing-friendly targets:

  • E-commerce: Sauce Demo, Automation Practice
  • APIs: HTTPBin, JSONPlaceholder, ReqRes, World Bank API
  • Testing Sites: The Internet, UI Testing Playground, DemoQA
  • Real-world: Hacker News, Angular/React demos

See testing-targets-reference.md for complete list and details.

Terminal window
# Run all acceptance tests
npm run test:acceptance
# Run specific test categories
npm run test:acceptance:basic
npm run test:acceptance:api
npm run test:acceptance:workflows
# Run with debugging (visible browser)
ACCEPTANCE_TEST_HEADLESS=false npm run test:acceptance:basic
# Run with slow motion for debugging
ACCEPTANCE_TEST_SLOW_MO=100 npm run test:acceptance:basic
VariableDescriptionDefault
ACCEPTANCE_TEST_TIMEOUTTest timeout in ms60000
ACCEPTANCE_TEST_RETRIESNumber of retries for flaky tests2
ACCEPTANCE_TEST_HEADLESSRun in headless modetrue
ACCEPTANCE_TEST_SLOW_MOSlow down actions in ms0

Acceptance tests run:

  • Manual: Via GitHub Actions workflow dispatch
  • Scheduled: Weekly on Sundays at 6 AM UTC
  • Optional: Can be triggered for specific test suites
Terminal window
# GitHub Actions provides these options:
# - Test suite selection (all, basic, api, workflows)
# - Headless mode toggle
# - Custom timeout settings

MCP Client Utilities (utils/mcp-client.ts)

Section titled “MCP Client Utilities (utils/mcp-client.ts)”

Provides high-level MCP interaction methods:

  • createMCPClient(): Start MCP server and connect client
  • createMCPSession(): Create browser session and context
  • mcpNavigate(), mcpClick(), mcpType(): Browser actions
  • mcpGetContent(), mcpScreenshot(): Data extraction
  • cleanupMCPSession(): Resource cleanup

Common utilities for robust testing:

  • retryOperation(): Retry with exponential backoff
  • waitForCondition(): Polling for conditions
  • makeRequest(): HTTP requests with retry logic
  • PerformanceTracker: Timing and performance measurement
  • AssertionHelpers: Specialized assertion methods

Centralized configuration for:

  • Test timeouts and retry settings
  • Target URLs and endpoints
  • Test credentials for demo sites
  • Browser and viewport settings
Terminal window
# Run with visible browser and slow motion
ACCEPTANCE_TEST_HEADLESS=false ACCEPTANCE_TEST_SLOW_MO=250 npm run test:acceptance:basic
# Run single test file
npx jest --config jest.acceptance.config.mjs tests/acceptance/basic/navigation.test.ts
# Collect detailed logs
DEBUG=puppeteer:* npm run test:acceptance:basic
FilePurpose
jest.acceptance.config.mjsJest configuration for acceptance tests
package.jsonTest scripts and dependencies
.github/workflows/acceptance-tests.ymlCI/CD workflow
tests/acceptance/utils/Framework utilities and configuration
  1. Follow existing patterns in test categories
  2. Use stable, public testing targets
  3. Implement proper retry and error handling
  4. Add performance tracking for critical paths
  5. Document any new test targets in the reference
  1. Validate new targets for stability and accessibility
  2. Add to test-config.ts with appropriate categorization
  3. Test against new targets before committing
  4. Update documentation with any special considerations
  • Tests run weekly to catch regressions
  • Artifacts collected on failures for debugging
  • Performance metrics tracked over time
  • External service health monitored

Acceptance tests complement the existing test suite:

Test TypePurposeScope
Unit TestsFast, isolated component testingIndividual functions
Integration TestsInternal API and component integrationSystem components
Acceptance TestsReal-world end-to-end validationComplete workflows
Security TestsAutomated security scanningSecurity compliance

This multi-layered approach ensures comprehensive coverage from individual functions to complete user workflows.

Planned improvements to the acceptance testing framework:

  1. Visual Regression Testing: Screenshot comparison across runs
  2. Performance Benchmarking: Automated performance regression detection
  3. Mobile Testing: Mobile browser and responsive design validation
  4. Accessibility Testing: Automated accessibility compliance checking
  5. Load Testing: Concurrent session and performance testing

The acceptance testing framework provides confidence that puppeteer-mcp works correctly in real-world scenarios while maintaining reliability and performance standards. By testing against stable public targets with robust retry mechanisms and comprehensive monitoring, the framework ensures system reliability in production environments.