write-ui-tests
БесплатноБез исполняемых скриптовНе проверенCreates UI tests for a GitHub issue and verifies they reproduce the bug. Iterates until tests actually fail (proving they catch the issue). Use when PR lacks…
от dotnet★ 23 319 звёзд на GitHubОб этом скилле
Write UI Tests Skill
Creates UI tests that reproduce a GitHub issue, following .NET MAUI conventions. Verifies the tests actually fail before completing.
🛑 BLOCKING REQUIREMENT
YOU CANNOT COMPLETE THIS SKILL UNTIL TESTS FAIL.
A test that passes does NOT prove it catches the bug. You MUST:
- Run tests and observe them FAIL
- If tests pass, iterate on test code until they fail
- Never report "done" with passing tests
If tests keep passing after 3 iterations:
- STOP and ask user: "Tests are passing but they should fail to prove they catch the bug. The test scenario may not correctly reproduce the issue. Should I try a different approach?"
Common mistakes that lead to passing tests:
- Test scenario doesn't match issue reproduction steps
- Checking wrong element or property
- Bug only manifests on specific platform (try different platform)
- Bug requires specific timing or async behavior not captured
- Issue description is incomplete - may need to ask user for clarification
When to Use
- ✅ PR has no tests and needs them
- ✅ Issue needs a reproduction test before fixing
- ✅ Existing tests don't adequately cover the bug
Required Input
Before invoking, ensure you have:
- Issue number (e.g., 33331)
- Issue description or reproduction steps
- Platforms affected (iOS, Android, Windows, MacCatalyst)
Platform selection guidance:
- Start with the platform mentioned in the issue (often in title or labels)
- If issue says "iOS" or has
platform/iOSlabel → test on iOS first - If issue says "Android" or has
platform/Androidlabel → test on Android first - If issue affects "All" platforms → start with Android (faster emulator boot)
- If test passes on one platform, try another before concluding test is wrong
Workflow
Step 1: Read the UI Test Guidelines
cat .github/instructions/uitests.instructions.md
This contains the authoritative conventions for:
- File naming (
IssueXXXXX.csfor C#-only, orIssueXXXXX.xaml/.xaml.csfor XAML) - File locations (
TestCases.HostApp/Issues/,TestCases.Shared.Tests/Tests/Issues/) - Required attributes (
[Issue()],[Category()]) - Test patterns and assertions
Step 2: Create HostApp Page
Location: src/Controls/tests/TestCases.HostApp/Issues/IssueXXXXX.cs
namespace Maui.Controls.Sample.Issues;
[Issue(IssueTracker.Github, XXXXX, "Brief description of issue", PlatformAffected.All)]
public partial class IssueXXXXX : ContentPage
{
public IssueXXXXX()
{
// Create UI that reproduces the issue
var button = new Button
{
Text = "Test Button",
AutomationId = "TestButton" // Required for Appium
};
var resultLabel = new Label
{
Text = "Waiting...",
AutomationId = "ResultLabel"
};
button.Clicked += (s, e) =>
{
resultLabel.Text = "Success";
};
Content = new VerticalStackLayout
{
Children = { button, resultLabel }
};
}
}
Key requirements:
- Add
AutomationIdto all interactive elements - Use
[Issue()]attribute with tracker, number, description, platform - Keep UI minimal - just enough to reproduce the bug
Note: XAML is optional. C#-only pages (as shown above) are simpler and preferred for most test scenarios. Use XAML only when the bug specifically relates to XAML parsing or markup behavior.
Step 3: Create NUnit Test
Location: src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/IssueXXXXX.cs
namespace Microsoft.Maui.TestCases.Tests.Issues;
public class IssueXXXXX : _IssuesUITest
{
public override string Issue => "Brief description matching HostApp";
public IssueXXXXX(TestDevice device) : base(device) { }
[Test]
[Category(UITestCategories.Button)] // Pick ONE appropriate category
public void ButtonClickUpdatesLabel()
{
// Wait for element to be ready
App.WaitForElement("TestButton");
// Interact with the UI
App.Tap("TestButton");
// Verify expected behavior
var labelText = App.FindElement("ResultLabel").GetText();
Assert.That(labelText, Is.EqualTo("Success"));
}
}
Key requirements:
- Inherit from
_IssuesUITest - Use same
AutomationIdvalues as HostApp - Add ONE
[Category()]attribute (checkUITestCategories.csfor options) - Use
App.WaitForElement()before interactions
Step 4: Verify Files Compile
# For Android
dotnet build src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj -c Debug -f net10.0-android --no-restore -v q
# For iOS
dotnet build src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj -c Debug -f net10.0-ios --no-restore -v q
# Test project (platform-independent)
dotnet build src/Controls/tests/TestCases.Shared.Tests/Controls.TestCases.Shared.Tests.csproj -c Debug -
Установить write-ui-tests в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл write-ui-tests?
Creates UI tests for a GitHub issue and verifies they reproduce the bug. Iterates until tests actually fail (proving they catch the issue). Use when PR lacks tests or tests need to be created for an issue.
Как установить скилл write-ui-tests?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл write-ui-tests запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic