Loading...
Loading...
Compare original and translation side by side
Phase 1 → DISCOVERY : Explore the site, understand its purpose and features
Phase 2 → USE CASES : Generate end-user use case list
Phase 3 → TEST PLAN : Convert use cases into concrete, executable test cases
Phase 4 → EXECUTION : Run tests with Playwright, capture screenshots
Phase 5 → REPORT : Compile HTML + Markdown report with all resultsPhase 1 → 发现阶段 : 探索网站,了解其用途与功能
Phase 2 → 用例生成 : 生成终端用户用例列表
Phase 3 → 测试计划 : 将用例转化为具体可执行的测试用例
Phase 4 → 执行测试 : 通过Playwright运行测试,捕获截图
Phase 5 → 生成报告 : 整合HTML + Markdown格式的全量测试结果报告mcp__plugin_playwright_playwright__*browser_navigate → navigate to URL
browser_snapshot → get page state and element refs
browser_take_screenshot → capture screenshots
browser_click → click elements
browser_type → type into inputs
browser_evaluate → run JS assertions
browser_resize → test mobile viewports
browser_console_messages → check for JS errorsmcp__plugin_playwright_playwright__*browser_navigate → 导航至指定URL
browser_snapshot → 获取页面状态与元素引用
browser_take_screenshot → 捕获截图
browser_click → 点击元素
browser_type → 在输入框中输入内容
browser_evaluate → 运行JS断言
browser_resize → 测试移动端视口
browser_console_messages → 检查JS错误@playwright/clinpm install -g @playwright/cli@latestundefined@playwright/clinpm install -g @playwright/cli@latestundefined
Playwright CLI is headless by default. Add `--headed` to watch the browser visually.
Use `playwright-cli show` to open a dashboard of all active sessions.
Playwright CLI默认以无头模式运行。添加 `--headed` 参数可可视化查看浏览器操作。
使用 `playwright-cli show` 可打开所有活跃会话的控制面板。scripts/undefinedscripts/undefinedundefinedundefinedcurlfetchcurlfetch1. browser_navigate to the URL
2. browser_snapshot to get the page structure
3. browser_take_screenshot for visual reference
4. Examine links, forms, headings, navigation from the snapshot
5. Navigate to discovered subpages and repeat1. 使用browser_navigate导航至目标URL
2. 使用browser_snapshot获取页面结构
3. 使用browser_take_screenshot留存视觉参考
4. 从快照中分析链接、表单、标题、导航栏
5. 导航至发现的子页面并重复上述步骤playwright-cli open <URL>
playwright-cli screenshot --name discovery_home
playwright-cli snapshotplaywright-cli open <URL>
playwright-cli screenshot --name discovery_home
playwright-cli snapshotundefinedundefinedpython scripts/discover.py --url <URL> --max-pages 10 --output discovery.jsonpython scripts/discover.py --url <URL> --max-pages 10 --output discovery.jsonpython -m http.server 8080 --directory <project-path>npx serve <project-path>http://localhost:8080file://python -m http.server 8080 --directory <project-path>npx serve <project-path>http://localhost:8080file://UC-01: [Actor] can [action] so that [goal]
UC-02: [Actor] can [action] so that [goal]
...UC-01: [角色] 可以 [执行操作] 以实现 [目标]
UC-02: [角色] 可以 [执行操作] 以实现 [目标]
...TC-01 [UC-01]: Homepage Navigation
Given: User opens the site root URL
When: Page finishes loading
Then: - Page title is not empty
- Navigation menu is visible
- Logo/brand element is present
- No 404/500 status code
Checks: title, nav links count > 0, hero text presentTC-01 [UC-01]: 首页导航
前提条件: 用户打开网站根URL
操作步骤: 页面加载完成
预期结果: - 页面标题非空
- 导航菜单可见
- Logo/品牌元素存在
- 无404/500状态码
检查项: 标题、导航链接数量>0、核心文案存在| Type | Examples |
|---|---|
| Presence checks | Element exists, text is visible, image loads |
| Functional checks | Button clickable, form submits, menu expands |
| Data validation | Price format, phone format, required fields |
| Navigation checks | Links don't 404, routing works |
| Form validation | Empty submit shows errors, valid submit succeeds |
| Responsiveness | Mobile viewport renders without overflow |
| Console errors | No JS errors on page load |
| Accessibility basics | Images have alt text, headings hierarchy, landmarks |
test_plan.jsonreferences/test_case_schema.md| 类型 | 示例 |
|---|---|
| 存在性检查 | 元素存在、文本可见、图片加载正常 |
| 功能性检查 | 按钮可点击、表单可提交、菜单可展开 |
| 数据验证 | 价格格式、电话格式、必填字段检查 |
| 导航检查 | 链接无404错误、路由正常 |
| 表单验证 | 空提交显示错误、有效提交成功 |
| 响应式检查 | 移动端视口无横向溢出 |
| 控制台错误检查 | 页面加载时无JS错误 |
| 基础可访问性检查 | 图片含替代文本、标题层级合理、地标元素存在 |
test_plan.jsonreferences/test_case_schema.mdbrowser_navigate to target URL
browser_take_screenshot for "before" capture
browser_snapshot to check element presence
browser_evaluate to run JS assertions:
- document.title !== ''
- document.querySelectorAll('nav').length > 0
- document.querySelectorAll('img').filter(i => i.naturalWidth === 0).length
browser_click / browser_type for interactions
browser_take_screenshot for "after" capture
browser_console_messages to check for JS errors
browser_resize for mobile viewport testingbrowser_navigate至目标URL
browser_take_screenshot捕获“操作前”截图
browser_snapshot检查元素存在性
browser_evaluate运行JS断言:
- document.title !== ''
- document.querySelectorAll('nav').length > 0
- document.querySelectorAll('img').filter(i => i.naturalWidth === 0).length
browser_click / browser_type执行交互操作
browser_take_screenshot捕获“操作后”截图
browser_console_messages检查JS错误
browser_resize进行移动端视口测试undefinedundefined
For **mobile viewport testing**, open a separate session with mobile dimensions
or resize the browser.
For **status code testing** (e.g., checking that /404 returns 404): use
`playwright-cli` navigation — the tool reports HTTP status in its output. Note that
navigating to a 4xx/5xx page may throw an error in some tools; catch it gracefully
and record the status code from the error message.
对于**移动端视口测试**,打开带有移动端尺寸的独立会话或调整浏览器窗口大小。
对于**状态码测试**(如检查/404是否返回404):使用 `playwright-cli` 导航——工具会在输出中报告HTTP状态码。注意:部分工具在导航至4xx/5xx页面时可能抛出错误,请优雅捕获并从错误信息中提取状态码。python scripts/run_tests.py \
--url <URL> \
--test-plan test_plan.json \
--output test_results/python scripts/run_tests.py \
--url <URL> \
--test-plan test_plan.json \
--output test_results/browser_console_messagesbrowser_evaluateplaywright-clibrowser_console_messagesbrowser_evaluateplaywright-cliArray.from(document.images)
.filter(img => img.naturalWidth === 0 && img.src && !img.src.startsWith('data:'))
.map(img => img.src)Array.from(document.images)
.filter(img => img.naturalWidth === 0 && img.src && !img.src.startsWith('data:'))
.map(img => img.src)// Images missing alt text
document.querySelectorAll('img:not([alt]), img[alt=""]').length
// Heading hierarchy (should have h1, not skip levels)
[...document.querySelectorAll('h1,h2,h3,h4,h5,h6')].map(h => h.tagName)
// Landmark elements
document.querySelectorAll('main, nav, header, footer, [role]').length// 缺少替代文本的图片
document.querySelectorAll('img:not([alt]), img[alt=""]').length
// 标题层级(应包含h1,且不跳过层级)
[...document.querySelectorAll('h1,h2,h3,h4,h5,h6')].map(h => h.tagName)
// 地标元素
document.querySelectorAll('main, nav, header, footer, [role]').lengthpython scripts/generate_report.py \
--results test_results/results.json \
--screenshots test_results/screenshots/ \
--output qa_report.htmlpython scripts/generate_report.py \
--results test_results/results.json \
--screenshots test_results/screenshots/ \
--output qa_report.html1. Receive URL or project files from user
2. Pick your execution tool (MCP > Playwright CLI > Python > Manual)
3. Run discovery → understand pages, structure, features
4. Generate use case list (10–25 use cases)
5. Generate test plan → structured test cases
6. Run tests → collect results + screenshots
7. Generate HTML report
8. Show the report path to the userreferences/test_case_schema.mdscripts/discover.pyscripts/run_tests.pyscripts/generate_report.pypython -m http.server 8080npx serve .http://localhost:8080file://fetch()document.body.scrollWidth > window.innerWidthreferences/test_case_schema.mdscripts/discover.pyscripts/run_tests.pyscripts/generate_report.py