
Configure Ux Testing
- 64 installs
- 49 repo stars
- Updated August 4, 2026
- laurigates/claude-plugins
Helps with testing & qa tasks.
About
configure-ux-testing is a Claude Code skill for testing & qa. It helps solo builders move faster with AI-assisted development.
- configure-ux-testing
- Testing & QA
- AI-coding skill
Configure Ux Testing by the numbers
- 64 all-time installs (skills.sh)
- Ranked #1,140 of 2,153 Testing & QA skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/laurigates/claude-plugins --skill configure-ux-testingAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 64 |
|---|---|
| repo stars | ★ 49 |
| Last updated | August 4, 2026 |
| Repository | laurigates/claude-plugins ↗ |
What it does
Helps with testing & qa tasks.
Files
/configure:ux-testing
Check and configure UX testing infrastructure with Playwright as the primary tool for E2E, accessibility, and visual regression testing.
When to Use This Skill
| Use this skill when... | Use another approach when... |
|---|---|
| Setting up Playwright E2E testing infrastructure for a project | Running existing Playwright tests (use bun test:e2e or test-runner agent) |
| Adding accessibility testing with axe-core to a project | Performing manual accessibility audits on a live site |
| Configuring visual regression testing with screenshot assertions | Debugging a specific failing E2E test (use system-debugging agent) |
| Setting up Playwright CLI or MCP for Claude browser automation | Writing individual test cases (use playwright-testing skill) |
| Creating CI/CD workflows for E2E and accessibility test execution | Configuring unit or integration tests (use /configure:tests) |
Context
- Package manager: !
find . -maxdepth 1 \( -name 'package.json' -o -name 'bun.lockb' \) - Playwright config: !
find . -maxdepth 1 -name 'playwright.config.*' - Playwright installed: !
find . -maxdepth 1 -name 'package.json' -exec grep -l '@playwright/test' {} + - Axe-core installed: !
find . -maxdepth 1 -name 'package.json' -exec grep -l '@axe-core/playwright' {} + - E2E test dir: !
find . -maxdepth 2 -type d \( -name 'e2e' -o -name 'tests' \) - Visual snapshots: !
find . -maxdepth 4 -type d -name '__snapshots__' - MCP config: !
find . -maxdepth 1 -name '.mcp.json' - CI workflow: !
find . -path '*/.github/workflows/*' -maxdepth 3 -name 'e2e*'
UX Testing Stack:
- Playwright - Cross-browser E2E testing (primary tool)
- axe-core - Automated accessibility testing (WCAG compliance)
- Playwright screenshots - Visual regression testing
- Playwright CLI - Browser automation via CLI (preferred for AI agents with shell access)
- Playwright MCP - Browser automation via MCP (fallback for sandboxed environments)
Parameters
Parse from command arguments:
--check-only: Report status without offering fixes--fix: Apply all fixes automatically without prompting--a11y: Focus on accessibility testing configuration--visual: Focus on visual regression testing configuration
Execution
Execute this UX testing configuration check:
Step 1: Fetch latest tool versions
Verify latest versions before configuring:
1. @playwright/test: Check playwright.dev or npm 2. @axe-core/playwright: Check npm 3. @playwright/cli: Check npm 4. playwright MCP: Check npm
Use WebSearch or WebFetch to verify current versions.
Step 2: Detect existing UX testing infrastructure
Run the detection script to scan the project for Playwright / axe-core signals (package.json deps + config globs), the e2e dir / __snapshots__ / e2e workflow, and the playwright MCP-server entry:
bash "${CLAUDE_SKILL_DIR}/scripts/configure-ux-testing.sh" --home-dir "$HOME" --project-dir "$(pwd)"Parse STATUS= and the ISSUES: block from the output. The KEY=VALUE lines report PLAYWRIGHT_CONFIG, PLAYWRIGHT_DEP, AXE_CORE_DEP, E2E_DIR, VISUAL_SNAPSHOTS, E2E_WORKFLOW, PLAYWRIGHT_MCP, and the rollup PLAYWRIGHT_DETECTED / UX_SIGNALS_PRESENT.
Step 3: Generate compliance report
Print a formatted compliance report showing status for Playwright core, accessibility testing, visual regression, and MCP integration.
If --check-only is set, stop here.
For the compliance report format, see REFERENCE.md.
Step 4: Install dependencies (if --fix or user confirms)
# Core Playwright
bun add --dev @playwright/test
# Accessibility testing
bun add --dev @axe-core/playwright
# Install browsers
bunx playwright installStep 5: Create Playwright configuration
Create playwright.config.ts with:
- Desktop browser projects (Chromium, Firefox, WebKit)
- Mobile viewport projects (Pixel 5, iPhone 13)
- Dedicated a11y test project (Chromium only)
- WebServer auto-start for local dev
- Trace/screenshot/video on failure settings
- JSON and JUnit reporters for CI
For the complete playwright.config.ts template, see REFERENCE.md.
Step 6: Create accessibility test helper
Create tests/e2e/helpers/a11y.ts with:
expectNoA11yViolations(page, options)- Assert no WCAG violationsgetA11yReport(page, options)- Generate detailed a11y report- Configurable WCAG level (wcag2a, wcag2aa, wcag21aa, wcag22aa)
- Rule include/exclude support
- Formatted violation output
For the complete a11y helper code, see REFERENCE.md.
Step 7: Create example test files
Create example tests:
1. `tests/e2e/homepage.a11y.spec.ts` - Homepage accessibility tests (WCAG 2.1 AA violations, post-interaction checks, full report) 2. `tests/e2e/visual.spec.ts` - Visual regression tests (full page screenshots, component screenshots, responsive layouts, dark mode)
For complete example test files, see REFERENCE.md.
Step 8: Add npm scripts
Update package.json with test scripts:
{
"scripts": {
"test:e2e": "playwright test",
"test:e2e:headed": "playwright test --headed",
"test:e2e:debug": "playwright test --debug",
"test:e2e:ui": "playwright test --ui",
"test:a11y": "playwright test --project=a11y",
"test:visual": "playwright test visual.spec.ts",
"test:visual:update": "playwright test visual.spec.ts --update-snapshots",
"playwright:codegen": "playwright codegen http://localhost:3000",
"playwright:report": "playwright show-report"
}
}Step 9: Configure browser automation (optional)
Choose the appropriate browser automation approach based on the agent's environment:
Option A: Playwright CLI (preferred when shell access is available)
Playwright CLI (@playwright/cli) is 4-10x more token-efficient than MCP for AI agent browser automation (~27K vs ~114K tokens per task). Snapshots and screenshots are saved to disk instead of injected into context.
# Global install
npm install -g @playwright/cli@latest
# Or project-local
bun add --dev @playwright/cliThis enables Claude to navigate pages, take screenshots, fill forms, click elements, and capture page snapshots via CLI commands. See the playwright-cli skill for command reference.
Option B: Playwright MCP (for sandboxed environments without shell access)
Use MCP when running in environments without shell access (Claude Desktop, browser-based agents):
{
"mcpServers": {
"playwright": {
"command": "bunx",
"args": ["-y", "@playwright/mcp@latest"]
}
}
}Step 10: Create CI/CD workflow
Create .github/workflows/e2e.yml with parallel jobs for:
- E2E tests (all browsers)
- Accessibility tests (Chromium only)
- Artifact upload for reports and failure screenshots
For the complete CI workflow template, see REFERENCE.md.
Step 11: Update standards tracking
Update .project-standards.yaml:
components:
ux_testing: "2025.1"
ux_testing_framework: "playwright"
ux_testing_a11y: true
ux_testing_a11y_level: "wcag21aa"
ux_testing_visual: true
ux_testing_cli: true
ux_testing_mcp: falseStep 12: Report configuration results
Print a summary of configuration applied, scripts added, and CI/CD setup. Include next steps for starting the dev server, running tests, updating snapshots, and opening the interactive UI.
For the results report format, see REFERENCE.md.
Agentic Optimizations
| Context | Command |
|---|---|
| Quick compliance check | /configure:ux-testing --check-only |
| Auto-fix all issues | /configure:ux-testing --fix |
| Accessibility focus only | /configure:ux-testing --a11y |
| Visual regression focus only | /configure:ux-testing --visual |
| Run E2E tests compact | bunx playwright test --reporter=line |
| Run a11y tests only | bunx playwright test --project=a11y --reporter=dot |
Flags
| Flag | Description |
|---|---|
--check-only | Report status without offering fixes |
--fix | Apply all fixes automatically without prompting |
--a11y | Focus on accessibility testing configuration |
--visual | Focus on visual regression testing configuration |
Error Handling
- No package manager found: Cannot install dependencies, provide manual steps
- Dev server not configured: Warn about manual baseURL configuration
- Browsers not installed: Prompt to run
bunx playwright install - Existing config conflicts: Preserve user config, suggest merge
See Also
/configure:tests- Unit and integration testing configuration/configure:all- Run all compliance checks- Skills:
playwright-testing,playwright-cli,accessibility-implementation - Agents:
ux-implementationfor implementing UX designs - Playwright documentation: https://playwright.dev
- axe-core documentation: https://www.deque.com/axe
configure-ux-testing Reference
Compliance Report Format
UX Testing Compliance Report
=============================
Project: [name]
Framework: Playwright
Playwright Core:
@playwright/test package.json [INSTALLED | MISSING]
playwright.config.ts configuration [EXISTS | MISSING]
Desktop browsers chromium, firefox, webkit [ALL | PARTIAL]
Mobile viewports iPhone, Pixel [CONFIGURED | OPTIONAL]
WebServer config auto-start dev server [CONFIGURED | MISSING]
Trace on failure debugging support [ENABLED | DISABLED]
Accessibility Testing:
@axe-core/playwright package.json [INSTALLED | MISSING]
a11y test files tests/a11y/ [FOUND | NONE]
WCAG level AA (recommended) [CONFIGURED | NOT SET]
Violations threshold 0 (strict) [STRICT | LENIENT]
Visual Regression:
Screenshot tests toHaveScreenshot() [FOUND | OPTIONAL]
Snapshot directory __snapshots__ [CONFIGURED | N/A]
CI handling GitHub Actions artifact [CONFIGURED | MISSING]
Browser Automation:
Playwright CLI global / package.json [INSTALLED | OPTIONAL]
Playwright MCP .mcp.json [CONFIGURED | OPTIONAL]
Overall: [X issues found]
Recommendations:
- Install @axe-core/playwright for accessibility testing
- Add mobile viewport configurations
- Configure visual regression workflowPlaywright Configuration Template (playwright.config.ts)
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
testDir: './tests/e2e',
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
reporter: [
['html', { open: 'never' }],
['json', { outputFile: 'test-results/results.json' }],
['junit', { outputFile: 'test-results/junit.xml' }],
],
timeout: 30000,
expect: {
timeout: 5000,
toHaveScreenshot: {
maxDiffPixels: 100,
threshold: 0.2,
},
},
use: {
baseURL: process.env.BASE_URL || 'http://localhost:3000',
trace: 'on-first-retry',
screenshot: 'only-on-failure',
video: 'retain-on-failure',
actionTimeout: 10000,
navigationTimeout: 30000,
},
projects: [
// Desktop browsers
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
},
{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
},
// Mobile viewports
{
name: 'mobile-chrome',
use: { ...devices['Pixel 5'] },
},
{
name: 'mobile-safari',
use: { ...devices['iPhone 13'] },
},
// Accessibility tests (single browser)
{
name: 'a11y',
testMatch: /.*\.a11y\.spec\.ts/,
use: { ...devices['Desktop Chrome'] },
},
],
webServer: {
command: 'bun run dev',
url: 'http://localhost:3000',
reuseExistingServer: !process.env.CI,
timeout: 120000,
},
});Accessibility Test Helper (tests/e2e/helpers/a11y.ts)
import { Page, expect } from '@playwright/test';
import AxeBuilder from '@axe-core/playwright';
export interface A11yOptions {
/** WCAG conformance level: 'wcag2a', 'wcag2aa', 'wcag21aa', 'wcag22aa' */
level?: 'wcag2a' | 'wcag2aa' | 'wcag21aa' | 'wcag22aa';
/** Specific rules to include */
includeRules?: string[];
/** Specific rules to exclude */
excludeRules?: string[];
/** Selectors to exclude from analysis */
excludeSelectors?: string[];
}
/**
* Run accessibility scan on page and assert no violations
*/
export async function expectNoA11yViolations(
page: Page,
options: A11yOptions = {}
): Promise<void> {
const {
level = 'wcag21aa',
includeRules = [],
excludeRules = [],
excludeSelectors = [],
} = options;
let builder = new AxeBuilder({ page })
.withTags([level, 'best-practice']);
if (includeRules.length > 0) {
builder = builder.include(includeRules);
}
if (excludeRules.length > 0) {
builder = builder.disableRules(excludeRules);
}
if (excludeSelectors.length > 0) {
for (const selector of excludeSelectors) {
builder = builder.exclude(selector);
}
}
const results = await builder.analyze();
// Format violations for readable output
const violationSummary = results.violations.map((v) => ({
rule: v.id,
impact: v.impact,
description: v.description,
nodes: v.nodes.length,
elements: v.nodes.map((n) => n.html).slice(0, 3),
}));
expect(
results.violations,
`Found ${results.violations.length} accessibility violation(s):\n${JSON.stringify(violationSummary, null, 2)}`
).toHaveLength(0);
}
/**
* Run accessibility scan and return detailed report
*/
export async function getA11yReport(
page: Page,
options: A11yOptions = {}
): Promise<{
violations: number;
passes: number;
incomplete: number;
details: unknown;
}> {
const { level = 'wcag21aa' } = options;
const results = await new AxeBuilder({ page })
.withTags([level, 'best-practice'])
.analyze();
return {
violations: results.violations.length,
passes: results.passes.length,
incomplete: results.incomplete.length,
details: results,
};
}Example Accessibility Test (tests/e2e/homepage.a11y.spec.ts)
import { test, expect } from '@playwright/test';
import { expectNoA11yViolations, getA11yReport } from './helpers/a11y';
test.describe('Homepage Accessibility', () => {
test.beforeEach(async ({ page }) => {
await page.goto('/');
});
test('should have no WCAG 2.1 AA violations', async ({ page }) => {
await expectNoA11yViolations(page, {
level: 'wcag21aa',
});
});
test('should have no violations after interaction', async ({ page }) => {
// Interact with page elements
await page.getByRole('button', { name: /menu/i }).click();
// Check accessibility after state change
await expectNoA11yViolations(page);
});
test('should generate full accessibility report', async ({ page }) => {
const report = await getA11yReport(page);
console.log(`Accessibility Report:
- Violations: ${report.violations}
- Passes: ${report.passes}
- Incomplete: ${report.incomplete}
`);
expect(report.violations).toBe(0);
});
});
test.describe('Form Accessibility', () => {
test('login form should be accessible', async ({ page }) => {
await page.goto('/login');
// Check form has proper labels
await expect(page.getByLabel('Email')).toBeVisible();
await expect(page.getByLabel('Password')).toBeVisible();
// Check submit button is accessible
await expect(page.getByRole('button', { name: /sign in/i })).toBeEnabled();
// Run full a11y scan
await expectNoA11yViolations(page);
});
});Example Visual Regression Test (tests/e2e/visual.spec.ts)
import { test, expect } from '@playwright/test';
test.describe('Visual Regression', () => {
test('homepage matches snapshot', async ({ page }) => {
await page.goto('/');
// Wait for dynamic content to load
await page.waitForLoadState('networkidle');
// Full page screenshot
await expect(page).toHaveScreenshot('homepage.png', {
fullPage: true,
});
});
test('header matches snapshot', async ({ page }) => {
await page.goto('/');
// Component screenshot
const header = page.locator('header');
await expect(header).toHaveScreenshot('header.png');
});
test('responsive layouts match snapshots', async ({ page }) => {
await page.goto('/');
// Desktop
await page.setViewportSize({ width: 1920, height: 1080 });
await expect(page).toHaveScreenshot('homepage-desktop.png');
// Tablet
await page.setViewportSize({ width: 768, height: 1024 });
await expect(page).toHaveScreenshot('homepage-tablet.png');
// Mobile
await page.setViewportSize({ width: 375, height: 667 });
await expect(page).toHaveScreenshot('homepage-mobile.png');
});
test('dark mode matches snapshot', async ({ page }) => {
await page.goto('/');
// Enable dark mode (adjust selector for your app)
await page.emulateMedia({ colorScheme: 'dark' });
await expect(page).toHaveScreenshot('homepage-dark.png', {
fullPage: true,
});
});
});CI/CD Workflow Template (.github/workflows/e2e.yml)
name: E2E Tests
on:
push:
branches: [main]
pull_request:
jobs:
e2e:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Install Playwright Browsers
run: bunx playwright install --with-deps
- name: Run E2E tests
run: bunx playwright test
- name: Upload test results
uses: actions/upload-artifact@v7
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
- name: Upload screenshots
uses: actions/upload-artifact@v7
if: failure()
with:
name: test-screenshots
path: test-results/
retention-days: 7
a11y:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Install Playwright Browsers
run: bunx playwright install chromium --with-deps
- name: Run accessibility tests
run: bunx playwright test --project=a11y
- name: Upload a11y report
uses: actions/upload-artifact@v7
if: always()
with:
name: a11y-report
path: playwright-report/
retention-days: 30Results Report Format
UX Testing Configuration Complete
===================================
Framework: Playwright
Accessibility: axe-core (WCAG 2.1 AA)
Visual: Screenshot comparisons
Configuration Applied:
@playwright/test installed
@axe-core/playwright installed
playwright.config.ts created
Desktop and mobile projects configured
WebServer auto-start configured
Accessibility Testing:
a11y helper functions created
Example accessibility tests added
WCAG 2.1 AA level configured
Visual Regression:
Screenshot test examples created
Responsive breakpoint tests included
Dark mode test included
Scripts Added:
bun run test:e2e (run all E2E tests)
bun run test:a11y (accessibility only)
bun run test:visual (visual regression)
bun run test:visual:update (update snapshots)
CI/CD:
GitHub Actions workflow created
Parallel E2E and a11y jobs
Artifact upload for reports
Next Steps:
1. Start dev server:
bun run dev
2. Run E2E tests:
bun run test:e2e
3. Run accessibility scan:
bun run test:a11y
4. Update visual snapshots:
bun run test:visual:update
5. Open interactive UI:
bun run test:e2e:ui
Documentation:
- Playwright: https://playwright.dev
- axe-core: https://www.deque.com/axe
- Skill: playwright-testing, accessibility-implementation#!/usr/bin/env bash
# Detect UX-testing posture for a project.
# Scans --project-dir for Playwright / axe-core signals (package.json deps +
# config globs), e2e/__snapshots__/e2e-workflow presence, and the playwright
# MCP-server entry in .mcp.json. Generative config-writing stays with the model.
# Usage: bash configure-ux-testing.sh --home-dir <path> --project-dir <path>
#
# Offline seam: the MCP lookup reads ${MCP_CONFIG_PATH:-<project>/.mcp.json}.
# Tests point MCP_CONFIG_PATH at a planted fixture so the check stays offline.
set -uo pipefail
home_dir=""
project_dir=""
while [ $# -gt 0 ]; do
case "$1" in
--home-dir) home_dir="$2"; shift 2 ;;
--project-dir) project_dir="$2"; shift 2 ;;
*) shift ;;
esac
done
: "${home_dir:=$HOME}"
: "${project_dir:=$(pwd)}"
echo "=== CONFIGURE UX TESTING ==="
ux_issue_count=0
ux_status="OK"
ux_issues_list=""
add_issue() {
ux_issues_list="${ux_issues_list} - SEVERITY=$1 TYPE=$2 MSG=$3\n"
ux_issue_count=$((ux_issue_count + 1))
if [ "$1" = "ERROR" ]; then
ux_status="ERROR"
elif [ "$1" = "WARN" ] && [ "$ux_status" = "OK" ]; then
ux_status="WARN"
fi
}
exists_file() { [ -f "$1" ] && echo "true" || echo "false"; }
if ! command -v jq >/dev/null 2>&1; then
echo "JQ_AVAILABLE=false"
echo "STATUS=ERROR"
echo "ISSUE_COUNT=1"
echo "ISSUES:"
echo " - SEVERITY=ERROR TYPE=missing_tool MSG=jq is required but not installed"
echo "=== END CONFIGURE UX TESTING ==="
exit 1
fi
echo "JQ_AVAILABLE=true"
# -----------------------------------------------------------------------------
# Package manager
# -----------------------------------------------------------------------------
pkg_json=$(exists_file "${project_dir}/package.json")
echo "PACKAGE_JSON=${pkg_json}"
[ -f "${project_dir}/bun.lockb" ] && echo "BUN_LOCKFILE=true" || echo "BUN_LOCKFILE=false"
# -----------------------------------------------------------------------------
# Playwright config glob
# -----------------------------------------------------------------------------
playwright_config=false
for f in "${project_dir}"/playwright.config.*; do
[ -f "$f" ] && { playwright_config=true; break; }
done
echo "PLAYWRIGHT_CONFIG=${playwright_config}"
# -----------------------------------------------------------------------------
# Playwright / axe-core deps in package.json (jq lookup, tolerant of missing)
# -----------------------------------------------------------------------------
dep_present() {
# $1 = dependency name; checks dependencies + devDependencies
local dep="$1"
if [ "$pkg_json" != "true" ]; then
echo "false"
return
fi
if jq -e --arg d "$dep" \
'((.dependencies // {}) + (.devDependencies // {})) | has($d)' \
"${project_dir}/package.json" >/dev/null 2>&1; then
echo "true"
else
echo "false"
fi
}
playwright_dep=$(dep_present "@playwright/test")
axe_dep=$(dep_present "@axe-core/playwright")
echo "PLAYWRIGHT_DEP=${playwright_dep}"
echo "AXE_CORE_DEP=${axe_dep}"
# -----------------------------------------------------------------------------
# e2e directory + __snapshots__ + e2e workflow detection
# -----------------------------------------------------------------------------
e2e_dir=false
for d in "${project_dir}/e2e" "${project_dir}/tests/e2e"; do
[ -d "$d" ] && { e2e_dir=true; break; }
done
echo "E2E_DIR=${e2e_dir}"
snapshots=false
# __snapshots__ can live a few levels deep under tests/
while IFS= read -r snap; do
[ -n "$snap" ] && { snapshots=true; break; }
done < <(find "$project_dir" -maxdepth 5 -type d -name '__snapshots__' 2>/dev/null)
echo "VISUAL_SNAPSHOTS=${snapshots}"
e2e_workflow=false
workflows_dir="${project_dir}/.github/workflows"
if [ -d "$workflows_dir" ]; then
for wf in "$workflows_dir"/e2e*.yml "$workflows_dir"/e2e*.yaml; do
[ -f "$wf" ] && { e2e_workflow=true; break; }
done
fi
echo "E2E_WORKFLOW=${e2e_workflow}"
# -----------------------------------------------------------------------------
# Playwright MCP-server lookup (offline seam via MCP_CONFIG_PATH)
# -----------------------------------------------------------------------------
mcp_config_path="${MCP_CONFIG_PATH:-${project_dir}/.mcp.json}"
playwright_mcp=false
if [ -f "$mcp_config_path" ]; then
if jq -e '.mcpServers.playwright // empty' "$mcp_config_path" >/dev/null 2>&1; then
playwright_mcp=true
fi
fi
echo "PLAYWRIGHT_MCP=${playwright_mcp}"
# -----------------------------------------------------------------------------
# Presence-matrix rollup
# -----------------------------------------------------------------------------
ux_present=0
[ "$playwright_config" = "true" ] && ux_present=$((ux_present + 1))
[ "$playwright_dep" = "true" ] && ux_present=$((ux_present + 1))
[ "$axe_dep" = "true" ] && ux_present=$((ux_present + 1))
[ "$e2e_dir" = "true" ] && ux_present=$((ux_present + 1))
echo "UX_SIGNALS_PRESENT=${ux_present}"
playwright_detected=false
if [ "$playwright_config" = "true" ] || [ "$playwright_dep" = "true" ]; then
playwright_detected=true
fi
echo "PLAYWRIGHT_DETECTED=${playwright_detected}"
[ "$playwright_detected" = "false" ] && add_issue "WARN" "no_playwright" "no Playwright config or @playwright/test dependency detected"
[ "$axe_dep" = "false" ] && add_issue "WARN" "no_a11y" "no @axe-core/playwright dependency — accessibility testing not configured"
echo "STATUS=${ux_status}"
echo "ISSUE_COUNT=${ux_issue_count}"
if [ -n "$ux_issues_list" ]; then
echo "ISSUES:"
echo -e "$ux_issues_list" | sed '/^$/d'
fi
echo "=== END CONFIGURE UX TESTING ==="
[ "$ux_status" = "ERROR" ] && exit 1
exit 0
#!/usr/bin/env bash
# Regression test for configure-ux-testing.sh detection.
# A planted fixture with a playwright config + e2e dir (+ axe dep + playwright
# MCP via the offline seam) must be detected; a bare fixture must not.
# SKIP (exit 0) if jq is absent.
# Exit 0 on success, non-zero on failure.
set -uo pipefail
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
check_script="${script_dir}/../configure-ux-testing.sh"
fail() { echo "FAIL: $1" >&2; exit 1; }
pass() { echo "PASS: $1"; }
if ! command -v jq >/dev/null 2>&1; then
echo "SKIP: jq not installed; cannot run configure-ux-testing tests"
exit 0
fi
[ -f "$check_script" ] || fail "configure-ux-testing.sh not found at $check_script"
# -----------------------------------------------------------------------------
# Case 1: configured project → playwright detected, e2e dir present, MCP present
# -----------------------------------------------------------------------------
full="$(mktemp -d)"
trap 'rm -rf "$full"' EXIT
mkdir -p "${full}/tests/e2e/__snapshots__" "${full}/.github/workflows"
cat > "${full}/package.json" <<'JSON'
{
"devDependencies": {
"@playwright/test": "^1.40.0",
"@axe-core/playwright": "^4.8.0"
}
}
JSON
printf 'export default {};\n' > "${full}/playwright.config.ts"
printf 'name: e2e\n' > "${full}/.github/workflows/e2e.yml"
cat > "${full}/.mcp.json" <<'JSON'
{ "mcpServers": { "playwright": { "command": "bunx", "args": ["-y", "@playwright/mcp@latest"] } } }
JSON
out1="$(MCP_CONFIG_PATH="${full}/.mcp.json" bash "$check_script" --home-dir "$HOME" --project-dir "$full")"
echo "$out1" | grep -q "^PLAYWRIGHT_CONFIG=true$" || fail "expected PLAYWRIGHT_CONFIG=true:\n$out1"
echo "$out1" | grep -q "^PLAYWRIGHT_DEP=true$" || fail "expected PLAYWRIGHT_DEP=true:\n$out1"
echo "$out1" | grep -q "^AXE_CORE_DEP=true$" || fail "expected AXE_CORE_DEP=true:\n$out1"
echo "$out1" | grep -q "^E2E_DIR=true$" || fail "expected E2E_DIR=true:\n$out1"
echo "$out1" | grep -q "^VISUAL_SNAPSHOTS=true$" || fail "expected VISUAL_SNAPSHOTS=true:\n$out1"
echo "$out1" | grep -q "^E2E_WORKFLOW=true$" || fail "expected E2E_WORKFLOW=true:\n$out1"
echo "$out1" | grep -q "^PLAYWRIGHT_MCP=true$" || fail "expected PLAYWRIGHT_MCP=true:\n$out1"
echo "$out1" | grep -q "^PLAYWRIGHT_DETECTED=true$" || fail "expected PLAYWRIGHT_DETECTED=true:\n$out1"
echo "$out1" | grep -q "^STATUS=OK$" || fail "expected STATUS=OK for configured project:\n$out1"
pass "configured project detects playwright config, deps, e2e dir, snapshots, workflow, and MCP"
rm -rf "$full"
# -----------------------------------------------------------------------------
# Case 2: bare project → nothing detected, STATUS=WARN
# -----------------------------------------------------------------------------
bare="$(mktemp -d)"
out2="$(MCP_CONFIG_PATH="${bare}/.mcp.json" bash "$check_script" --home-dir "$HOME" --project-dir "$bare")"
echo "$out2" | grep -q "^PLAYWRIGHT_CONFIG=false$" || fail "expected PLAYWRIGHT_CONFIG=false:\n$out2"
echo "$out2" | grep -q "^PLAYWRIGHT_DEP=false$" || fail "expected PLAYWRIGHT_DEP=false:\n$out2"
echo "$out2" | grep -q "^E2E_DIR=false$" || fail "expected E2E_DIR=false:\n$out2"
echo "$out2" | grep -q "^PLAYWRIGHT_MCP=false$" || fail "expected PLAYWRIGHT_MCP=false:\n$out2"
echo "$out2" | grep -q "^PLAYWRIGHT_DETECTED=false$" || fail "expected PLAYWRIGHT_DETECTED=false:\n$out2"
echo "$out2" | grep -q "^STATUS=WARN$" || fail "expected STATUS=WARN for bare project:\n$out2"
pass "bare project detects no UX testing infrastructure and reports STATUS=WARN"
rm -rf "$bare"
echo "ALL TESTS PASSED"