maui uitests.instructions.md

A set of guidelines for writing automated UI tests for .NET MAUI, Microsoft's framework for building apps for mobile and desktop platforms.

In plain words
What is it for?
Use it when adding UI tests for features or reported issues, including tests that run on iOS, Android, Windows, or MacCatalyst.
Why use it?
It prevents incomplete tests by requiring both a test page in the sample app and a separate NUnit test implementation, with platform coverage considered.

Instructions file for GitHub Copilot

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/dotnet/maui/uitests
Clone the repo
git clone --depth 1 https://github.com/dotnet/maui

Made for: GitHub Copilot.

Per session 7,172 This file is loaded in full into every session.
When invoked 7,172 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.07172 $0.07172
Opus 5 $0.03586 $0.03586
Sonnet 5 $0.01434 $0.01434
Haiku 4.5 $0.00717 $0.00717

Measured yesterday against content hash 957d718449fb, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

maui uitests.instructions.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.github/instructions/uitests.instructions.md · 776 lines

How it starts

The opening of the file, as written. The whole thing — 776 lines — stays where its author put it; the contents beside it link to each section on GitHub.

UI Testing Guidelines for .NET MAUI

Overview

This document provides specific guidance for GitHub Copilot when writing UI tests for the .NET MAUI repository.

Critical Principle: UI tests should run on all applicable platforms (iOS, Android, Windows, MacCatalyst) by default unless there is a specific technical limitation.

UI Test Structure

Two-Project Requirement

CRITICAL: Every UI test requires code in TWO separate projects:

  1. HostApp UI Test Page (src/Controls/tests/TestCases.HostApp/Issues/)

    • Create the actual UI page that demonstrates the feature or reproduces the issue
    • Prefer C# only (.cs file) unless testing XAML-specific features (bindings, templates, styles)
    • Add AutomationId attributes on interactive controls for test automation
    • Follow naming convention: IssueXXXXX.cs (C# only) or IssueXXXXX.xaml + IssueXXXXX.xaml.cs (when XAML required)
    • XXXXX should correspond to a GitHub issue number when applicable
    • Ensure the UI provides clear visual feedback for the behavior being tested
    • Class must include [Issue()] attribute with tracker, number, description, and platform
  2. NUnit Test Implementation (src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/)

    • Create corresponding Appium-based NUnit tests that inherit from _IssuesUITest
    • Use the AutomationId values to locate and interact with UI elements
    • Follow naming convention: IssueXXXXX.cs (matches the HostApp page file)
    • Include appropriate [Category(UITestCategories.XYZ)] attributes (only ONE per test)
    • Test should validate expected behavior through UI interactions and assertions

Base Class and Infrastructure

  • Each test class must inherit from _IssuesUITest
  • The _IssuesUITest base class provides:
    • The App property for interacting with UI elements
    • Test initialization and setup
    • Helper methods for common UI test operations
  • The test infrastructure automatically handles platform detection and page navigation

Read the full file on GitHub · 776 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 776 lines · 7,172 tokens per session scan A 957d718449fb

Subscribe to this mod's changes

maui uitests.instructions.md is an instructions file published in the GitHub repository dotnet/maui (23,317 stars, last pushed yesterday), licensed MIT. It adds 7,172 tokens to every session, about $0.0359 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.