flutter-mobile-automation
БесплатноБез исполняемых скриптовНе проверенFlutterアプリのE2Eテストとモバイル自動化の知見。Maestro、Mobile MCP、Dart MCPを使用したテスト作成・実行時に使用。
от K9i-0★ 20 звёзд на GitHubОб этом скилле
Flutter Mobile Automation
E2Eテスト自動化と開発ワークフロー自動化の両方をカバー。
推奨構成: Maestro MCP + Dart MCP
FlutterアプリのE2Eテストと開発自動化には Maestro MCP + Dart MCP の組み合わせが最適。
Dart MCP vs CLI 使い分け
原則: DTD接続が必要な操作はMCP、それ以外はCLI
MCP推奨(CLIで代替不可)
| 操作 | ツール | 理由 |
|---|---|---|
| アプリ起動 | launch_app |
DTD URI取得が必要 |
| DTD接続 | connect_dart_tooling_daemon |
MCP専用 |
| ホットリロード | hot_reload |
DTD経由で実行 |
| ホットリスタート | hot_restart |
DTD経由で実行 |
| ウィジェットツリー | get_widget_tree |
DTD経由でのみ取得可能 |
| ランタイムエラー | get_runtime_errors |
DTD経由でのみ取得可能 |
| アプリログ | get_app_logs |
起動中アプリのログ取得 |
CLI推奨(MCPより効率的)
| 操作 | CLI コマンド | 理由 |
|---|---|---|
| デバイス一覧 | flutter devices |
出力がシンプル |
| テスト実行 | flutter test |
出力が見やすい、オプション豊富 |
| 静的解析 | dart analyze |
出力が見やすい |
| フォーマット | dart format . |
高速、差分表示 |
| 依存関係追加 | flutter pub add <pkg> |
インタラクティブ |
| 依存関係取得 | flutter pub get |
高速 |
| プロジェクト作成 | flutter create |
オプション豊富 |
| ビルド | flutter build ios/apk |
詳細な出力 |
典型的なワークフロー
# 1. CLI: ビルド・インストール
flutter build ios --simulator
xcrun simctl install booted build/ios/iphonesimulator/Runner.app
# 2. MCP: アプリ起動・DTD接続
# → launch_app → connect_dart_tooling_daemon
# 3. MCP: 開発中のデバッグ
# → get_widget_tree, get_runtime_errors, hot_reload
# 4. CLI: テスト・解析
flutter test
dart analyze
ツール概要
Maestro / Maestro MCP
- Flutter第一級サポートのE2Eテストフレームワーク
- CLI: YAMLでテストを記述 (
maestro test .maestro/test.yaml) - MCP: Claude Codeから対話的に操作(YAML不要)
- スクリーンショット取得
- タップ操作(テキスト/id指定、座標計算不要)
- view hierarchy取得
Dart MCP Server
- Flutter開発連携用MCPサーバー
- ウィジェットツリー取得(Flutter内部構造)
- ホットリロード/リスタート
- ランタイムエラー取得
Mobile MCP(参考)
- Maestro MCPで代替可能なため通常は不要
- 座標ベースの操作が必要な特殊ケースでのみ使用
Claude Code セットアップ
推奨設定(.claude/settings.json)
プロジェクト共通の許可設定はリポジトリに含めて共有:
{
"permissions": {
"allow": [
"Bash(flutter:*)",
"Bash(dart:*)",
"Bash(adb:*)",
"Bash(xcrun simctl:*)",
"Bash(maestro:*)",
"Bash(MAESTRO_DRIVER_STARTUP_TIMEOUT=* maestro:*)",
"Bash(git:*)",
"Bash(gh:*)",
"WebSearch",
"WebFetch(domain:github.com)",
"WebFetch(domain:docs.maestro.dev)",
"mcp__dart-mcp__*",
"mcp__maestro__*"
]
}
}
ローカル設定(.claude/settings.local.json)
ユーザー固有の設定は.gitignoreに追加してローカルのみ:
{
"permissions": {
"additionalDirectories": [
"/Users/<user>/.maestro/tests"
]
}
}
Maestroテスト出力ディレクトリ
Maestro CLIはテスト結果を~/.maestro/tests/に出力する。
Claude Codeでエラーログを確認するには、このディレクトリを追加:
# Claude Codeで以下を実行
/add-dir ~/.maestro/tests
または.claude/settings.local.jsonに追加:
{
"permissions": {
"additionalDirectories": [
"/Users/<user>/.maestro/tests"
]
}
}
Maestro CLI プラットフォーム選択
推奨: iOSシミュレーター
Maestro CLIはiOSシミュレーターでの実行を推奨。
| プラットフォーム | launchApp | 安定性 | 備考 |
|---|---|---|---|
| iOS 18.x | ✅ | ⭐⭐⭐ | 推奨 |
| Android API 30 | ⚠️ | ⭐ | 初回のみ動作、以降不安定 |
| Android API 34+ | ❌ | - | TCP forwarding / timeout エラー |
既知の問題(Maestro 2.0.10)
- Issue #2839: launchAppが最初の1回しか動作しない
- Issue #1927: Maestro Studio起動中はlaunchApp失敗
iOS E2Eテスト実行
# iOSシミュレーター起動
xcrun simctl boot "iPhone 16 Pro"
# iOSアプリビルド・インストール
flutter build ios --simulator
xcrun simctl install booted build/ios/iphonesimulator/Runner.app
# テスト実行(タイムアウト増加推奨)
MAESTRO_DRIVER_STARTUP_TIMEOUT=120000 \
maestro --device "<DEVICE_ID>" \
test -e APP_ID=com.example.flutterE2eInvestigation \
.maestro/test.yaml
Bundle ID の違い
iOS/Androidでbundle IDが異なる場合、環境変数で切り替え:
# .maestro/test.yaml
appId: ${APP_ID}
---
- launchApp:
clearState: true
# iOS
maestro test -e APP_ID=com.example.flutterE2eInvestigation .maestro/test.yaml
# Android
maestro test -e APP_ID=com.example.flutter_e2e_investigation .maestro/test.yaml
Flutterビルドモードの使い分け
ビルドモード比較
| モード | 用途 | ホットリロード | パフォーマンス |
|---|---|---|---|
| debug | 機能開発・iOSテスト | ✅ | 低速 |
| profile | パフォーマンス計測 | ❌ | 高速 |
| release | 本番 | ❌ | 最速 |
ビルドコマンド
# 機能開発用・iOSテスト(debug)
flutter run
flutter build ios --simulator
# パフォーマンス計測(profile)- Androidのみ
flutter build apk --profile
# 本番用(release)
flutter build apk --release
flutter build ios --release
ワークフロー推奨
開発中:
debug ビルド → Dart MCP で起動 → hot reload で変更反映
E2Eテスト:
iOS シミュレーター → debug ビルド → Maestro CLI でテスト実行
Maestro + Flutter ベストプラクティス
Semanticsウィジェットの活用
Maestroは要素をセマンティクス情報で認識する。FlutterではSemanticsウィジェットでアクセシビリティ情報を提供:
// ラベルで識別可能にする
Semantics(
label: 'submit-button',
child: ElevatedButton(
onPressed: _submit,
child: Text('Submit'),
),
)
// identifier属性を使用(Flutter 3.19+)
Semantics(
identifier: 'login-button',
child: ElevatedButton(...),
)
Maestroでの要素指定
# tooltipテキストで認識(FloatingActionButtonなど)
- tapOn: "Increment"
#
Установить flutter-mobile-automation в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл flutter-mobile-automation?
FlutterアプリのE2Eテストとモバイル自動化の知見。Maestro、Mobile MCP、Dart MCPを使用したテスト作成・実行時に使用。
Как установить скилл flutter-mobile-automation?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл flutter-mobile-automation запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic