Using the Athena Testing Framework with Claude Code
| Command | Description |
|---|---|
npm run test |
Run all tests (headless) |
npm run test:headed |
Run tests with visible browser |
npm run test:ui |
Run with Playwright interactive UI |
npm run test:smoke |
Run smoke tests only |
/test |
Invoke Athena skill in Claude Code |
~/.claude/commands/test.md # Claude Code skill (reusable)
│
▼
/mnt/x/Personal/Athena/ # Athena framework source
├── final-testing-skill/
│ ├── tools/scan-project.js # Project scanner
│ ├── utilities/ # Test utility library
│ └── SKILL.md # Methodology guide
│
▼
/mnt/x/Personal/Project/FT/ # FieldPro project
├── playwright.config.ts # Playwright configuration
├── tests/
│ ├── smoke.spec.ts # Smoke tests (8 tests)
│ ├── PROJECT-TEST-PROFILE.md # What to test in FT
│ ├── TEST-HISTORY.md # Test session log
│ ├── KNOWN-ISSUES.md # Bug tracking
│ └── utilities/ # Copied test utilities
│ ├── core/ # Error capture, smoke tests
│ ├── auth/ # Login, role testing
│ ├── security/ # XSS, auth bypass
│ ├── performance/ # Core Web Vitals
│ └── accessibility/ # WCAG audit
npm run dev# Headless (CI mode)
npm run test
# With visible browser (recommended for debugging)
npm run test:headed
# Interactive UI (best for development)
npm run test:ui- Terminal: Pass/fail summary
- HTML Report:
playwright-report/index.html(auto-generated) - Screenshots: Captured on failure in
test-results/
Configured in .env.local:
| Role | Purpose | |
|---|---|---|
| Admin | dev@test.com |
Full access testing |
| Supervisor | super1234@gmail.com |
Supervisor workflows |
| Technician | tech1@example.com |
Technician workflows |
| Accountant | accountant1@example.com |
Invoice/financial testing |
| Test | Description |
|---|---|
| Login page loads | Verifies /login renders without errors |
| Form elements present | Checks email, password, submit button exist |
| Protected routes redirect | Verifies unauthenticated users go to login |
| Invalid credentials error | Checks error handling for bad login |
| Mobile viewport | Tests responsive design at 375px width |
| Valid login | Tests successful authentication (needs credentials) |
| Dashboard loads | Verifies post-login navigation |
| Health check | Quick smoke test on public pages |
Before testing, understand what exists:
# Run the scanner
node /mnt/x/Personal/Athena/final-testing-skill/tools/scan-project.js
# Or read the existing profile
cat tests/PROJECT-TEST-PROFILE.mdBased on assessment, select relevant tests:
- ✅ Always run: smoke, security, performance, accessibility
- ✅ If auth exists: auth tests
- ❌ Skip if not applicable: payments, i18n, PWA
Run the appropriate tests:
npm run test:headedAfter testing, update:
tests/TEST-HISTORY.md- Log what was testedtests/KNOWN-ISSUES.md- Track any bugs found
From any project, invoke /test:
/test → Full assessment + smoke tests
/test scan → Run project scanner only
/test smoke → Run smoke tests
/test auth → Run authentication tests
/test security → Run security audit
The skill guides you through the Athena methodology.
import { ErrorCapture, smokeTest, wait } from './utilities/core';
// Capture console errors during test
const errors = new ErrorCapture(page);
errors.assertNoErrors();
// Quick smoke test multiple pages
const results = await smokeTest(page, ['/login', '/']);
// Wait helpers
await wait.forNetworkIdle(page);
await wait.forElement(page, '#submit');import { login, testProtectedRoute, testRoleAccess } from './utilities/auth';
// Login helper
await login(page, email, password);
// Test protected route redirects
await testProtectedRoute(page, '/dashboard');
// Test role-based access
const results = await testRoleAccess(page, routes, 'ADMIN');import { testAuthBypass, testXSS, checkSensitiveDataExposure } from './utilities/security';
// Check if protected URLs can be accessed without auth
const bypasses = await testAuthBypass(page, ['/dashboard', '/jobs']);
// Test for XSS vulnerabilities
const xss = await testXSS(page, 'input[name="search"]', 'button[type="submit"]');
// Check for exposed sensitive data
const exposure = await checkSensitiveDataExposure(page);import { measureCoreWebVitals, assertPerformanceBudgets } from './utilities/performance';
// Measure Core Web Vitals
const vitals = await measureCoreWebVitals(page);
// Check against budgets
const check = assertPerformanceBudgets(metrics);import { runAxeAudit, testKeyboardNavigation } from './utilities/accessibility';
// Run WCAG audit
const audit = await runAxeAudit(page);
// Test keyboard navigation
const keyboard = await testKeyboardNavigation(page);- Create a new
.spec.tsfile intests/ - Import utilities as needed
- Follow the pattern:
import { test, expect } from '@playwright/test';
import { ErrorCapture } from './utilities/core';
test.describe('Feature Name', () => {
test('should do something', async ({ page }) => {
const errors = new ErrorCapture(page);
await page.goto('/your-page');
// Your assertions
await expect(page.locator('h1')).toBeVisible();
errors.assertNoErrors();
});
});# Ensure Playwright browsers are installed
npx playwright install chromium# Start manually first
npm run dev
# Then run tests
npm run test:headed- Check
.env.localhas test credentials filled in - Ensure test accounts exist in Supabase
- Increase timeout in
playwright.config.ts - Check if Supabase is accessible
| File | Purpose |
|---|---|
playwright.config.ts |
Playwright configuration |
tests/smoke.spec.ts |
Smoke test suite |
tests/PROJECT-TEST-PROFILE.md |
What to test in FT |
tests/TEST-HISTORY.md |
Test session log |
tests/KNOWN-ISSUES.md |
Bug tracking |
tests/utilities/ |
Test helper functions |
.env.local |
Test account credentials |