Comprehensive Testing Framework Overhaul and CI Infrastructure
Overview
This PR establishes a complete, production-ready testing framework for the CommunityRule application, consolidating Storybook configuration, implementing comprehensive E2E testing with Playwright, and creating a robust CI/CD pipeline for the Gitea runner environment. The changes transform the project from basic unit tests to a multi-layered testing strategy that ensures code quality, visual consistency, and performance across all browsers and devices.
Changes
��️ Testing Framework Architecture
Multi-layered testing strategy: Unit (Vitest), Integration, E2E (Playwright), Visual Regression, Performance (Lighthouse CI), and Storybook testing
Cross-browser compatibility: Full test coverage across Chromium, Firefox, WebKit, and Mobile projects
Test consolidation: Removed redundant visual regression tests from E2E files, establishing clear separation of concerns
�� Storybook Consolidation & Configuration
Environment-aware configuration: Automatic detection between local development and production/CI environments
GitHub Pages integration: Base path configuration for /communityrulestorybook/ deployment
Testing integration: @storybook/test-runner and @storybook/test for automated component testing
Accessibility addons: @storybook/addon-a11y for WCAG compliance validation
Viewport testing: Responsive design validation across multiple breakpoints
🧪 E2E Testing Infrastructure
Playwright configuration: Optimized for CI environment with deterministic rendering
Functional test coverage: 77 tests across 4 test suites (homepage, user-journeys, header.responsive, footer.responsive)
Visual regression separation: Dedicated visual-regression.spec.ts with 23 screenshot tests
Accessibility testing: ARIA role validation and screen reader compatibility
🎨 Visual Regression Testing
Deterministic rendering: Timezone (UTC), locale (en-US), font rasterization settings
Layout stabilization: settle() helper function for consistent screenshot timing
CSS normalization: Deterministic CSS for caret, scrollbars, and font rendering
Browser-specific snapshots: Separate baseline images for each browser engine
Tolerance management: Configurable pixel difference thresholds for CI environment variations
⚡ Performance Testing
Lighthouse CI integration: Performance budgets and Core Web Vitals monitoring
Chrome path resolution: Robust browser installation and path detection for CI
Architecture compatibility: Fixed Node.js x64 vs Chrome arm64 mismatch on macOS runners
Performance budgets: Configurable thresholds for TTFB, FCP, LCP, and interaction metrics
🔄 CI/CD Pipeline (Gitea Actions)
7 parallel jobs: Unit tests, E2E tests, Visual regression, Performance, Storybook, Lint, and Build
Self-hosted runner: Optimized for macOS arm64 architecture
Single-step server management: Start+test+teardown approach preventing process termination issues
Port conflict resolution: Dedicated port 3010 for CI testing, avoiding conflicts with local development
Gitea compatibility: Conditional GitHub vs non-GitHub configuration for caching and setup
Baseline snapshot generation: seed-vr-snapshots job on main branch for stable visual regression baselines
🧹 Code Quality & Maintenance
ESLint configuration: Comprehensive linting rules with Storybook integration
Prettier formatting: Consistent code style across all test files
TypeScript support: Full type checking for test files and configuration
Test documentation: Comprehensive docs/TESTING.md with examples and workflows
Screenshots
How to Test
🚀 Quick Start
# Install dependencies and Playwright browsers
npm install
npx playwright install
# Run all test suites
npm test# Unit tests with coverage
npm run e2e # E2E tests across all browsers
npm run test:sb # Storybook tests
npm run lhci # Performance tests
🧪 Comprehensive Testing
# Unit testing
npm run test:watch # Watch mode for development
npm run test:ui # UI-based test runner# E2E testing
npm run e2e:ui # Playwright UI for debugging
npm run e2e:serve # Dev server + E2E tests# Visual regression
npm run visual:test # Run visual regression tests
npm run visual:update # Update snapshots# Performance monitoring
npm run performance:budget # Budget-based testing
npm run performance:monitor # Continuous monitoring
🔍 Verification Checklist
Unit Tests: 124 tests passing with >85% coverage
E2E Tests: All 77 tests pass across Chromium, Firefox, WebKit, and Mobile
Performance: Lighthouse CI scores meet budget thresholds
Storybook: Builds successfully with GitHub Pages configuration
Responsive Design: All breakpoints render correctly (xs through 4xl)
Accessibility: WCAG compliance across all components
Cross-browser: Consistent behavior in Chromium, Firefox, WebKit, and Mobile
🌐 Browser Testing Matrix
Chromium: Full test suite validation
Firefox: Cross-engine compatibility
WebKit: Safari engine validation
Mobile: Responsive design verification
Notes
🏗️ Architecture Decisions
Testing separation: Functional E2E tests separate from visual regression for maintainability
CI optimization: Single-step server management prevents environment drift between CI steps
Port isolation: Port 3010 dedicated to CI to avoid conflicts with local development on 3000
Snapshot strategy: CI-generated baseline snapshots eliminate local vs CI environment differences
🔧 CI Environment
Self-hosted runner: Manual activation for resource management and control
Architecture compatibility: arm64 Node.js + arm64 Chrome for optimal performance
Gitea integration: Conditional configuration for GitHub vs Gitea environments
Baseline management: Automated snapshot generation on main branch for stable comparisons
🚀 Future Improvements
Test coverage expansion: Additional edge cases and accessibility scenarios
Performance optimization: Dynamic budget adjustment based on production metrics
Visual regression stability: Enhanced deterministic rendering for CI environments
Storybook enhancement: Additional addons for component testing and documentation
�� Known Limitations
Visual regression variations: Slight differences between local and CI due to font rendering
Performance thresholds: Conservative budgets that may need tuning based on real usage
Placeholder content: Some tests use placeholder links that don't navigate to actual pages
CI runner management: Manual activation required for resource optimization
🔗 Dependencies & Integrations
Playwright: E2E testing framework with visual regression capabilities
Lighthouse CI: Performance monitoring and budget enforcement
Storybook: Component development and testing environment
Vitest: Fast unit test runner with React Testing Library integration
Gitea Actions: CI/CD platform for automated testing and deployment
Next.js 15: Application framework with built-in testing support
�� Documentation
Comprehensive testing guide: docs/TESTING.md with examples and workflows
Runner management scripts: Shell scripts for CI runner control
Configuration examples: Playwright, Storybook, and CI workflow configurations
Best practices: Testing patterns and maintenance guidelines
# Comprehensive Testing Framework Overhaul and CI Infrastructure
## Overview
This PR establishes a complete, production-ready testing framework for the CommunityRule application, consolidating Storybook configuration, implementing comprehensive E2E testing with Playwright, and creating a robust CI/CD pipeline for the Gitea runner environment. The changes transform the project from basic unit tests to a multi-layered testing strategy that ensures code quality, visual consistency, and performance across all browsers and devices.
## Changes
### ��️ Testing Framework Architecture
- **Multi-layered testing strategy**: Unit (Vitest), Integration, E2E (Playwright), Visual Regression, Performance (Lighthouse CI), and Storybook testing
- **Cross-browser compatibility**: Full test coverage across Chromium, Firefox, WebKit, and Mobile projects
- **Test consolidation**: Removed redundant visual regression tests from E2E files, establishing clear separation of concerns
### �� Storybook Consolidation & Configuration
- **Environment-aware configuration**: Automatic detection between local development and production/CI environments
- **GitHub Pages integration**: Base path configuration for `/communityrulestorybook/` deployment
- **Testing integration**: `@storybook/test-runner` and `@storybook/test` for automated component testing
- **Accessibility addons**: `@storybook/addon-a11y` for WCAG compliance validation
- **Viewport testing**: Responsive design validation across multiple breakpoints
### 🧪 E2E Testing Infrastructure
- **Playwright configuration**: Optimized for CI environment with deterministic rendering
- **Responsive testing**: Comprehensive breakpoint coverage (xs, sm, md, lg, xl, 2xl, 3xl, 4xl, full)
- **Functional test coverage**: 77 tests across 4 test suites (homepage, user-journeys, header.responsive, footer.responsive)
- **Visual regression separation**: Dedicated `visual-regression.spec.ts` with 23 screenshot tests
- **Accessibility testing**: ARIA role validation and screen reader compatibility
### 🎨 Visual Regression Testing
- **Deterministic rendering**: Timezone (UTC), locale (en-US), font rasterization settings
- **Layout stabilization**: `settle()` helper function for consistent screenshot timing
- **CSS normalization**: Deterministic CSS for caret, scrollbars, and font rendering
- **Browser-specific snapshots**: Separate baseline images for each browser engine
- **Tolerance management**: Configurable pixel difference thresholds for CI environment variations
### ⚡ Performance Testing
- **Lighthouse CI integration**: Performance budgets and Core Web Vitals monitoring
- **Chrome path resolution**: Robust browser installation and path detection for CI
- **Architecture compatibility**: Fixed Node.js x64 vs Chrome arm64 mismatch on macOS runners
- **Performance budgets**: Configurable thresholds for TTFB, FCP, LCP, and interaction metrics
### 🔄 CI/CD Pipeline (Gitea Actions)
- **7 parallel jobs**: Unit tests, E2E tests, Visual regression, Performance, Storybook, Lint, and Build
- **Self-hosted runner**: Optimized for macOS arm64 architecture
- **Single-step server management**: Start+test+teardown approach preventing process termination issues
- **Port conflict resolution**: Dedicated port 3010 for CI testing, avoiding conflicts with local development
- **Gitea compatibility**: Conditional GitHub vs non-GitHub configuration for caching and setup
- **Baseline snapshot generation**: `seed-vr-snapshots` job on main branch for stable visual regression baselines
### 🧹 Code Quality & Maintenance
- **ESLint configuration**: Comprehensive linting rules with Storybook integration
- **Prettier formatting**: Consistent code style across all test files
- **TypeScript support**: Full type checking for test files and configuration
- **Test documentation**: Comprehensive `docs/TESTING.md` with examples and workflows
## Screenshots
<img width="909" alt="Screenshot 2025-09-03 at 12.49.45 PM.png" src="attachments/3eb2ecb6-baa3-4833-91fc-c7f3fdf3bf6c">
## How to Test
### 🚀 Quick Start
```bash
# Install dependencies and Playwright browsers
npm install
npx playwright install
# Run all test suites
npm test # Unit tests with coverage
npm run e2e # E2E tests across all browsers
npm run test:sb # Storybook tests
npm run lhci # Performance tests
```
### 🧪 Comprehensive Testing
```bash
# Unit testing
npm run test:watch # Watch mode for development
npm run test:ui # UI-based test runner
# E2E testing
npm run e2e:ui # Playwright UI for debugging
npm run e2e:serve # Dev server + E2E tests
# Visual regression
npm run visual:test # Run visual regression tests
npm run visual:update # Update snapshots
# Performance monitoring
npm run performance:budget # Budget-based testing
npm run performance:monitor # Continuous monitoring
```
### 🔍 Verification Checklist
- [ ] **Unit Tests**: 124 tests passing with >85% coverage
- [ ] **E2E Tests**: All 77 tests pass across Chromium, Firefox, WebKit, and Mobile
- [ ] **Visual Regression**: 23 screenshot tests generate consistent results
- [ ] **Performance**: Lighthouse CI scores meet budget thresholds
- [ ] **Storybook**: Builds successfully with GitHub Pages configuration
- [ ] **Responsive Design**: All breakpoints render correctly (xs through 4xl)
- [ ] **Accessibility**: WCAG compliance across all components
- [ ] **Cross-browser**: Consistent behavior in Chromium, Firefox, WebKit, and Mobile
### 🌐 Browser Testing Matrix
- **Chromium**: Full test suite validation
- **Firefox**: Cross-engine compatibility
- **WebKit**: Safari engine validation
- **Mobile**: Responsive design verification
## Notes
### 🏗️ Architecture Decisions
- **Testing separation**: Functional E2E tests separate from visual regression for maintainability
- **CI optimization**: Single-step server management prevents environment drift between CI steps
- **Port isolation**: Port 3010 dedicated to CI to avoid conflicts with local development on 3000
- **Snapshot strategy**: CI-generated baseline snapshots eliminate local vs CI environment differences
### 🔧 CI Environment
- **Self-hosted runner**: Manual activation for resource management and control
- **Architecture compatibility**: arm64 Node.js + arm64 Chrome for optimal performance
- **Gitea integration**: Conditional configuration for GitHub vs Gitea environments
- **Baseline management**: Automated snapshot generation on main branch for stable comparisons
### 🚀 Future Improvements
- **Test coverage expansion**: Additional edge cases and accessibility scenarios
- **Performance optimization**: Dynamic budget adjustment based on production metrics
- **Visual regression stability**: Enhanced deterministic rendering for CI environments
- **Storybook enhancement**: Additional addons for component testing and documentation
### �� Known Limitations
- **Visual regression variations**: Slight differences between local and CI due to font rendering
- **Performance thresholds**: Conservative budgets that may need tuning based on real usage
- **Placeholder content**: Some tests use placeholder links that don't navigate to actual pages
- **CI runner management**: Manual activation required for resource optimization
### 🔗 Dependencies & Integrations
- **Playwright**: E2E testing framework with visual regression capabilities
- **Lighthouse CI**: Performance monitoring and budget enforcement
- **Storybook**: Component development and testing environment
- **Vitest**: Fast unit test runner with React Testing Library integration
- **Gitea Actions**: CI/CD platform for automated testing and deployment
- **Next.js 15**: Application framework with built-in testing support
### �� Documentation
- **Comprehensive testing guide**: `docs/TESTING.md` with examples and workflows
- **Runner management scripts**: Shell scripts for CI runner control
- **Configuration examples**: Playwright, Storybook, and CI workflow configurations
- **Best practices**: Testing patterns and maintenance guidelines
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Comprehensive Testing Framework Overhaul and CI Infrastructure
Overview
This PR establishes a complete, production-ready testing framework for the CommunityRule application, consolidating Storybook configuration, implementing comprehensive E2E testing with Playwright, and creating a robust CI/CD pipeline for the Gitea runner environment. The changes transform the project from basic unit tests to a multi-layered testing strategy that ensures code quality, visual consistency, and performance across all browsers and devices.
Changes
��️ Testing Framework Architecture
�� Storybook Consolidation & Configuration
/communityrulestorybook/deployment@storybook/test-runnerand@storybook/testfor automated component testing@storybook/addon-a11yfor WCAG compliance validation🧪 E2E Testing Infrastructure
visual-regression.spec.tswith 23 screenshot tests🎨 Visual Regression Testing
settle()helper function for consistent screenshot timing⚡ Performance Testing
🔄 CI/CD Pipeline (Gitea Actions)
seed-vr-snapshotsjob on main branch for stable visual regression baselines🧹 Code Quality & Maintenance
docs/TESTING.mdwith examples and workflowsScreenshots
How to Test
🚀 Quick Start
🧪 Comprehensive Testing
🔍 Verification Checklist
🌐 Browser Testing Matrix
Notes
🏗️ Architecture Decisions
🔧 CI Environment
🚀 Future Improvements
�� Known Limitations
🔗 Dependencies & Integrations
�� Documentation
docs/TESTING.mdwith examples and workflows7123cde0e5to8965dd5878bead0c7373tocfe54737b8147dd013abtoa2381fe148fix-runner-triggerto Testing Framwork