Skip to main content

xamltest-ui-tests

Write and update WPF UI tests in MaterialDesignThemes.UITests using XAMLTest. Use when template, layout, focus, interaction, or visual behavior needs coverage, or when a reviewer asks to move runtime UI checks out of MaterialDesignThemes.Wpf.Tests.

インストールへ移動

ソース情報

リポジトリ
MaterialDesignInXAML/MaterialDesignInXamlToolkit
ソースの最終更新活動
2026年4月12日 01:02
検出された SKILL.md の言語
英語
スター
16,257
フォーク
3,497

インストール方法

デフォルトでは、最初にソースを確認する Prompt が選択されています。直接コマンドに切り替えるか、ローカルコピーをダウンロードすることもできます。

ソースファイルを確認

インストールを決める前に、SKILL.md と SkillsMP に表示されている付属ファイルをお読みください。

SKILL.md を表示中

SKILL.md
ソースの指示 · 読み取り専用プレビュー
name
xamltest-ui-tests
description
Write and update WPF UI tests in MaterialDesignThemes.UITests using XAMLTest. Use when template, layout, focus, interaction, or visual behavior needs coverage, or when a reviewer asks to move runtime UI checks out of MaterialDesignThemes.Wpf.Tests.
# XAMLTest UI tests Use this skill when working on runtime WPF behavior in this repository. ## When to use it - A change touches templates, visual states, focus behavior, layout, coordinates, or input handling. - You need to inspect named template parts such as `PART_TextBox` or `PART_IncreaseButton`. - A reviewer asks to use XAMLTest instead of regular unit tests. - You need to assert WPF-only properties like `Padding`, `Visibility`, `ActualWidth`, or `DataContext` state after layout. ## Repository-specific rules 1. Put runtime UI behavior tests in `tests/MaterialDesignThemes.UITests`. 2. Do **not** add visual-tree or layout interaction tests to `tests/MaterialDesignThemes.Wpf.Tests`. 3. Prefer extending the existing feature file under `tests/MaterialDesignThemes.UITests/WPF/<feature>/` instead of creating a generic catch-all test file. 4. Match the existing file's result-recording pattern; many current UI tests use `TestRecorder`, but it should not be treated as a blanket requirement. 5. Ask permission before running UI tests, and only run the affected ones. ## Standard pattern 1. Inherit from `TestBase`. 2. Use `LoadXaml<T>()` for focused control scenarios. 3. Use `LoadUserControl<T>()` when you need a sample view model, bindings, or additional focus targets. 4. Get named parts with `GetElement<T>("PART_Name")`. 5. Use `RemoteExecute` with static methods for properties that helpers do not expose directly. 6. Use `Wait.For(...)` for layout-sensitive assertions. ## What to prefer - `GetCoordinates()` for alignment and spacing assertions. - `RemoteExecute` for `Padding`, `Visibility`, `ActualWidth`, `Margin`, or `DataContext` inspection. - Keyboard and mouse helpers such as `MoveKeyboardFocus`, `SendKeyboardInput`, and `LeftClick` for interaction. ## What to avoid - Inspecting the visual tree from `MaterialDesignThemes.Wpf.Tests` for runtime template behavior. - Overly broad UI suites when a single targeted XAMLTest scenario will do. - Repeating helper code inline when a small static local or private helper method is enough. ## Example ```csharp [Test] public async Task DecimalUpDown_WithMaximum_DisablesPlusButton() { await using var recorder = new TestRecorder(App); var decimalUpDown = await LoadXaml<DecimalUpDown>(""" <materialDesign:DecimalUpDown Value="1" Maximum="2" /> """); var plusButton = await decimalUpDown.GetElement<RepeatButton>("PART_IncreaseButton"); var textBox = await decimalUpDown.GetElement<TextBox>("PART_TextBox"); await plusButton.LeftClick(); await Wait.For(async () => { await Assert.That(await textBox.GetText()).IsEqualTo("2"); await Assert.That(await decimalUpDown.GetValue()).IsEqualTo(2); }); await Assert.That(await plusButton.GetIsEnabled()).IsFalse(); recorder.Success(); } ``` ## Useful local references - `tests/MaterialDesignThemes.UITests/TestBase.cs` - `tests/MaterialDesignThemes.UITests/XamlTestExtensions.cs` - Existing feature tests under `tests/MaterialDesignThemes.UITests/WPF/`
GitHubで見る