windows-desktop-e2e
БесплатноБез исполняемых скриптовНе проверенE2E testing for Windows native desktop apps (WPF, WinForms, Win32/MFC, Qt) using pywinauto and Windows UI Automation.
от tensology★ 17 звёзд на GitHubОб этом скилле
Windows デスクトップ E2E テスト
pywinauto と Windows UI Automation(UIA)を使用したWindowsネイティブデスクトップアプリケーションのエンドツーエンドテスト。WPF、WinForms、Win32/MFC、Qt(5.x / 6.x)をカバーし、Qt固有のガイダンスは専用セクションとして提供します。
アクティベートするタイミング
- Windowsネイティブデスクトップアプリケーションのエンドツーエンドテストを書くまたは実行するとき
- デスクトップGUIテストスイートをゼロから設定するとき
- 不安定または失敗するデスクトップオートメーションテストを診断するとき
- 既存のアプリにテスタビリティ(AutomationId、アクセシブルな名前)を追加するとき
- デスクトップエンドツーエンドをCI/CDパイプライン(GitHub Actions
windows-latest)に統合するとき
使用しないタイミング
- Webアプリケーション →
e2e-testingスキル(Playwright)を使用する - Electron / CEF / WebView2 アプリ → HTMLレイヤーにはUIAではなくブラウザオートメーションが必要
- モバイルアプリ → プラットフォーム固有のツールを使用する(UIAutomator、XCUITest)
- 実行中のGUIを必要としない純粋なユニットまたは統合テスト
コアコンセプト
すべてのWindowsデスクトップオートメーションは**UI Automation(UIA)**に依存します。これはWindowsに組み込まれたアクセシビリティAPIです。サポートされているすべてのフレームワークは、読み取りおよび操作可能なプロパティを持つUIA要素のツリーを公開します:
テスト(Python)
└── pywinauto(UIAバックエンド)
└── Windows UI Automation API ← Windowsに組み込み、フレームワーク非依存
└── アプリのUIAプロバイダー ← 各フレームワークが独自に実装
└── 実行中の .exe
フレームワーク別UIA品質:
| フレームワーク | AutomationId | 信頼性 | 注記 |
|---|---|---|---|
| WPF | ★★★★★ | 優秀 | x:Name が直接AutomationIdにマッピング |
| WinForms | ★★★★☆ | 良好 | AccessibleName = AutomationId |
| UWP / WinUI 3 | ★★★★★ | 優秀 | Microsoftの完全サポート |
| Qt 6.x | ★★★★★ | 優秀 | アクセシビリティがデフォルトで有効;クラス名が Qt6* に変更 |
| Qt 5.15+ | ★★★★☆ | 良好 | Accessibilityモジュールが改善 |
| Qt 5.7–5.14 | ★★★☆☆ | 普通 | QT_ACCESSIBILITY=1 が必要;objectNameは手動設定 |
| Win32 / MFC | ★★★☆☆ | 普通 | コントロールIDにアクセス可能;テキストマッチングが一般的 |
セットアップと前提条件
# Python 3.8+、Windowsのみ
pip install pywinauto pytest pytest-html Pillow pytest-timeout
# オプション:画面録画
# ffmpegをインストールしてPATHに追加:https://ffmpeg.org/download.html
UIAが到達可能か確認:
from pywinauto import Desktop
Desktop(backend="uia").windows() # すべてのトップレベルウィンドウを一覧表示
Accessibility Insights for Windowsをインストールしてください(Microsoft提供、無料)— テストを書く前にUIA要素ツリーを検査するためのDevTools相当のツールです。
テスタビリティのセットアップ(フレームワーク別)
テストを書く前に全てのインタラクティブなコントロールに安定したAutomationIdを設定することが最も効果的です。
WPF
<!-- XAML: x:Name が自動的にAutomationIdになる -->
<TextBox x:Name="usernameInput" />
<PasswordBox x:Name="passwordInput" />
<Button x:Name="btnLogin" Content="Login" />
<TextBlock x:Name="lblError" />
WinForms
// デザイナーまたはコードで設定
usernameInput.AccessibleName = "usernameInput";
passwordInput.AccessibleName = "passwordInput";
btnLogin.AccessibleName = "btnLogin";
lblError.AccessibleName = "lblError";
Win32 / MFC
// .rcファイルのコントロールリソースIDがAutomationId文字列として公開される
// IDC_EDIT_USERNAME -> AutomationId "1001"
// 名前にはSetWindowTextを優先;より豊かなサポートにはIAccessibleを追加する
Qt — 以下の専用セクションを参照
ページオブジェクトモデル
tests/
├── conftest.py # アプリ起動フィクスチャ、失敗時スクリーンショット
├── pytest.ini
├── config.py
├── pages/
│ ├── __init__.py # インポートに必須
│ ├── base_page.py # ロケーター、ウェイト、スクリーンショットヘルパー
│ ├── login_page.py
│ └── main_page.py
├── tests/
│ ├── __init__.py
│ ├── test_login.py
│ └── test_main_flow.py
└── artifacts/ # スクリーンショット、動画、ログ
base_page.py
import os, time
from pywinauto import Desktop
from config import ACTION_TIMEOUT, ARTIFACT_DIR
class BasePage:
def __init__(self, window):
self.window = window
# --- ロケーター(優先順位順)---
def by_id(self, auto_id, **kw):
"""AutomationId — 最も安定。第一選択として使用する。"""
return self.window.child_window(auto_id=auto_id, **kw)
def by_name(self, name, **kw):
"""表示テキスト / アクセシブルな名前。"""
return self.window.child_window(title=name, **kw)
def by_class(self, cls, index=0, **kw):
"""コントロールクラス + インデックス — 脆弱、可能なら避ける。"""
return self.window.child_window(class_name=cls, found_index=index, **kw)
# --- ウェイト ---
def wait_visible(self, spec, timeout=ACTION_TIMEOUT):
spec.wait("visible", timeout=timeout)
return spec
def wait_gone(self, spec, timeout=ACTION_TIMEOUT):
spec.wait_not("visible", timeout=timeout)
return spec
def wait_window(self, title, timeout=ACTION_TIMEOUT):
"""新しいトップレベルウィンドウ(ダイアログ、子ウィンドウ)を待つ。"""
dlg = Desktop(backend="uia").window(title=title)
dlg.wait("visible", timeout=timeout)
return dlg
def wait_until(self, fn, timeout=ACTION_TIMEOUT, interval=0.3):
"""任意の条件をポーリング — UIAイベントが信頼できない場合に使用する。"""
deadline = time.time() + timeout
while time.time() < deadline:
try:
if fn():
return True
except Exception:
pass
time.sleep(interval)
raise TimeoutError(f"条件が{timeout}秒以内に満たされなかった")
# --- アクション ---
def click(self, spec):
self.wait_visible(spec)
spec.click_input()
def type_text(self, spec, text):
self.wait_visible(spec)
ctrl = spec.wrapper_object()
try:
ctrl.set_edit_text(text)
except Exception as e:
# Qt 5.x フォールバック:UIA Value Pattern が不完全な場合がある
Установить windows-desktop-e2e в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл windows-desktop-e2e?
E2E testing for Windows native desktop apps (WPF, WinForms, Win32/MFC, Qt) using pywinauto and Windows UI Automation.
Как установить скилл windows-desktop-e2e?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл windows-desktop-e2e запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
от Anthropicwebapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
от Anthropicbrand-guidelines
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
от Anthropicweb-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…
от Anthropic