diff --git a/.github/README-AI.md b/.github/README-AI.md index 8e895bf46d4a..4f6b1f21a8a7 100644 --- a/.github/README-AI.md +++ b/.github/README-AI.md @@ -72,17 +72,16 @@ please test PR #32479 please reproduce issue #12345 ``` -**UI Test Coding Agent:** +**Write Tests Agent:** ```bash # Start GitHub Copilot CLI with agent support copilot -# Invoke the uitest-coding-agent -/agent uitest-coding-agent +# Invoke the write-tests-agent +/agent write-tests-agent -# Write or run UI tests +# Write UI tests (agent will invoke write-ui-tests skill) please write UI tests for issue #12345 -please run the UI tests from PR #32479 ``` **PR Agent:** @@ -112,7 +111,7 @@ please review https://github.com/dotnet/maui/pull/XXXXX 3. **Choose your agent** from the dropdown: - `sandbox-agent` for manual testing and experimentation - - `uitest-coding-agent` for writing and running UI tests + - `write-tests-agent` for writing tests (invokes appropriate skill) - `pr` for reviewing and working on existing PRs 4. **Enter a task** in the text box: @@ -205,7 +204,7 @@ Agents work with **time budgets as estimates for planning**, not hard deadlines: - **`agents/pr.md`** - PR workflow phases 1-3 (Pre-Flight, Tests, Gate) - **`agents/pr/post-gate.md`** - PR workflow phases 4-5 (Fix, Report) - **`agents/sandbox-agent.md`** - Sandbox agent for testing and experimentation -- **`agents/uitest-coding-agent.md`** - UI test agent for writing and running tests +- **`agents/write-tests-agent.md`** - Test writing agent (dispatches to skills like write-ui-tests) ### Agent Files @@ -214,7 +213,7 @@ Agent files in the `.github/agents/` directory: - **`agents/pr.md`** - PR workflow phases 1-3 (Pre-Flight, Tests, Gate) - **`agents/pr/post-gate.md`** - PR workflow phases 4-5 (Fix, Report) - **`agents/sandbox-agent.md`** - Sandbox app testing and experimentation -- **`agents/uitest-coding-agent.md`** - UI test writing and execution +- **`agents/write-tests-agent.md`** - Test writing (invokes skills like write-ui-tests) ### Shared Instruction Files @@ -250,7 +249,8 @@ Reusable skills in `.github/skills/` that agents can invoke: - **`try-fix/`** - Proposes and tests independent fix approaches, records results, learns from failures - **`verify-tests-fail-without-fix/`** - Verifies UI tests catch bugs (auto-detects mode based on git diff) -- **`write-tests/`** - Creates UI tests for issues following MAUI conventions +- **`write-ui-tests/`** - Creates UI tests for issues following MAUI conventions +- **`write-xaml-tests/`** - Creates XAML unit tests for parsing, XamlC, and source generation issues - **`pr-build-status/`** - Retrieves Azure DevOps build status for PRs ### Recent Improvements (January 2026) @@ -258,13 +258,13 @@ Reusable skills in `.github/skills/` that agents can invoke: **PR Agent Consolidation:** 1. **Unified PR Agent** - Replaced separate `issue-resolver` and `pr-reviewer` agents with single 5-phase `pr` agent 2. **try-fix Skill** - New skill for exploring independent fix alternatives with empirical testing -3. **Skills Integration** - Added `verify-tests-fail-without-fix` and `write-tests` skills for reusable test workflows +3. **Skills Integration** - Added `verify-tests-fail-without-fix` and `write-ui-tests` skills for reusable test workflows 4. **Agent/Skills Guidelines** - New instruction files for authoring agents and skills **Prior Infrastructure Consolidation (November 2025):** 1. **Unified Log Structure** - All logs now under `CustomAgentLogsTmp/` with subdirectories for Sandbox and UITests 2. **Shared Script Library** - Created reusable PowerShell scripts for device startup, build, and deployment -3. **Agent Simplification** - Consolidated `uitest-pr-validator` into `uitest-coding-agent` for clarity +3. **Agent Simplification** - Consolidated test writing into `write-tests-agent` (dispatcher) + `write-ui-tests` skill 4. **Automated Testing Scripts** - All agents now use PowerShell scripts instead of manual commands ### General Guidelines @@ -365,8 +365,8 @@ For issues or questions about the AI agent instructions: ## Metrics **Agent Files**: -- 4 agent files (pr.md, pr/post-gate.md, sandbox-agent.md, uitest-coding-agent.md) -- 4 skills (try-fix, verify-tests-fail-without-fix, write-tests, pr-build-status) +- 4 agent files (pr.md, pr/post-gate.md, sandbox-agent.md, write-tests-agent.md) +- 5 skills (try-fix, verify-tests-fail-without-fix, write-ui-tests, write-xaml-tests, pr-build-status) - All validated and consistent with consolidated structure **Automation**: diff --git a/.github/agents/pr.md b/.github/agents/pr.md index 54a9d81694cf..336fcc29310c 100644 --- a/.github/agents/pr.md +++ b/.github/agents/pr.md @@ -19,7 +19,7 @@ You are an end-to-end agent that takes a GitHub issue from investigation through ## When NOT to Use This Agent - ❌ Just run tests manually → Use `sandbox-agent` -- ❌ Only write tests without fixing → Use `uitest-coding-agent` +- ❌ Only write tests without fixing → Use `write-tests-agent` --- @@ -376,11 +376,11 @@ find src/Controls/tests -name "*XXXXX*" -type f 2>/dev/null **If tests exist** → Verify they follow conventions and reproduce the bug. -**If NO tests exist** → Create them using the `write-tests` skill. +**If NO tests exist** → Create them using the `write-ui-tests` skill. ### Step 2: Create Tests (if needed) -Invoke the `write-tests` skill which will: +Invoke the `write-ui-tests` skill which will: 1. Read `.github/instructions/uitests.instructions.md` for conventions 2. Create HostApp page: `src/Controls/tests/TestCases.HostApp/Issues/IssueXXXXX.cs` 3. Create NUnit test: `src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/IssueXXXXX.cs` @@ -393,7 +393,7 @@ dotnet build src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csp dotnet build src/Controls/tests/TestCases.Shared.Tests/Controls.TestCases.Shared.Tests.csproj -c Debug --no-restore -v q ``` -### Step 4: Verify Tests Reproduce the Bug (if not done by write-tests skill) +### Step 4: Verify Tests Reproduce the Bug (if not done by write-ui-tests skill) ```bash pwsh .github/skills/verify-tests-fail-without-fix/scripts/verify-tests-fail.ps1 -Platform ios -TestFilter "IssueXXXXX" @@ -458,7 +458,7 @@ pwsh .github/skills/verify-tests-fail-without-fix/scripts/verify-tests-fail.ps1 ### If Tests Don't Behave as Expected -**If tests PASS without fix** → Tests don't catch the bug. Go back to Phase 2, invoke `write-tests` skill again to fix the tests. +**If tests PASS without fix** → Tests don't catch the bug. Go back to Phase 2, invoke `write-ui-tests` skill again to fix the tests. ### Complete 🚦 Gate diff --git a/.github/agents/uitest-coding-agent.md b/.github/agents/uitest-coding-agent.md deleted file mode 100644 index 7c05a87aa5c5..000000000000 --- a/.github/agents/uitest-coding-agent.md +++ /dev/null @@ -1,635 +0,0 @@ ---- -name: uitest-coding-agent -description: Specialized agent for writing new UI tests for .NET MAUI with proper syntax, style, and conventions ---- - -# UI Test Coding Agent - -You are a specialized agent for writing high-quality UI tests for the .NET MAUI repository following established conventions and best practices. - -## Purpose - -Write new UI tests that: -- Follow .NET MAUI UI test conventions -- Are maintainable and clear -- Run reliably across platforms -- Actually test the stated behavior - -## Quick Decision: Should You Use This Agent? - -**YES, use this agent if:** -- User says "write a UI test for issue #XXXXX" -- User says "add test coverage for..." -- User says "create automated test for..." -- Need to write NEW test files - -**NO, use different agent if:** -- "Test this PR" → use `sandbox-agent` -- "Review this PR" → use `pr` agent -- "Fix issue #XXXXX" (no PR exists) → suggest `/delegate` command -- Only need manual verification → use `sandbox-agent` - ---- - -## 🚨 CRITICAL: Always Use BuildAndRunHostApp.ps1 Script - -**✅ ONLY DO THIS:** -```bash -pwsh .github/scripts/BuildAndRunHostApp.ps1 -Platform [android|ios|maccatalyst] -TestFilter "IssueXXXXX" -``` - -📖 **Complete documentation**: See [uitests.instructions.md](../instructions/uitests.instructions.md#running-ui-tests-locally) for: -- Full script usage and all parameters -- What the script handles automatically -- Manual commands for rapid development -- Troubleshooting guide and error handling - ---- - -## Two-Project Requirement - -**CRITICAL**: Every UI test requires code in TWO projects: - -1. **HostApp UI Test Page** (`src/Controls/tests/TestCases.HostApp/Issues/`) - - XAML: `IssueXXXXX.xaml` - - Code-behind: `IssueXXXXX.xaml.cs` - - Contains actual UI that demonstrates/reproduces the issue - -2. **NUnit Test** (`src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/`) - - Test file: `IssueXXXXX.cs` - - Contains Appium-based automated test - -## File Templates - -### HostApp XAML (`IssueXXXXX.xaml`) - -```xml - - - - - -