qa-use
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseqa-use
qa-use
E2E testing and browser automation for AI-driven development workflows.
面向AI驱动开发工作流的端到端(E2E)测试与浏览器自动化工具。
Critical Insight: Plugin Commands as Shortcuts
关键提示:插件命令作为快捷方式
For AI Harnesses (codex, opencode, etc.):
Plugin commands (slash commands like ) are convenience shortcuts that wrap CLI workflows. Harnesses with only the Bash tool can access ALL functionality via CLI commands documented below.
/qa-use:verifyPattern throughout this document:
- CLI Workflow: Step-by-step CLI commands (works for ALL harnesses)
- Plugin Shortcut: Optional slash command (convenience)
针对AI工具(codex、opencode等):
插件命令(如这类斜杠命令)是封装CLI工作流的便捷快捷方式。仅支持Bash工具的平台可通过下文记录的CLI命令访问全部功能。
/qa-use:verify本文档通用格式:
- CLI工作流:分步CLI命令(适用于所有平台)
- 插件快捷方式:可选斜杠命令(便捷操作)
Core Workflow
核心工作流
1. Browser Control & Session Lifecycle
1. 浏览器控制与会话生命周期
CLI Workflow:
bash
undefinedCLI工作流:
bash
undefinedCreate browser session
创建浏览器会话
qa-use browser create --viewport desktop
qa-use browser create --viewport desktop
For localhost testing
本地测试专用
qa-use browser create --tunnel --no-headless
qa-use browser create --tunnel --no-headless
Navigate
页面导航
qa-use browser goto https://example.com
qa-use browser goto https://example.com
Snapshot to get element refs (ALWAYS do this before interacting)
生成快照获取元素引用(交互前必须执行此操作)
qa-use browser snapshot
qa-use browser snapshot
Interact by ref
通过引用与元素交互
qa-use browser click e3
qa-use browser fill e5 "text"
qa-use browser click e3
qa-use browser fill e5 "text"
Close
关闭会话
qa-use browser close
**Plugin Shortcut:**/qa-use:explore https://example.com
(Wraps create + goto + snapshot with autonomous exploration)
**Critical:** Always run `snapshot` before interacting. Never guess element refs.
**Snapshot Diff Feature:**
After each action (goto, click, fill, etc.), the browser automatically shows DOM changes:
- **Summary**: "5 elements added, 1 element modified"
- **Added elements**: `+ [e54] generic "Thanks for agreeing!"` (green)
- **Modified elements**: `~ [e18] checkbox "I agree..."` with `+attrs: checked, active` (yellow)
- **Removed elements**: `- [e99] button "Submit"` (red)
This helps you understand what changed after each action without manually inspecting the DOM.qa-use browser close
**插件快捷方式:**/qa-use:explore https://example.com
(封装了创建会话、导航、快照及自动探索流程)
**重要提示:** 交互前必须执行`snapshot`命令,切勿猜测元素引用。
**快照差异功能:**
每次操作(导航、点击、填充等)后,浏览器会自动展示DOM变化:
- **摘要**:"新增5个元素,修改1个元素"
- **新增元素**:`+ [e54] generic "Thanks for agreeing!"`(绿色标识)
- **修改元素**:`~ [e18] checkbox "I agree..."` 附带`+attrs: checked, active`(黄色标识)
- **移除元素**:`- [e99] button "Submit"`(红色标识)
无需手动检查DOM,即可快速了解每次操作后的页面变化。2. Understanding Blocks
2. 理解Blocks(交互块)
What are blocks?
Blocks are atomic recorded interactions from a browser session. They are:
- Automatically captured during any browser interaction (click, fill, goto, scroll, etc.)
- Stored server-side with the session
- Retrieved via
qa-use browser get-blocks - The foundation for test generation
Why blocks matter:
- Record-once, replay-many: Interactive recording becomes automated test
- AI-friendly: Agents can analyze blocks to understand user intent
- Version control: Blocks stored with session enable test iteration
- Bridge CLI → Tests: Natural workflow from exploration to automation
How blocks work:
bash
undefined什么是Blocks?
Blocks是浏览器会话中记录的原子化交互操作,具备以下特性:
- 所有浏览器交互(点击、填充、导航、滚动等)都会自动捕获为Blocks
- 与会话一起存储在服务器端
- 可通过命令获取
qa-use browser get-blocks - 是生成自动化测试用例的基础
Blocks的重要性:
- 一次录制,多次复用:交互式录制可直接转为自动化测试
- AI友好:智能体可分析Blocks理解用户意图
- 版本控制:与会话绑定的Blocks支持测试用例迭代
- 桥接CLI与测试:从探索到自动化的自然工作流
Blocks的使用流程:
bash
undefined1. Create session and interact
1. 创建会话并执行交互操作
qa-use browser create --tunnel --no-headless
qa-use browser goto https://example.com
qa-use browser snapshot # Returns: [ref=e1] button
qa-use browser click e1 # Records as block
qa-use browser fill e5 "text" # Records as block
qa-use browser create --tunnel --no-headless
qa-use browser goto https://example.com
qa-use browser snapshot # 返回结果:[ref=e1] button
qa-use browser click e1 # 记录为Block
qa-use browser fill e5 "text" # 记录为Block
2. Retrieve blocks (JSON array)
2. 获取Blocks(JSON数组格式)
qa-use browser get-blocks
qa-use browser get-blocks
Returns:
返回结果:
[
[
{"type": "goto", "url": "...", "timestamp": "..."},
{"type": "goto", "url": "...", "timestamp": "..."},
{"type": "click", "ref": "e1", "timestamp": "..."},
{"type": "click", "ref": "e1", "timestamp": "..."},
{"type": "fill", "ref": "e5", "value": "text", "timestamp": "..."}
{"type": "fill", "ref": "e5", "value": "text", "timestamp": "..."}
]
]
3. Generate test YAML from blocks
3. 基于Blocks生成测试用例YAML文件
qa-use browser generate-test -n "my_test" -o qa-tests/my_test.yaml
qa-use browser generate-test -n "my_test" -o qa-tests/my_test.yaml
4. Run generated test
4. 运行生成的测试用例
qa-use test run my_test
**Plugin Shortcut:**/qa-use:record start my_test
qa-use test run my_test
**插件快捷方式:**/qa-use:record start my_test
... perform interactions ...
... 执行交互操作 ...
/qa-use:record stop
(Wraps the interactive workflow with AI-powered test generation)/qa-use:record stop
(封装了交互式工作流及AI驱动的测试用例生成)3. Test Management
3. 测试用例管理
CLI Workflow:
bash
undefinedCLI工作流:
bash
undefinedRun test by name
按名称运行测试用例
qa-use test run login
qa-use test run login
Run with autofix (AI self-healing)
启用AI自修复功能运行测试
qa-use test run login --autofix
qa-use test run login --autofix
Validate syntax
验证测试用例语法
qa-use test validate login
qa-use test validate login
Show test details
查看测试用例详情
qa-use test info login
qa-use test info login
List test runs
列出测试运行记录
qa-use test runs --status failed
**Plugin Shortcut:**/qa-use:test-run login --autofix
(Convenience shortcut for common test execution)qa-use test runs --status failed
**插件快捷方式:**/qa-use:test-run login --autofix
(常用测试执行操作的快捷方式)4. Test Sync Lifecycle
4. 测试用例同步生命周期
CLI Workflow:
bash
undefinedCLI工作流:
bash
undefinedPull tests from cloud
从云端拉取测试用例
qa-use test sync pull
qa-use test sync pull
Push all local tests to cloud
将所有本地测试用例推送到云端
qa-use test sync push --all
qa-use test sync push --all
Push specific test
推送指定测试用例
qa-use test sync push --id <uuid>
qa-use test sync push --id <uuid>
Force push (overwrite conflicts)
强制推送(覆盖冲突内容)
qa-use test sync push --force
qa-use test sync push --force
Compare local vs cloud
对比本地与云端测试用例差异
qa-use test diff login.yaml
**No Plugin Shortcut** - Use CLI commands directlyqa-use test diff login.yaml
**无插件快捷方式** - 直接使用CLI命令Essential Commands
核心命令
Browser Session Management
浏览器会话管理
| Command | Description |
|---|---|
| Create remote browser session |
| Create local browser with API tunnel |
| Show browser window (tunnel mode only) |
| Set viewport: |
| Connect to existing WebSocket browser |
| Run a test first, then become interactive |
| Override app config variables (repeatable) |
| List active sessions |
| Show current session details (app_url, recording_url, etc.) |
| Close active session |
Sessions auto-persist in . One active session = no flag needed.
~/.qa-use.json-s| 命令 | 描述 |
|---|---|
| 创建远程浏览器会话 |
| 创建带API隧道的本地浏览器会话 |
| 显示浏览器窗口(仅隧道模式可用) |
| 设置视窗尺寸: |
| 连接到已有的WebSocket浏览器 |
| 先运行指定测试用例,再进入交互模式 |
| 覆盖应用配置变量(可重复使用) |
| 列出所有活跃会话 |
| 显示当前会话详情(app_url、recording_url等) |
| 关闭活跃会话 |
会话会自动持久化到文件中。仅存在一个活跃会话时,无需使用参数指定会话ID。
~/.qa-use.json-sNavigation
页面导航
| Command | Description |
|---|---|
| Navigate to URL |
| Go back |
| Go forward |
| Reload page |
| 命令 | 描述 |
|---|---|
| 导航到指定URL |
| 后退到上一页 |
| 前进到下一页 |
| 刷新当前页面 |
Element Interaction
元素交互
| Command | Description |
|---|---|
| Click element by ref |
| Click by semantic description |
| Fill input field |
| Type with delays (for autocomplete) |
| Press key (e.g., |
| Check checkbox |
| Uncheck checkbox |
| Select dropdown option |
| Hover over element |
| Scroll by pixels |
| Scroll element into view |
| Drag element to target |
| Generate TOTP code (optionally fill) |
| Upload file(s) to input |
| 命令 | 描述 |
|---|---|
| 通过元素引用点击元素 |
| 通过语义描述点击元素 |
| 填充输入框内容 |
| 模拟手动输入(带延迟,适用于自动补全场景) |
| 按下指定按键(如 |
| 勾选复选框 |
| 取消勾选复选框 |
| 选择下拉选项 |
| 悬停在元素上 |
| 向下滚动指定像素 |
| 滚动到元素可见位置 |
| 将元素拖拽到目标位置 |
| 生成TOTP验证码(可选自动填充) |
| 向输入框上传文件 |
Inspection & Snapshot Diff
检查与快照差异
| Command | Description |
|---|---|
| Get ARIA tree with element refs (shows snapshot diff after actions) |
| Get current URL |
| Save screenshot.png |
| Save to custom path |
| Output base64 to stdout |
| Execute JavaScript in browser context |
The snapshot-diff feature automatically displays DOM changes after each browser action:
- Added elements: Shown with prefix and green color
+ - Modified elements: Shown with prefix and yellow color, including attribute changes (
~)+attrs: checked - Removed elements: Shown with prefix and red color
-
| 命令 | 描述 |
|---|---|
| 获取带元素引用的ARIA树(操作后自动展示快照差异) |
| 获取当前页面URL |
| 保存为screenshot.png |
| 保存到指定路径 |
| 以base64格式输出到标准输出 |
| 在浏览器上下文执行JavaScript代码 |
快照差异功能会在每次浏览器操作后自动展示DOM变化:
- 新增元素:以前缀和绿色标识展示
+ - 修改元素:以前缀和黄色标识展示,包含属性变化(如
~)+attrs: checked - 移除元素:以前缀和红色标识展示
-
Test Operations
测试操作
| Command | Description |
|---|---|
| Run test by name |
| Run all tests |
| Run with local browser tunnel |
| Enable AI self-healing |
| Persist AI fixes to file |
| Download assets to |
| Override variable |
| Validate test syntax |
| List available tests |
| Show test details (steps, tags, description) |
| Show cloud test details by ID |
| List test run history |
| Filter runs by test ID |
| Filter runs by status |
| Initialize test directory |
| Pull tests from cloud |
| Push all local tests to cloud |
| Push specific test |
| Push tests, overwriting conflicts |
| Compare local vs cloud test |
| View test definition schema |
| 命令 | 描述 |
|---|---|
| 按名称运行测试用例 |
| 运行所有测试用例 |
| 通过本地浏览器隧道运行测试 |
| 启用AI自修复功能 |
| 将AI修复结果持久化到本地文件 |
| 将资源下载到 |
| 覆盖变量值 |
| 验证测试用例语法 |
| 列出所有可用测试用例 |
| 查看测试用例详情(步骤、标签、描述) |
| 通过ID查看云端测试用例详情 |
| 列出测试运行历史 |
| 按测试ID筛选运行记录 |
| 按状态筛选运行记录(如失败) |
| 初始化测试目录 |
| 从云端拉取测试用例 |
| 将所有本地测试用例推送到云端 |
| 推送指定测试用例 |
| 推送测试用例并覆盖冲突内容 |
| 对比本地与云端测试用例差异 |
| 查看测试用例定义 schema |
Logs & Debugging
日志与调试
| Command | Description |
|---|---|
| View console logs from session |
| View logs from specific/closed session |
| View network request logs |
| View network logs from specific session |
| 命令 | 描述 |
|---|---|
| 查看会话中的控制台日志 |
| 查看指定/已关闭会话的控制台日志 |
| 查看网络请求日志 |
| 查看指定会话的网络请求日志 |
Test Generation
测试用例生成
| Command | Description |
|---|---|
| Generate test YAML from recorded session |
| Generate from specific session |
| Specify test name |
| Specify output path |
| Get recorded interaction blocks (JSON) |
| 命令 | 描述 |
|---|---|
| 基于录制的会话生成测试用例YAML文件 |
| 基于指定会话生成测试用例 |
| 指定测试用例名称 |
| 指定输出路径 |
| 获取录制的交互Blocks(JSON格式) |
Waiting
等待操作
| Command | Description |
|---|---|
| Fixed wait |
| Wait for selector |
| Wait for page load |
| 命令 | 描述 |
|---|---|
| 固定时长等待 |
| 等待选择器对应的元素出现 |
| 等待页面加载完成 |
Variable Overrides
变量覆盖
Use to override app config variables at runtime. Common variables:
--var| Variable | Description |
|---|---|
| Base URL for the app (e.g., preview deployment URL) |
| Login page URL |
| Username/email for authentication |
| Password for authentication |
Example with ephemeral preview URL:
bash
qa-use browser create --after-test-id <login-test-uuid> \
--var base_url=https://preview-123.example.com \
--var login_url=https://preview-123.example.com/auth/login可使用参数在运行时覆盖应用配置变量,常用变量如下:
--var| 变量 | 描述 |
|---|---|
| 应用基础URL(如预览部署URL) |
| 登录页面URL |
| 认证用用户名/邮箱 |
| 认证用密码 |
临时预览URL示例:
bash
qa-use browser create --after-test-id <login-test-uuid> \
--var base_url=https://preview-123.example.com \
--var login_url=https://preview-123.example.com/auth/loginCommon Patterns
常见使用模式
Pattern 1: Feature Verification
模式1:功能验证
CLI Workflow:
bash
undefinedCLI工作流:
bash
undefined1. Search for existing test
1. 搜索已存在的测试用例
qa-use test list | grep "login"
qa-use test list | grep "login"
2. Run test with autofix
2. 启用自修复功能运行测试
qa-use test run login --autofix
qa-use test run login --autofix
3. Debug failures
3. 调试失败场景
qa-use browser logs console
**Plugin Shortcut:**/qa-use:verify "login works with valid credentials"
(Wraps the above CLI workflow with AI-powered test discovery and analysis)qa-use browser logs console
**插件快捷方式:**/qa-use:verify "login works with valid credentials"
(封装了AI驱动的测试用例发现与分析流程)Pattern 2: Record & Generate Test
模式2:录制并生成测试用例
CLI Workflow:
bash
undefinedCLI工作流:
bash
undefined1. Create session
1. 创建会话
qa-use browser create --tunnel --no-headless
qa-use browser create --tunnel --no-headless
2. Navigate and interact
2. 导航并执行交互
qa-use browser goto https://example.com
qa-use browser snapshot
qa-use browser click e1
qa-use browser fill e5 "test"
qa-use browser goto https://example.com
qa-use browser snapshot
qa-use browser click e1
qa-use browser fill e5 "test"
3. Generate test from blocks
3. 基于Blocks生成测试用例
qa-use browser get-blocks
qa-use browser generate-test -n "my_test"
qa-use browser get-blocks
qa-use browser generate-test -n "my_test"
4. Run test
4. 运行测试用例
qa-use test run my_test
**Plugin Shortcut:**/qa-use:record start my_test
qa-use test run my_test
**插件快捷方式:**/qa-use:record start my_test
... perform interactions ...
... 执行交互操作 ...
/qa-use:record stop
undefined/qa-use:record stop
undefinedPattern 3: Authenticated Exploration
模式3:已认证状态下的探索
CLI Workflow:
bash
undefinedCLI工作流:
bash
undefinedCreate session that runs login test first
创建会话,先运行登录测试用例
qa-use browser create --after-test-id <login-test-uuid>
qa-use browser create --after-test-id <login-test-uuid>
Session now authenticated, explore
会话已处于认证状态,开始探索
qa-use browser goto /dashboard
qa-use browser snapshot
**Plugin Shortcut:**/qa-use:explore /dashboard
(Automatically handles auth detection and session creation)qa-use browser goto /dashboard
qa-use browser snapshot
**插件快捷方式:**/qa-use:explore /dashboard
(自动处理认证检测与会话创建)Pattern 4: Edit Existing Test
模式4:编辑已有测试用例
CLI Workflow:
bash
undefinedCLI工作流:
bash
undefined1. Open test file in editor
1. 在编辑器中打开测试用例文件
vim qa-tests/login.yaml
vim qa-tests/login.yaml
2. Validate syntax
2. 验证语法
qa-use test validate login
qa-use test validate login
3. Run to verify
3. 运行测试验证
qa-use test run login
**Plugin Shortcut:**/qa-use:record edit login
(AI-assisted editing with validation)qa-use test run login
**插件快捷方式:**/qa-use:record edit login
(AI辅助编辑及语法验证)Pattern 5: Understanding DOM Changes with Snapshot Diff
模式5:通过快照差异理解DOM变化
CLI Workflow:
bash
undefinedCLI工作流:
bash
undefinedCreate session and navigate
创建会话并导航
qa-use browser create --tunnel --no-headless
qa-use browser goto https://evals.desplega.ai/checkboxes
qa-use browser create --tunnel --no-headless
qa-use browser goto https://evals.desplega.ai/checkboxes
Output shows initial elements:
输出初始元素:
Changes: 45 elements added
变化:新增45个元素
+ [e18] checkbox "I agree to the terms and conditions"
+ [e18] checkbox "I agree to the terms and conditions"
+ [e19] generic "I agree to the terms and conditions"
+ [e19] generic "I agree to the terms and conditions"
Click checkbox
点击复选框
qa-use browser click e18
qa-use browser click e18
Snapshot diff automatically shows:
自动展示快照差异:
Changes: 5 elements added, 1 element modified
变化:新增5个元素,修改1个元素
+ [e54] generic "Thanks for agreeing!"
+ [e54] generic "Thanks for agreeing!"
+ [e55] link "Terms and Conditions"
+ [e55] link "Terms and Conditions"
~ [e18] checkbox "I agree to the terms and conditions"
~ [e18] checkbox "I agree to the terms and conditions"
+attrs: active, checked
+attrs: active, checked
**Why this matters:**
- Instantly see what changed after each action
- Identify new elements that appeared (e.g., success messages, modals)
- Track attribute changes (checked, disabled, aria-expanded)
- Debug failed assertions by understanding actual DOM state changes
**No Plugin Shortcut** - Automatic feature in all browser commands
**该功能的价值:**
- 即时查看每次操作后的页面变化
- 识别新增元素(如成功提示、弹窗)
- 跟踪属性变化(如checked、disabled、aria-expanded)
- 通过了解实际DOM状态变化调试断言失败问题
**无插件快捷方式** - 所有浏览器命令自动包含此功能CI/CD Integration
CI/CD集成
Running Tests in CI
在CI中运行测试
Environment Variables:
bash
export QA_USE_API_KEY="your-api-key"
export QA_USE_REGION="us" # Optional: "us" or "auto"Basic Test Execution:
bash
undefined环境变量配置:
bash
export QA_USE_API_KEY="your-api-key"
export QA_USE_REGION="us" # 可选值:"us" 或 "auto"基础测试执行:
bash
undefinedRun all tests
运行所有测试用例
qa-use test run --all
qa-use test run --all
Run specific tag
运行指定标签的测试用例
qa-use test run --tag smoke
qa-use test run --tag smoke
Exit codes: 0 = pass, 1 = fail
退出码:0=通过,1=失败
undefinedundefinedGitHub Actions Example
GitHub Actions示例
yaml
name: QA Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '20'
- name: Install qa-use
run: npm install -g @desplega.ai/qa-use
- name: Run tests
run: qa-use test run --all
env:
QA_USE_API_KEY: ${{ secrets.QA_USE_API_KEY }}yaml
name: QA Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '20'
- name: Install qa-use
run: npm install -g @desplega.ai/qa-use
- name: Run tests
run: qa-use test run --all
env:
QA_USE_API_KEY: ${{ secrets.QA_USE_API_KEY }}Test Artifacts
测试产物
Screenshots:
- Automatically saved on failure
- Location: (local) or cloud (remote)
/tmp/qa-use/downloads/
Logs:
- Console logs:
qa-use browser logs console -s <session-id> - Network logs:
qa-use browser logs network -s <session-id>
截图:
- 测试失败时自动保存
- 存储位置:本地为,远程为云端
/tmp/qa-use/downloads/
日志:
- 控制台日志:
qa-use browser logs console -s <session-id> - 网络日志:
qa-use browser logs network -s <session-id>
Advanced Topics
进阶主题
Localhost Testing (Tunnel Mode)
本地测试(隧道模式)
When to use tunnel mode:
Testing localhost (http://localhost:3000)?
├─ YES → Use --tunnel
│ └─ qa-use browser create --tunnel [--no-headless]
│ (Starts local Playwright, creates localtunnel, keeps running)
│
└─ NO (Public URL) → Use remote browser (default)
└─ qa-use browser create
(Uses desplega.ai cloud browser via WebSocket)The flag is a binary choice:
--tunnel- Local tunnel mode: Playwright on your machine + localtunnel
- Remote mode: WebSocket URL to cloud-hosted browser
For test execution:
bash
undefined何时使用隧道模式:
是否测试本地服务(http://localhost:3000)?
├─ 是 → 使用--tunnel参数
│ └─ qa-use browser create --tunnel [--no-headless]
│ (启动本地Playwright,创建localtunnel,保持运行)
│
└─ 否(公网URL) → 使用远程浏览器(默认)
└─ qa-use browser create
(通过WebSocket连接desplega.ai云端浏览器)--tunnel- 本地隧道模式:本地机器运行Playwright + localtunnel
- 远程模式:通过WebSocket URL连接云端托管的浏览器
测试执行场景:
bash
undefinedLocal app
本地应用
qa-use test run my_test --tunnel [--headful]
qa-use test run my_test --tunnel [--headful]
Public app
公网应用
qa-use test run my_test
**Plugin shortcuts handle tunnel detection automatically:**/qa-use:explore http://localhost:3000
/qa-use:record start local_test
See [references/localhost-testing.md](references/localhost-testing.md) for troubleshooting.qa-use test run my_test
**插件快捷方式会自动检测隧道需求:**/qa-use:explore http://localhost:3000
/qa-use:record start local_test
故障排查请参考[references/localhost-testing.md](references/localhost-testing.md)。Session Persistence
会话持久化
Sessions are stored in and have:
~/.qa-use.json- TTL: 30 minutes (default)
- Auto-resolve: One active session = no flag needed
-s - Cleanup: Automatic on timeout or explicit
browser close
会话存储在文件中,具备以下特性:
~/.qa-use.json- TTL(存活时间):默认30分钟
- 自动解析:仅存在一个活跃会话时,无需使用参数指定
-s - 自动清理:超时或执行命令时自动清理
browser close
Block Limitations
Blocks的限制
What's captured:
- goto, click, fill, type, check, uncheck, select, hover
- scroll, scroll-into-view, drag, upload, press
What's NOT captured:
- Assertions (must be added manually)
- Waits (inferred from timing, may need adjustment)
- Complex interactions (multi-drag, hover sequences)
Manual editing: Edit generated YAML to add assertions and refine selectors.
支持捕获的操作:
- goto、click、fill、type、check、uncheck、select、hover
- scroll、scroll-into-view、drag、upload、press
不支持捕获的操作:
- 断言(需手动添加)
- 等待操作(可从时间推断,可能需要调整)
- 复杂交互(如多步拖拽、连续悬停)
手动编辑: 可编辑生成的YAML文件添加断言并优化选择器。
WebSocket Sessions
WebSocket会话
Sharing sessions across processes:
bash
undefined跨进程共享会话:
bash
undefinedProcess 1: Create session
进程1:创建会话
qa-use browser create --tunnel
qa-use browser create --tunnel
Output: ws://localhost:12345/browser/abc123
输出:ws://localhost:12345/browser/abc123
Process 2: Connect to session
进程2:连接到已有会话
qa-use browser goto https://example.com --ws-url ws://localhost:12345/browser/abc123
undefinedqa-use browser goto https://example.com --ws-url ws://localhost:12345/browser/abc123
undefinedDeep-Dive References
深度参考文档
| Document | Description |
|---|---|
| browser-commands.md | Complete browser CLI reference with all flags |
| test-format.md | Full test YAML specification |
| localhost-testing.md | Tunnel setup for local development |
| failure-debugging.md | Failure classification and diagnostics |
| ci.md | CI/CD integration patterns and examples |
| 文档 | 描述 |
|---|---|
| browser-commands.md | 完整的浏览器CLI命令参考及所有参数说明 |
| test-format.md | 完整的测试用例YAML规范 |
| localhost-testing.md | 本地开发环境测试的隧道设置指南 |
| failure-debugging.md | 失败场景分类与诊断指南 |
| ci.md | CI/CD集成模式与示例 |
Templates
模板
| Template | Description |
|---|---|
| basic-test.yaml | Simple navigation and assertion |
| auth-flow.yaml | Login flow with credentials |
| form-test.yaml | Form submission with validation |
| 模板 | 描述 |
|---|---|
| basic-test.yaml | 简单的导航与断言测试用例 |
| auth-flow.yaml | 带凭证的登录流程测试用例 |
| form-test.yaml | 表单提交与验证测试用例 |
Test Format Overview
测试用例格式概述
yaml
name: Login Test
description: Validates login functionality with valid credentials
tags:
- smoke
- auth
app_config: <app-config-id>
variables:
email: test@example.com
password: secret123
depends_on: setup-test # Optional
steps:
- action: goto
url: /login
- action: fill
target: email input
value: $email
- action: click
target: login button
- action: to_be_visible
target: dashboardSee references/test-format.md for complete specification.
yaml
name: Login Test
description: Validates login functionality with valid credentials
tags:
- smoke
- auth
app_config: <app-config-id>
variables:
email: test@example.com
password: secret123
depends_on: setup-test # 可选
steps:
- action: goto
url: /login
- action: fill
target: email input
value: $email
- action: click
target: login button
- action: to_be_visible
target: dashboard完整规范请参考references/test-format.md。
Common Mistakes
常见错误
| ❌ Wrong | ✅ Correct |
|---|---|
| |
| |
| |
| Guessing element refs | Always |
Testing localhost without | Use |
| |
| |
| ❌ 错误用法 | ✅ 正确用法 |
|---|---|
| |
| |
| |
| 猜测元素引用 | 始终先执行 |
测试本地服务未使用 | 使用 |
| |
| |
npx Alternative
npx替代方案
All commands use assuming global install. For one-off use:
qa-usebash
npx @desplega.ai/qa-use browser <command>假设已全局安装qa-use,所有命令使用前缀。如需一次性使用:
qa-usebash
npx @desplega.ai/qa-use browser <command>