flutter-skill-testing

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Flutter 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-skill
bash
npm install -g flutter-skill

MCP 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

可用工具

ToolDescription
screenshot
Capture current screen state
tap
Tap an element by key or text
enter_text
Type text into a field
scroll
Scroll in any direction
go_back
Navigate back
get_element_properties
Inspect element details
wait_for_element
Wait for element to appear
get_elements
List all interactive elements
swipe
Swipe gesture
long_press
Long press an element
drag
Drag from one point to another
set_text
Replace text in a field
clear_text
Clear a text field
工具描述
screenshot
捕获当前屏幕状态
tap
通过元素键或文本点击元素
enter_text
在输入框中输入文本
scroll
向任意方向滚动
go_back
返回上一级页面
get_element_properties
查看元素详细属性
wait_for_element
等待元素出现
get_elements
列出所有可交互元素
swipe
执行滑动手势
long_press
长按元素
drag
将元素从一个点拖拽到另一个点
set_text
替换输入框中的文本
clear_text
清空输入框内容

How to Test an App

测试应用的步骤

Step 1: Launch the app

步骤1:启动应用

bash
flutter-skill launch /path/to/your/app
bash
flutter-skill launch /path/to/your/app

Step 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:
  1. screenshot()
    → see the current screen
  2. enter_text("email", "test@example.com")
    → type email
  3. enter_text("password", "password123")
    → type password
  4. tap("Login")
    → tap the button
  5. wait_for_element("Dashboard")
    → verify navigation
  6. screenshot()
    → confirm final state
只需用自然语言描述测试需求即可:
"测试登录流程——输入test@example.com和password123,点击登录按钮,验证是否跳转到Dashboard页面"
Agent会执行以下操作:
  1. screenshot()
    → 查看当前屏幕内容
  2. enter_text("email", "test@example.com")
    → 输入邮箱
  3. enter_text("password", "password123")
    → 输入密码
  4. tap("Login")
    → 点击登录按钮
  5. wait_for_element("Dashboard")
    → 验证页面跳转
  6. 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

最佳实践

  1. Always start with
    screenshot()
    — see what's on screen before acting
  2. Use
    wait_for_element()
    after navigation
    — apps need time to transition
  3. Use
    get_elements()
    when unsure
    — discover available interactive elements
  4. Take screenshots after actions — verify the action had the expected effect
  5. Use element keys when available — more reliable than text matching
  1. 始终以
    screenshot()
    开头
    —— 在执行操作前先查看当前屏幕内容
  2. 页面跳转后使用
    wait_for_element()
    —— 应用需要时间完成页面过渡
  3. 不确定元素时使用
    get_elements()
    —— 发现所有可用的可交互元素
  4. 操作后截取屏幕 —— 验证操作是否达到预期效果
  5. 优先使用元素键 —— 比文本匹配更可靠

Supported Platforms

支持的平台

PlatformSDK Setup
Flutter
flutter pub add flutter_skill
+ wrap with
FlutterSkillBinding
iOS (Swift)Add
FlutterSkillSDK
SPM package
Android (Kotlin)Add
flutter-skill-android
dependency
React Native
npm install flutter-skill-react-native
Electron
npm install flutter-skill-electron
Tauri
cargo add flutter-skill-tauri
KMP DesktopAdd Gradle dependency
.NET MAUIAdd NuGet package
平台SDK配置
Flutter
flutter pub add flutter_skill
+ 使用
FlutterSkillBinding
包裹
iOS (Swift)添加
FlutterSkillSDK
SPM包
Android (Kotlin)添加
flutter-skill-android
依赖
React Native
npm install flutter-skill-react-native
Electron
npm install flutter-skill-electron
Tauri
cargo add flutter-skill-tauri
KMP Desktop添加Gradle依赖
.NET MAUI添加NuGet包

Links

相关链接