flutter-skill-testing
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseFlutter Skill — AI E2E Testing
Flutter Skill — AI 端到端测试
Give your AI agent eyes and hands inside any running app.
为你的AI Agent赋予在运行中应用内的“眼睛”和“双手”。
Description
说明
This skill teaches you how to use flutter-skill to perform end-to-end testing on running applications across 8 platforms: Flutter, iOS, Android, Web, Electron, Tauri, KMP Desktop, React Native, and .NET MAUI.
flutter-skill is an MCP server that connects AI agents to running apps via a bridge protocol. The agent can see screenshots, tap elements, enter text, scroll, navigate, and verify UI state — all without writing test code.
本Skill将教你如何使用flutter-skill对8大平台的运行中应用执行端到端测试,支持平台包括:Flutter、iOS、Android、Web、Electron、Tauri、KMP Desktop、React Native和.NET MAUI。
flutter-skill是一款MCP服务器,通过桥接协议将AI Agent与运行中的应用连接起来。Agent可以查看截图、点击元素、输入文本、滚动、导航以及验证UI状态——全程无需编写测试代码。
Install
安装
bash
npm install -g flutter-skillbash
npm install -g flutter-skillMCP Configuration
MCP配置
Add to your MCP config (Claude Desktop, Cursor, Windsurf, etc.):
json
{
"mcpServers": {
"flutter-skill": {
"command": "flutter-skill",
"args": ["server"]
}
}
}将以下内容添加到你的MCP配置文件中(适用于Claude Desktop、Cursor、Windsurf等):
json
{
"mcpServers": {
"flutter-skill": {
"command": "flutter-skill",
"args": ["server"]
}
}
}Available Tools
可用工具
| Tool | Description |
|---|---|
| Capture current screen state |
| Tap an element by key or text |
| Type text into a field |
| Scroll in any direction |
| Navigate back |
| Inspect element details |
| Wait for element to appear |
| List all interactive elements |
| Swipe gesture |
| Long press an element |
| Drag from one point to another |
| Replace text in a field |
| Clear a text field |
| 工具 | 描述 |
|---|---|
| 捕获当前屏幕状态 |
| 通过元素键或文本点击元素 |
| 在输入框中输入文本 |
| 向任意方向滚动 |
| 返回上一级页面 |
| 查看元素详细属性 |
| 等待元素出现 |
| 列出所有可交互元素 |
| 执行滑动手势 |
| 长按元素 |
| 将元素从一个点拖拽到另一个点 |
| 替换输入框中的文本 |
| 清空输入框内容 |
How to Test an App
测试应用的步骤
Step 1: Launch the app
步骤1:启动应用
bash
flutter-skill launch /path/to/your/appbash
flutter-skill launch /path/to/your/appStep 2: Ask your AI agent to test it
步骤2:让AI Agent执行测试
Just describe what to test in natural language:
"Test the login flow — enter test@example.com and password123, tap Login, verify Dashboard appears"
The agent will:
- → see the current screen
screenshot() - → type email
enter_text("email", "test@example.com") - → type password
enter_text("password", "password123") - → tap the button
tap("Login") - → verify navigation
wait_for_element("Dashboard") - → confirm final state
screenshot()
只需用自然语言描述测试需求即可:
"测试登录流程——输入test@example.com和password123,点击登录按钮,验证是否跳转到Dashboard页面"
Agent会执行以下操作:
- → 查看当前屏幕内容
screenshot() - → 输入邮箱
enter_text("email", "test@example.com") - → 输入密码
enter_text("password", "password123") - → 点击登录按钮
tap("Login") - → 验证页面跳转
wait_for_element("Dashboard") - → 确认最终状态
screenshot()
Step 3: Complex testing
步骤3:复杂测试场景
For comprehensive testing, describe the full flow:
"Explore every screen of this app. Test all buttons, forms, navigation, and edge cases. Report any bugs."
The agent will systematically navigate every screen, interact with every element, and report findings.
如需全面测试,可描述完整的测试流程:
"遍历应用的所有页面,测试所有按钮、表单、导航功能以及边缘场景,报告发现的所有Bug。"
Agent会系统性地导航每个页面,与所有元素交互,并提交测试结果。
Best Practices
最佳实践
- Always start with — see what's on screen before acting
screenshot() - Use after navigation — apps need time to transition
wait_for_element() - Use when unsure — discover available interactive elements
get_elements() - Take screenshots after actions — verify the action had the expected effect
- Use element keys when available — more reliable than text matching
- 始终以开头 —— 在执行操作前先查看当前屏幕内容
screenshot() - 页面跳转后使用—— 应用需要时间完成页面过渡
wait_for_element() - 不确定元素时使用—— 发现所有可用的可交互元素
get_elements() - 操作后截取屏幕 —— 验证操作是否达到预期效果
- 优先使用元素键 —— 比文本匹配更可靠
Supported Platforms
支持的平台
| Platform | SDK Setup |
|---|---|
| Flutter | |
| iOS (Swift) | Add |
| Android (Kotlin) | Add |
| React Native | |
| Electron | |
| Tauri | |
| KMP Desktop | Add Gradle dependency |
| .NET MAUI | Add NuGet package |
| 平台 | SDK配置 |
|---|---|
| Flutter | |
| iOS (Swift) | 添加 |
| Android (Kotlin) | 添加 |
| React Native | |
| Electron | |
| Tauri | |
| KMP Desktop | 添加Gradle依赖 |
| .NET MAUI | 添加NuGet包 |