Test suites in Keystone are collections of related tests that can be executed together. The CLI runner enables powerful local execution of these suites with full visibility and debugging capabilities.
# Start runner for suite executionkeystone start --proxy --api-key your-api-key# Suites are managed in Keystone Studio# Execute suites against local environment# Full visibility into suite progression# Individual test results and timing
# 1. Start development environmentnpm run dev# 2. Start CLI runner with debug outputkeystone start --proxy --debug# 3. From Keystone Studio:# - Select suite to run (e.g., "Auth Flow")# - Configure to run against localhost:3000# - Execute suite with local browser visibility# - Monitor individual test results
# Development suite# - Tests against localhost# - Includes debugging and development features# - Fast feedback for development changes# Staging suite # - Tests against staging environment# - Comprehensive feature validation# - Pre-production verification# Production suite# - Health checks and monitoring# - Critical path validation# - Minimal invasive testing
# Smoke test suite (fast, critical paths)# - Run on every commit# - 5-10 tests, under 5 minutes# - Basic functionality validation# Regression suite (comprehensive)# - Run nightly or before releases# - Full feature coverage# - Edge cases and error scenarios# Performance suite (specialized)# - Run on performance-critical changes# - Load testing and timing validation# - Resource usage monitoring
# Execute suite with full debuggingkeystone start --proxy --debug --headed# Benefits:# - See each test execute in real browser# - Debug failures immediately# - Inspect element selectors# - Monitor network requests# - Access browser dev tools
Fast iteration:
Copy
Ask AI
# Test development cycle# 1. Modify application code# 2. Run relevant test suite# 3. Debug any failures immediately# 4. Iterate quickly on fixes# 5. Verify changes before commit
Local environment testing:
Copy
Ask AI
# Test against local changesgit checkout feature/new-checkoutnpm run devkeystone start --proxy# Execute checkout suite against localhost# Validate feature works before deployment# Catch integration issues early
# Authentication suite setupsetup_auth_data() { npm run db:seed:users npm run cache:clear:sessions}# E-commerce suite setupsetup_ecommerce_data() { npm run db:seed:products npm run db:seed:orders npm run stripe:setup:test}# Run setup before suite executionsetup_auth_datakeystone start --proxy# Execute authentication suite from Studio
# Monitor resource usage during suite execution# Memory usageps aux | grep keystone | awk '{print $4}'# CPU usage top -p $(pgrep keystone)# Disk usage for recordingsdu -sh ~/.keystone/recordings/
# Run failing test in isolation# 1. Identify failing test from suite# 2. Execute single test with full debuggingkeystone start --proxy --debug --headed# 3. Debug specific failure# 4. Fix and re-run full suite
# Debug suite incrementally# 1. Run first few tests only# 2. Verify they pass# 3. Gradually add more tests# 4. Isolate problematic tests# 5. Fix issues and build up full suite
# Test CI configuration locallyexport CI=trueexport KEYSTONE_HEADLESS=truekeystone start --proxy --headless# Run same suites that will run in CI# Validate they pass in headless mode# Debug any CI-specific issues locally
# Ensure local matches CI environment# - Same Node.js version# - Same browser version# - Same environment variables# - Same test data setup# Use Docker for consistencydocker run -it node:18-slimnpm install -g @keystone/clikeystone start --proxy --headless
# Pre-commit suite validationgit add .npm run test:suite:criticalgit commit -m "Feature: new checkout flow"# Feature development validationgit checkout -b feature/user-profilesnpm run devkeystone start --proxy# Run user management suite against localhost
# Comprehensive debugging for suite issueskeystone start --proxy --debug --headed --slow-motion 500# Step through suite execution# Identify exactly where failures occur# Analyze browser state at failure points# Check network requests and responses
# Execute different suites based on environmentif [ "$NODE_ENV" = "development" ]; then # Run development suite echo "Running development test suite"elif [ "$NODE_ENV" = "staging" ]; then # Run staging suite echo "Running staging test suite"fi
# Ensure prerequisite suites pass first# 1. Run authentication suite# 2. If successful, run e-commerce suite# 3. If successful, run admin suite# Fail fast if any prerequisite fails