Frontend QA & Testing Strategy
This section outlines the testing strategy, workflows, and technologies used in the Control-Hub (my-app) repository.
π Technology Stackβ
- Framework: Next.js 16 (React)
- Language: TypeScript
- State Management: React Query (Server state), Context API
- Styling: Tailwind CSS, Radix UI, shadcn/ui
- Testing Frameworks:
- Vitest (Unit & Integration)
- Playwright (E2E β configured, tests pending)
- Storybook (Component Isolation)
- Linting & Formatting: ESLint, Prettier
π§ͺ Testing Strategyβ
We employ a layered testing approach:
1. Unit & Integration Tests (Vitest)β
- Located in
__tests__or co-located with components. - Focus on individual components, hooks, and utility functions.
- Run with:
pnpm test
2. End-to-End Tests (Playwright)β
- Located in
e2edirectory. - Status: Infrastructure configured in CI, automated tests pending implementation.
- Run with:
pnpm test:e2e
3. Component Testing (Storybook)β
- Used for developing and testing UI components in isolation.
- Integration with Chromatic for visual regression testing (configured in
chromatic.config.json). - Run locally:
pnpm storybook
π CI/CD Workflowsβ
1. CI Pipeline (ci.yml)β
Triggers on push and pull_request to main and dev.
Stages:
- Quality Gates:
- TypeScript Check (
tsc --noEmit) - Linting (
pnpm run lint) - Formatting Check (
pnpm run format --check)
- TypeScript Check (
- Security Audit:
pnpm audit - Unit Tests: Executes Vitest suite with coverage.
- E2E Tests: Runs Playwright tests (headless Chromium).
- Build Verification: Verifies that the Next.js application builds successfully.
- Storybook Build: Builds Storybook and runs accessibility tests.
2. SonarQube Analysis (sonar.yml)β
- Runs tests with coverage accumulation.
- Scans code for bugs, vulnerabilities, and code smells.
- Sends reports to SonarQube server.
βΏ Accessibilityβ
- Storybook A11y Addon: Used to check accessibility compliance during component development.
- Linting:
eslint-plugin-jsx-a11yensures accessibility best practices in JSX.