---
Comprehensive frontend testing workflow that sets up testing infrastructure, generates component/visual/a11y/performance tests, runs all tests, and analyzes coverage. Use when you need to establish or run complete frontend testing for a project.
/plugin marketplace add vanman2024/dev-lifecycle-marketplace/plugin install testing@dev-lifecycle-marketplace๐จ EXECUTION NOTICE FOR CLAUDE
When you invoke this command via SlashCommand, the system returns THESE INSTRUCTIONS below.
YOU are the executor. This is NOT an autonomous subprocess.
Immediately after SlashCommand returns, start executing Phase 0, then Phase 1, etc.
See @CLAUDE.md section "SlashCommand Execution - YOU Are The Executor" for detailed explanation.
Arguments: $ARGUMENTS
Goal: Run comprehensive frontend testing workflow with support for setup, execution, and validation phases.
Actions:
Store as variables:
Goal: Detect project setup and existing tests
Actions:
cd $PROJECT_PATHif grep -q '"jest"' package.json; then
TEST_FRAMEWORK="jest"
elif grep -q '"vitest"' package.json; then
TEST_FRAMEWORK="vitest"
else
TEST_FRAMEWORK="none"
fi
COMPONENT_TESTS=$(find . -name "*.spec.tsx" -o -name "*.test.tsx" | wc -l)
VISUAL_TESTS=$(find tests/visual -name "*.spec.ts" 2>/dev/null | wc -l)
A11Y_TESTS=$(find tests/a11y -name "*.spec.ts" 2>/dev/null | wc -l)
PERF_TESTS=$(find tests/performance -name "*.spec.ts" 2>/dev/null | wc -l)
Display discovery results:
๐ Frontend Test Discovery
Project: $PROJECT_PATH
Framework: $TEST_FRAMEWORK
Existing Tests:
- Component: $COMPONENT_TESTS
- Visual: $VISUAL_TESTS
- Accessibility: $A11Y_TESTS
- Performance: $PERF_TESTS
Skip if: $PHASE is "test" or "validate"
Goal: Initialize frontend testing infrastructure
Actions:
If TEST_FRAMEWORK is "none" or test infrastructure is incomplete:
bash ~/.claude/plugins/marketplaces/dev-lifecycle-marketplace/plugins/testing/skills/frontend-testing/scripts/init-frontend-tests.sh $PROJECT_PATH
Verify setup completed successfully:
test -f jest.config.js || test -f vitest.config.ts
test -f playwright.visual.config.ts
test -f playwright.a11y.config.ts
Display setup results:
โ
Frontend Testing Infrastructure Initialized
- Testing framework: $TEST_FRAMEWORK
- React Testing Library: installed
- Playwright: installed
- Configuration files: created
- Test utilities: created
Exit if: $PHASE is "setup"
Skip if: $PHASE is "validate"
Goal: Generate missing tests using frontend-test-generator agent
Actions:
Identify components and pages without tests:
# Find all React components
find src -name "*.tsx" -o -name "*.jsx" | grep -v ".test." | grep -v ".spec."
# Check which lack tests
for component in $COMPONENTS; do
test_file="${component%.tsx}.spec.tsx"
if [ ! -f "$test_file" ]; then
echo "Missing test: $component"
fi
done
Invoke frontend-test-generator agent to create tests:
Launch the frontend-test-generator agent to generate comprehensive test suites.
Provide the agent with:
Use Task tool to invoke agent:
Task(
description="Generate frontend tests",
subagent_type="testing:frontend-test-generator",
prompt="Generate comprehensive frontend test suites for project at $PROJECT_PATH.
Test types: component, visual, accessibility, performance
Coverage target: 80%
Review existing components and pages, identify untested areas, and generate:
1. Component tests (Jest/Vitest + RTL) for all components
2. Visual regression tests (Playwright) for all pages
3. Accessibility tests (axe-core) for interactive components
4. Performance tests (Lighthouse) for critical pages
Use templates from Skill(testing:frontend-testing).
Return JSON summary with tests_generated counts and files_created list."
)
Wait for agent to complete and parse JSON response.
Display generation results:
๐จ Frontend Tests Generated
Component tests: $COMPONENT_COUNT
Visual tests: $VISUAL_COUNT
Accessibility tests: $A11Y_COUNT
Performance tests: $PERF_COUNT
Files created: $FILE_COUNT total
Skip if: $PHASE is "setup" or "validate"
Goal: Run all frontend tests
Actions:
Run component tests:
bash ~/.claude/plugins/marketplaces/dev-lifecycle-marketplace/plugins/testing/skills/frontend-testing/scripts/run-component-tests.sh
Run visual regression tests:
bash ~/.claude/plugins/marketplaces/dev-lifecycle-marketplace/plugins/testing/skills/frontend-testing/scripts/run-visual-regression.sh
Run accessibility tests:
bash ~/.claude/plugins/marketplaces/dev-lifecycle-marketplace/plugins/testing/skills/frontend-testing/scripts/run-accessibility-tests.sh
Run performance tests:
bash ~/.claude/plugins/marketplaces/dev-lifecycle-marketplace/plugins/testing/skills/frontend-testing/scripts/run-performance-tests.sh http://localhost:3000
Aggregate results:
TOTAL_TESTS=$((COMPONENT_PASSED + VISUAL_PASSED + A11Y_PASSED + PERF_PASSED))
TOTAL_FAILED=$((COMPONENT_FAILED + VISUAL_FAILED + A11Y_FAILED + PERF_FAILED))
Display execution results:
๐งช Frontend Test Execution Complete
Component Tests:
โ
Passed: $COMPONENT_PASSED
โ Failed: $COMPONENT_FAILED
Visual Regression:
โ
Passed: $VISUAL_PASSED
โ Failed: $VISUAL_FAILED
Accessibility:
โ
Passed: $A11Y_PASSED
โ Failed: $A11Y_FAILED
Performance:
โ
Passed: $PERF_PASSED
โ Failed: $PERF_FAILED
Overall: $TOTAL_TESTS passed, $TOTAL_FAILED failed
Exit if: $PHASE is "test"
Goal: Analyze test coverage and quality
Actions:
Generate comprehensive coverage report:
bash ~/.claude/plugins/marketplaces/dev-lifecycle-marketplace/plugins/testing/skills/frontend-testing/scripts/generate-coverage-report.sh test-results/coverage
Read coverage summary:
cat test-results/coverage/summary.md
Identify gaps:
Check coverage thresholds:
Display validation results:
๐ Coverage Analysis
Component Coverage: $COVERAGE_PERCENT% (target: 80%)
Visual Coverage: $VISUAL_PAGES/$TOTAL_PAGES pages tested
Accessibility Coverage: $A11Y_COMPONENTS/$INTERACTIVE_COMPONENTS components tested
Performance Coverage: $PERF_PAGES/$CRITICAL_PAGES pages tested
Gaps Identified:
- Untested components: [list]
- Pages needing visual tests: [list]
- Components needing a11y tests: [list]
- Pages needing performance tests: [list]
Actions:
Display comprehensive summary:
โ
Frontend Testing Workflow Complete
Phase Results:
โ
Setup: Infrastructure initialized
โ
Generation: $TESTS_GENERATED tests created
โ
Execution: $TOTAL_TESTS tests run
โ
Validation: Coverage analyzed
Test Results:
Component: $COMPONENT_PASSED/$COMPONENT_TOTAL passed
Visual: $VISUAL_PASSED/$VISUAL_TOTAL passed
Accessibility: $A11Y_PASSED/$A11Y_TOTAL passed
Performance: $PERF_PASSED/$PERF_TOTAL passed
Coverage:
Component: $COVERAGE_PERCENT%
Visual: $VISUAL_PAGES pages
Accessibility: $A11Y_COMPONENTS components
Performance: $PERF_PAGES pages
Reports Generated:
๐ test-results/component/index.html
๐ test-results/visual/
๐ test-results/a11y/
๐ test-results/performance/
๐ test-results/coverage/summary.md
Provide next steps based on results:
Suggest follow-up commands:
Next steps:
1. Review reports: open test-results/coverage/summary.md
2. Fix failures: npm test -- --watch
3. Update snapshots: npm run test:visual -- --update-snapshots
4. Commit tests: git add tests/ && git commit -m "test: Add frontend tests"
Exit status: