Agent skill
cherry-pr-test
Test Cherry Studio PRs by checking out the branch, launching the Electron app in debug mode, and running interactive UI tests via CDP.
Install this agent skill to your Project
npx add-skill https://github.com/CherryHQ/cherry-studio/tree/main/.agents/skills/cherry-pr-test
SKILL.md
Cherry Studio PR Test
Automated PR testing workflow for Cherry Studio. Checks out a PR, launches the Electron app with Chrome DevTools Protocol, connects agent-browser, and runs interactive UI + code review tests.
Prerequisites
ghCLI installed and authenticatedagent-browserinstalled (for CDP-based UI testing)pnpminstalled with project dependencies (pnpm install)
Constraints
- Always kill existing Cherry Studio processes before launching a new instance.
- Never leave debug processes running after testing completes.
- Always switch back to the default branch after testing.
- Always show the test report to the user before posting it.
Arguments
$ARGUMENTS may contain:
- A PR number (e.g.,
13955) - A PR URL (e.g.,
https://github.com/CherryHQ/cherry-studio/pull/13955) - Keywords like "latest", "recent" to pick a recent PR
- Empty — list recent PRs and let the user choose
Workflow
Phase 1: Select & Checkout PR
- If no PR number given, list recent open PRs:
bash
gh pr list --repo CherryHQ/cherry-studio --state open --limit 10 \ --json number,title,author,createdAt,headRefName,changedFiles \ --template '{{range .}}#{{.number}} | {{.title}} | by {{.author.login}} | files: {{.changedFiles}} {{end}}' - Ask the user to pick one (or auto-pick if "latest"/"recent").
- View PR details to understand what changed:
bash
gh pr view <NUMBER> --json title,body,headRefName,files - Checkout the PR branch:
bash
gh pr checkout <NUMBER> - Read the key changed files to understand the scope of changes.
Phase 2+3: Static Analysis & Launch App (parallel)
Static analysis and app launch are independent — run them in parallel to save time.
Static Analysis (can run while app is starting)
- TypeScript typecheck (catch type errors early):
bash
pnpm typecheck 2>&1 | grep -E "error TS|exited with code" - Review blocked files: Check if the PR modifies files with
@deprecated/V2 DATA&UI REFACTORINGheaders. These files are blocked for feature changes until v2.0.0. - Scan for common issues:
- Hardcoded strings (should use i18n)
console.logusage (should useloggerService)- Missing type annotations on new public interfaces
Record all findings for the final report.
Launch App
-
Kill any existing Cherry Studio processes (graceful SIGTERM first):
bashpkill -f "cherry-studio.*Electron" 2>/dev/null pkill -f "electron-vite" 2>/dev/null lsof -ti :9222 | xargs kill 2>/dev/null lsof -ti :5173 | xargs kill 2>/dev/null sleep 3 # Escalate to SIGKILL only if processes remain lsof -ti :9222 | xargs kill -9 2>/dev/null lsof -ti :5173 | xargs kill -9 2>/dev/null -
Start in debug mode (includes
--remote-debugging-port=9222):bashnohup pnpm debug > /tmp/cherry-debug.log 2>&1 & -
Wait for startup (typically 20-30s):
bashfor i in $(seq 1 30); do lsof -i :9222 2>/dev/null | grep LISTEN && break sleep 2 done
Phase 4: Connect agent-browser
-
Connect:
bashagent-browser connect 9222If
connectfails, fall back to websocket URL from logs:bashWS_URL=$(grep "DevTools listening" /tmp/cherry-debug.log | sed 's/.*ws:/ws:/') agent-browser --cdp "$WS_URL" navigate http://localhost:5173 -
Verify connection and identify the main page:
bashagent-browser tabYou should see the main Cherry Studio page at
http://localhost:5173/. If multiple tabs are listed, useagent-browser tab <N>to select the main one. -
Handle first-launch scenarios:
- V2 Data Migration Wizard: On the v2 branch (or fresh dev data), the app
may show a migration wizard (
/migrationV2.html) before the main UI. Click through: 介绍(下一步) → 备份(我已备份,开始迁移) → 迁移(确定) → 完成(重启应用). After "重启应用", kill and relaunch the app (the restart button doesn't work in dev mode). - Splash screen: Wait up to 30s for the splash to dismiss.
- V2 Data Migration Wizard: On the v2 branch (or fresh dev data), the app
may show a migration wizard (
-
Create screenshot directory for this PR:
bashmkdir -p /tmp/pr-<NUMBER>Use this directory for all screenshots:
/tmp/pr-<NUMBER>/<descriptive-name>.png
Phase 5: Interactive UI Testing
Based on the PR's changed files, navigate to the relevant pages and test. Use your judgement to decide what to test — the PR description and changed files should guide your testing strategy.
General Approach
- Take a screenshot of the current state
- Use
agent-browser snapshot -ito discover interactive elements - Interact with elements (click, fill, drag, etc.)
- Screenshot and verify the result
- Verify state changes if relevant (via
agent-browser eval)
Key Testing Points
- UI renders correctly: New components appear in the right place
- Interactions work: Toggles, inputs, buttons all function
- State persistence: Changes survive across page navigations
- Theme compatibility: Test in both light and dark modes
- Layout modes: If sidebar/layout is involved, test at different sizes
- i18n: Switch language and verify new strings appear correctly
- Edge cases: Boundary conditions, rapid toggling, empty states
Phase 6: Cleanup
After testing:
-
Kill all Cherry Studio processes (graceful SIGTERM first):
bashpkill -f "cherry-studio.*Electron" 2>/dev/null pkill -f "electron-vite" 2>/dev/null lsof -ti :9222 | xargs kill 2>/dev/null lsof -ti :5173 | xargs kill 2>/dev/null sleep 3 lsof -ti :9222 | xargs kill -9 2>/dev/null lsof -ti :5173 | xargs kill -9 2>/dev/null -
Switch back to the default branch:
bashdefault_branch=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@') git checkout "${default_branch:-main}"
Phase 7: Test Report
Generate a structured report with screenshots. Save the report as
/tmp/pr-<NUMBER>/report.md alongside the screenshots.
# PR #<NUMBER> 测试报告
**PR 标题**: <title>
**作者**: @<author>
**分支**: <branch>
**修改文件数**: <count>
## 静态分析
| 检查项 | 结果 | 说明 |
|--------|------|------|
| TypeScript 类型检查 | ✅/❌ | ... |
| 受阻文件检查 | ✅/⚠️ | ... |
| console.log 使用 | ✅/❌ | ... |
## UI 测试
### <Test Case Name>
<description of what was tested and the result>

## 发现的问题
(if any)
## 结论
- 问题总数:N
- 建议:APPROVE / REQUEST_CHANGES / COMMENT
If the user requests, copy the report directory to a more accessible location (e.g., Desktop) for sharing.
Troubleshooting
Port 9222 not listening after startup
The pnpm debug script passes --remote-debugging-port=9222 to Electron.
If not working:
- Check logs:
tail -50 /tmp/cherry-debug.log - Kill by port:
lsof -ti :9222 | xargs kill -9 - Verify electron-vite is running:
ps aux | grep electron-vite
agent-browser connect fails
Use direct websocket URL:
WS_URL=$(grep "DevTools listening" /tmp/cherry-debug.log | grep 9222 | sed 's/.*\(ws:\/\/[^ ]*\)/\1/')
agent-browser --cdp "$WS_URL" tab
agent-browser target jumps to wrong page
Electron apps have multiple CDP targets (main window + webviews for mini-apps).
If agent-browser connects to a webview instead of the main page:
# List all targets
agent-browser tab
# Switch to the main page (usually tab 0, URL contains localhost:5173)
agent-browser tab 0
After opening/closing mini-apps, always verify you're on the right target
with agent-browser tab.
V2 Data Migration Wizard
On the v2 branch, the app may show a data migration wizard on first launch. This is not a bug — it's expected when dev data hasn't been migrated yet. Click through the wizard steps, then restart the app manually (kill + relaunch). The wizard only appears once; subsequent launches go straight to the main UI.
App stuck on splash screen
Wait longer (up to 30s on first launch). The app needs to:
- Build and serve renderer via Vite dev server (port 5173)
- Run database migrations
- Initialize services (MCP, etc.)
Empty CDP target list
After connecting, if agent-browser tab shows only about:blank:
agent-browser navigate http://localhost:5173
sleep 10
agent-browser tab
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
vercel-react-best-practices
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.
gh-create-pr
Create or update GitHub pull requests using the repository-required workflow and template compliance. Use when asked to create/open/update a PR so the assistant reads `.github/pull_request_template.md`, fills every template section, preserves markdown structure exactly, and marks missing data as N/A or None instead of skipping sections.
create-skill
Create a new skill in the current repository. Use when the user wants to create/add a new skill, or mentions creating a skill from scratch. This skill follows the workflow defined in .agents/skills/README.md and helps scaffold, validate, and sync new skills.
gh-create-issue
Use when user wants to create a GitHub issue for the current repository. Must read and follow the repository's issue template format.
gh-pr-review
Automated code review for local branches, PRs, commits, and files. Supports single-agent review with interactive fix selection, or multi-agent deep review with reviewer-verifier adversarial mechanism and risk-based auto-fix.
prepare-release
Prepare a new release by collecting commits, generating bilingual release notes, updating version files, and creating a release branch with PR. Use when asked to prepare/create a release, bump version, or run `/prepare-release`.
Didn't find tool you were looking for?