configure-ux-testing
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese/configure:ux-testing
/configure:UX测试
Check and configure UX testing infrastructure with Playwright as the primary tool for E2E, accessibility, and visual regression testing.
检查并配置UX测试基础设施,以Playwright作为端到端(E2E)、无障碍测试和视觉回归测试的核心工具。
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 |
| 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 MCP server 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 |
| 使用该技能的场景... | 使用其他方法的场景... |
|---|---|
| 为项目搭建Playwright E2E测试基础设施 | 运行已有的Playwright测试(使用 |
| 为项目添加基于axe-core的无障碍测试 | 在实时网站上执行手动无障碍审计 |
| 配置基于截图断言的视觉回归测试 | 调试特定失败的E2E测试(使用系统调试Agent) |
| 为Claude浏览器自动化搭建Playwright MCP服务器 | 编写单个测试用例(使用playwright-testing技能) |
| 为E2E和无障碍测试执行创建CI/CD工作流 | 配置单元测试或集成测试(使用 |
Context
上下文
- Package manager: !
find . -maxdepth 1 \( -name 'package.json' -o -name 'bun.lockb' \) 2>/dev/null - Playwright config: !
find . -maxdepth 1 -name 'playwright.config.*' 2>/dev/null - Playwright installed: !
grep -l '@playwright/test' package.json 2>/dev/null - Axe-core installed: !
grep -l '@axe-core/playwright' package.json 2>/dev/null - E2E test dir: !
find . -maxdepth 2 -type d \( -name 'e2e' -o -name 'tests' \) 2>/dev/null - Visual snapshots: !
find . -maxdepth 4 -type d -name '__snapshots__' 2>/dev/null - MCP config: !
find . -maxdepth 1 -name '.mcp.json' 2>/dev/null - CI workflow: !
find .github/workflows -maxdepth 1 -name 'e2e*' 2>/dev/null
UX Testing Stack:
- Playwright - Cross-browser E2E testing (primary tool)
- axe-core - Automated accessibility testing (WCAG compliance)
- Playwright screenshots - Visual regression testing
- Playwright MCP - Browser automation via MCP integration
- 包管理器: !
find . -maxdepth 1 \( -name 'package.json' -o -name 'bun.lockb' \) 2>/dev/null - Playwright配置: !
find . -maxdepth 1 -name 'playwright.config.*' 2>/dev/null - Playwright已安装: !
grep -l '@playwright/test' package.json 2>/dev/null - Axe-core已安装: !
grep -l '@axe-core/playwright' package.json 2>/dev/null - E2E测试目录: !
find . -maxdepth 2 -type d \( -name 'e2e' -o -name 'tests' \) 2>/dev/null - 视觉快照: !
find . -maxdepth 4 -type d -name '__snapshots__' 2>/dev/null - MCP配置: !
find . -maxdepth 1 -name '.mcp.json' 2>/dev/null - CI工作流: !
find .github/workflows -maxdepth 1 -name 'e2e*' 2>/dev/null
UX测试技术栈:
- Playwright - 跨浏览器端到端(E2E)测试(核心工具)
- axe-core - 自动化无障碍测试(符合WCAG标准)
- Playwright截图 - 视觉回归测试
- Playwright MCP - 通过MCP集成实现浏览器自动化
Parameters
参数
Parse from command arguments:
- : Report status without offering fixes
--check-only - : Apply all fixes automatically without prompting
--fix - : Focus on accessibility testing configuration
--a11y - : Focus on visual regression testing configuration
--visual
从命令参数中解析:
- : 仅报告状态,不提供修复方案
--check-only - : 自动应用所有修复,无需提示
--fix - : 专注于无障碍测试配置
--a11y - : 专注于视觉回归测试配置
--visual
Execution
执行步骤
Execute this UX testing configuration check:
执行此UX测试配置检查:
Step 1: Fetch latest tool versions
步骤1:获取工具最新版本
Verify latest versions before configuring:
- @playwright/test: Check playwright.dev or npm
- @axe-core/playwright: Check npm
- playwright MCP: Check npm
Use WebSearch or WebFetch to verify current versions.
配置前验证最新版本:
- @playwright/test: 查看playwright.dev或npm
- @axe-core/playwright: 查看npm
- playwright MCP: 查看npm
使用WebSearch或WebFetch验证当前版本。
Step 2: Detect existing UX testing infrastructure
步骤2:检测现有UX测试基础设施
Check for each component:
| Indicator | Component | Status |
|---|---|---|
| Playwright | Installed |
| Accessibility testing | Configured |
| Playwright Test | Installed |
| E2E tests | Present |
| Visual regression | Configured |
| Playwright MCP | Configured |
检查每个组件:
| 指示器 | 组件 | 状态 |
|---|---|---|
| Playwright | 已安装 |
| 无障碍测试 | 已配置 |
| Playwright Test | 已安装 |
| E2E测试 | 已存在 |
包含toHaveScreenshot的 | 视觉回归 | 已配置 |
包含playwright server的 | Playwright MCP | 已配置 |
Step 3: Analyze current testing state
步骤3:分析当前测试状态
Check for complete UX testing setup across four areas:
Playwright Core:
- installed
@playwright/test - exists
playwright.config.ts - Browser projects configured (Chromium, Firefox, WebKit)
- Mobile viewports configured (optional)
- WebServer configuration for local dev
- Trace/screenshot/video on failure
Accessibility Testing:
- installed
@axe-core/playwright - Accessibility tests created
- WCAG level configured (A, AA, AAA)
- Custom rules/exceptions documented
Visual Regression:
- Screenshot assertions configured
- Snapshot directory configured
- Update workflow documented
- CI snapshot handling configured
MCP Integration:
- Playwright MCP server in
.mcp.json - Browser automation available to Claude
检查四个领域的完整UX测试设置:
Playwright核心:
- 已安装
@playwright/test - 存在
playwright.config.ts - 已配置浏览器项目(Chromium、Firefox、WebKit)
- 已配置移动端视口(可选)
- 本地开发的WebServer配置
- 失败时的追踪/截图/视频记录
无障碍测试:
- 已安装
@axe-core/playwright - 已创建无障碍测试用例
- 已配置WCAG级别(A、AA、AAA)
- 已记录自定义规则/例外情况
视觉回归:
- 已配置截图断言
- 已配置快照目录
- 已记录更新工作流
- 已配置CI中的快照处理
MCP集成:
- 中包含Playwright MCP服务器
.mcp.json - Claude可使用浏览器自动化功能
Step 4: Generate compliance report
步骤4:生成合规性报告
Print a formatted compliance report showing status for Playwright core, accessibility testing, visual regression, and MCP integration.
If is set, stop here.
--check-onlyFor the compliance report format, see REFERENCE.md.
打印格式化的合规性报告,展示Playwright核心、无障碍测试、视觉回归和MCP集成的状态。
如果设置了,在此步骤停止。
--check-only合规性报告格式请参考REFERENCE.md。
Step 5: Install dependencies (if --fix or user confirms)
步骤5:安装依赖(如果使用--fix或用户确认)
bash
undefinedbash
undefinedCore Playwright
Core Playwright
bun add --dev @playwright/test
bun add --dev @playwright/test
Accessibility testing
Accessibility testing
bun add --dev @axe-core/playwright
bun add --dev @axe-core/playwright
Install browsers
Install browsers
bunx playwright install
undefinedbunx playwright install
undefinedStep 6: Create Playwright configuration
步骤6:创建Playwright配置
Create with:
playwright.config.ts- 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 template, see REFERENCE.md.
playwright.config.ts创建,包含:
playwright.config.ts- 桌面浏览器项目(Chromium、Firefox、WebKit)
- 移动端视口项目(Pixel 5、iPhone 13)
- 专用的无障碍测试项目(仅Chromium)
- 本地开发的WebServer自动启动配置
- 失败时的追踪/截图/视频设置
- 用于CI的JSON和JUnit报告器
完整的模板请参考REFERENCE.md。
playwright.config.tsStep 7: Create accessibility test helper
步骤7:创建无障碍测试辅助工具
Create with:
tests/e2e/helpers/a11y.ts- - Assert no WCAG violations
expectNoA11yViolations(page, options) - - Generate detailed a11y report
getA11yReport(page, options) - Configurable WCAG level (wcag2a, wcag2aa, wcag21aa, wcag22aa)
- Rule include/exclude support
- Formatted violation output
For the complete a11y helper code, see REFERENCE.md.
创建,包含:
tests/e2e/helpers/a11y.ts- - 断言无WCAG违规
expectNoA11yViolations(page, options) - - 生成详细的无障碍报告
getA11yReport(page, options) - 可配置的WCAG级别(wcag2a、wcag2aa、wcag21aa、wcag22aa)
- 规则包含/排除支持
- 格式化的违规输出
完整的无障碍测试辅助工具代码请参考REFERENCE.md。
Step 8: Create example test files
步骤8:创建示例测试文件
Create example tests:
- - Homepage accessibility tests (WCAG 2.1 AA violations, post-interaction checks, full report)
tests/e2e/homepage.a11y.spec.ts - - Visual regression tests (full page screenshots, component screenshots, responsive layouts, dark mode)
tests/e2e/visual.spec.ts
For complete example test files, see REFERENCE.md.
创建示例测试:
- - 首页无障碍测试(检查WCAG 2.1 AA违规、交互后检查、完整报告)
tests/e2e/homepage.a11y.spec.ts - - 视觉回归测试(全页截图、组件截图、响应式布局、深色模式)
tests/e2e/visual.spec.ts
完整的示例测试文件请参考REFERENCE.md。
Step 9: Add npm scripts
步骤9:添加npm脚本
Update with test scripts:
package.jsonjson
{
"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"
}
}更新中的测试脚本:
package.jsonjson
{
"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 10: Configure MCP integration (optional)
步骤10:配置MCP集成(可选)
Add to :
.mcp.jsonjson
{
"mcpServers": {
"playwright": {
"command": "bunx",
"args": ["-y", "@playwright/mcp@latest"]
}
}
}This enables Claude to navigate web pages, take screenshots, fill forms, click elements, and capture accessibility snapshots.
添加到:
.mcp.jsonjson
{
"mcpServers": {
"playwright": {
"command": "bunx",
"args": ["-y", "@playwright/mcp@latest"]
}
}
}这将允许Claude导航网页、截取屏幕截图、填写表单、点击元素并捕获无障碍快照。
Step 11: Create CI/CD workflow
步骤11:创建CI/CD工作流
Create with parallel jobs for:
.github/workflows/e2e.yml- E2E tests (all browsers)
- Accessibility tests (Chromium only)
- Artifact upload for reports and failure screenshots
For the complete CI workflow template, see REFERENCE.md.
创建,包含并行任务:
.github/workflows/e2e.yml- E2E测试(所有浏览器)
- 无障碍测试(仅Chromium)
- 上传报告和失败截图作为工件
完整的CI工作流模板请参考REFERENCE.md。
Step 12: Update standards tracking
步骤12:更新标准跟踪
Update :
.project-standards.yamlyaml
components:
ux_testing: "2025.1"
ux_testing_framework: "playwright"
ux_testing_a11y: true
ux_testing_a11y_level: "wcag21aa"
ux_testing_visual: true
ux_testing_mcp: true更新:
.project-standards.yamlyaml
components:
ux_testing: "2025.1"
ux_testing_framework: "playwright"
ux_testing_a11y: true
ux_testing_a11y_level: "wcag21aa"
ux_testing_visual: true
ux_testing_mcp: trueStep 13: Report configuration results
步骤13:报告配置结果
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.
打印已应用的配置、添加的脚本和CI/CD设置的摘要。包含启动开发服务器、运行测试、更新快照和打开交互式UI的后续步骤。
结果报告格式请参考REFERENCE.md。
Agentic Optimizations
Agent优化
| Context | Command |
|---|---|
| Quick compliance check | |
| Auto-fix all issues | |
| Accessibility focus only | |
| Visual regression focus only | |
| Run E2E tests compact | |
| Run a11y tests only | |
| 上下文 | 命令 |
|---|---|
| 快速合规性检查 | |
| 自动修复所有问题 | |
| 仅专注于无障碍测试 | |
| 仅专注于视觉回归测试 | |
| 简洁运行E2E测试 | |
| 仅运行无障碍测试 | |
Flags
标志
| Flag | Description |
|---|---|
| Report status without offering fixes |
| Apply all fixes automatically without prompting |
| Focus on accessibility testing configuration |
| 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
- 未找到包管理器: 无法安装依赖,提供手动步骤
- 未配置开发服务器: 警告需手动配置baseURL
- 浏览器未安装: 提示运行
bunx playwright install - 现有配置冲突: 保留用户配置,建议合并
See Also
另请参阅
- - Unit and integration testing configuration
/configure:tests - - Run all compliance checks
/configure:all - Skills: ,
playwright-testingaccessibility-implementation - Agents: for implementing UX designs
ux-implementation - Playwright documentation: https://playwright.dev
- axe-core documentation: https://www.deque.com/axe
- - 单元和集成测试配置
/configure:tests - - 运行所有合规性检查
/configure:all - 技能: ,
playwright-testingaccessibility-implementation - Agent: 用于实现UX设计
ux-implementation - Playwright文档: https://playwright.dev
- axe-core文档: https://www.deque.com/axe