Testing Strategy Advisor
Description
Advises on appropriate testing approaches, recommends testing levels, and ensures comprehensive test coverage for business logic and edge cases.
Trigger
Activated when users mention testing, validation, or quality assurance needs.
Comprehensive Validation Pipeline
When implementing code changes, follow this validation sequence:
- Build Validation:
npm run build- Ensure TypeScript compilation succeeds - Lint Validation:
npm run lint- Check code quality and style compliance - Unit Test Validation:
npm run test:unit- Verify business logic integrity - E2E Test Validation:
npm run test:e2e- Confirm end-to-end functionality - Documentation Update: Update relevant TASKS files and READMEs
Test File Convention Investigation:
- Use
git logto identify when violations were introduced - Use
greppatterns to find violations across multiple files - Audit HTML files for inline attributes vs programmatic setup
- Validate that seedData.ts contains required test data
Refactoring Safety:
- Changes affecting only code organization (not functionality) can skip extensive manual testing
- Always run full test suite to catch unexpected side effects
- Update task documentation to reflect completed work
Test File Convention Enforcement
Ensure test files follow web-components-assistant guidelines:
- HTML Files: Must NOT contain inline attributes on web components
- TypeScript Files: Handle all data and configuration programmatically
- Data Sources: Use seedData.ts for consistent test data
- Strong Typing: Unit tests should NOT cast components to
any, but instead rely on proper TypeScript interfaces and component APIs - Validation: Run build + lint + tests after refactoring
Pattern: HTML defines structure, TypeScript sets properties via setAttribute() or direct assignment.
Test File Design Constraints:
- test.html: Contains declarative HTML structure only. Imports from
/app.jsand calls aliased playground functions. No inline JavaScript for component setup. - test.ts: Acts as component controller. Does NOT inject HTML markup. All DOM manipulation is programmatic using component APIs. Follows web component patterns where HTML is declarative and TypeScript handles behavior.
Response Pattern
- Suggest appropriate testing level (unit/integration/E2E) based on the feature
- Reference Vitest for unit tests, Playwright for E2E tests
- Provide testing patterns used in the existing codebase
- Ensure test coverage for business logic and edge cases
- Recommend manual testing steps for UI features
- Include build and lint validation as part of testing strategy
Testing Insights
E2E Testing for Component Integration
- Component Behavior Testing: E2E tests excel at validating component integration and user workflows
- Calendar Interaction Testing: Use Playwright locators to test calendar day selection and tooltip behavior
- Data Rendering Validation: Test that components properly render fetched data in calendar views
- Build Validation: Always run
npm run build && npm run lintbefore E2E tests to catch compilation issues
Test Coverage Strategy
- Unit Tests: Business logic, validation functions, utility methods
- E2E Tests: Component integration, user workflows, data rendering
- Build Tests: TypeScript compilation, linting, bundle generation
Examples
- "How should I test this PTO calculation function?"
- "What tests do I need for this API endpoint?"
- "How do I test the admin panel functionality?"
Additional Context
This skill promotes the project's testing standards using Vitest for unit tests and Playwright for E2E tests, ensuring comprehensive coverage of business logic.