Skip to content

feat: implement real integration testing with FoundryVTT containers #83

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

laurigates
Copy link
Owner

Summary

Replaces mock-heavy integration tests with real FoundryVTT instances using testcontainers and the proven felddy/foundryvtt-docker container. This addresses critical test quality issues where tests were validating implementation details rather than actual behavior.

Key Improvements

🔄 From Mock-Heavy to Real Testing

  • Eliminates over-mocking that reduced test value
  • Tests actual FoundryVTT API responses and data formats
  • Validates real authentication flows and WebSocket communication
  • Ensures contract compliance between mocks and reality

🛠 Technical Implementation

  • testcontainers: Programmatic Docker container management
  • felddy/foundryvtt-docker: Community-proven FoundryVTT containerization
  • GitHub Actions: Real FoundryVTT services in CI/CD pipeline
  • Security: Manual approval for fork PRs with credential access

Test Coverage

  • ✅ Real API operations with actual FoundryVTT responses
  • ✅ Authentication testing (API keys, WebSocket sessions)
  • ✅ Error scenarios (timeouts, network failures, invalid credentials)
  • ✅ Contract validation (API response schemas)
  • ✅ Connection lifecycle management

Usage

# Local testing with auto-managed containers
npm run test:integration

# CI/CD testing with GitHub secrets
# Requires: FOUNDRY_USERNAME, FOUNDRY_PASSWORD, FOUNDRY_LICENSE_KEY

Files Added/Modified

  • Integration Tests: /tests/integration/ - Real FoundryVTT testing
  • Configuration: vitest.integration.config.ts, docker-compose.test.yml
  • CI/CD: .github/workflows/integration.yml
  • Security: Credential templates and .gitignore updates
  • Dependencies: Added testcontainers for container management

This implementation provides the foundation for reliable, behavior-focused testing that validates actual FoundryVTT integration rather than mock configurations.

🤖 Generated with Claude Code

Replace mock-heavy integration tests with real FoundryVTT instances using
testcontainers and felddy/foundryvtt-docker. This addresses critical test
quality issues identified in the existing test suite.

Features:
- Real FoundryVTT container integration via testcontainers
- GitHub Actions CI/CD with Docker services
- Contract testing to validate API response schemas
- Authentication and WebSocket testing with real instances
- Comprehensive error scenario coverage
- Security-conscious fork PR handling with manual approval

Technical Implementation:
- Added testcontainers dependency for programmatic container management
- Created vitest.integration.config.ts for integration test configuration
- Implemented docker-compose.test.yml using proven community container
- Added credential management templates for secure testing
- Created comprehensive integration test suite in tests/integration/
- Added GitHub Actions workflow with real FoundryVTT services

This replaces implementation detail testing with behavior validation,
ensuring tests verify actual FoundryVTT integration rather than mock responses.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@laurigates laurigates force-pushed the feat/real-integration-testing branch from a80c0dc to 39bf30d Compare August 21, 2025 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant