-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Sandbox Agent
The Sandbox Agent is a specialized AI assistant for working with the .NET MAUI Sandbox app to test, validate, and experiment with MAUI features through automated deployment and testing.
- VS Code: Custom Agents in VS Code
- Copilot CLI: GitHub Copilot CLI
See Export Your Chat Sessions after completing your work.
The Sandbox Agent:
- ✅ Sets up test scenarios in the Sandbox app
- ✅ Deploys to Android, iOS, MacCatalyst, and Windows
- ✅ Runs automated Appium tests to reproduce issues
- ✅ Validates PR fixes work correctly
- ✅ Reproduces reported issues
- ✅ Iteratively fixes issues - once reproduction is automated, keeps working until fix is validated
- ✅ Converts Sandbox scenarios to UI tests when ready
- ✅ Captures device logs and screenshots
Use the Sandbox Agent when:
- You want to manually verify a PR fix works on device/simulator
- You need to reproduce an issue hands-on
- You want to experiment with a MAUI feature
- You need functional validation beyond code review
- You want to iteratively fix an issue - reproduce → fix → test → repeat until solved
- You're ready to convert a working Sandbox scenario into proper UI tests
Note: The Sandbox Agent focuses on functional testing, not code review. For reviewing code quality, use the PR Agent instead.
test PR #12345 on Android
test this PR on iOS
validate PR #12345 on both Android and iOS
reproduce issue #12345 in Sandbox
try to reproduce issue #12345 on Android
test this PR on iPhone 15
test PR #12345 on iOS 18.5
reproduce issue #12345 with Appium automation, then work on fixing it until the test passes
The fix works! Now move this Sandbox scenario to proper UI tests.
The Sandbox Agent follows this workflow:
1. Modify Sandbox app → 2. Create Appium test → 3. Deploy to device → 4. Run test → 5. Report results
-
src/Controls/samples/Controls.Sample.Sandbox/MainPage.xaml- UI for test scenario -
src/Controls/samples/Controls.Sample.Sandbox/MainPage.xaml.cs- Test logic -
CustomAgentLogsTmp/Sandbox/RunWithAppiumTest.cs- Appium test script (auto-generated)
-
CustomAgentLogsTmp/Sandbox/android-device.logorios-device.log- Device logs -
CustomAgentLogsTmp/Sandbox/build-run-output.log- Build and deployment logs -
CustomAgentLogsTmp/Sandbox/appium.log- Appium test execution logs -
CustomAgentLogsTmp/Sandbox/*.png- Screenshots (if test captures them)
This is the most powerful way to use the Sandbox Agent - set up automated reproduction, then work with Copilot to fix the issue iteratively.
reproduce issue #12345 in Sandbox with Appium automation
What happens:
- Agent creates MainPage with reproduction scenario
- Agent creates Appium test that demonstrates the bug
- Agent runs test and confirms: "Bug reproduced - test fails as expected"
Now work on fixing issue #12345. Keep testing after each change until the Appium test passes.
What happens:
- Copilot analyzes the bug and proposes a fix
- Modifies MAUI framework code (not Sandbox)
- Reruns BuildAndRunSandbox.ps1 to test
- If test still fails → analyzes why → tries different approach
- Repeats until Appium test passes
The fix works! Now move this Sandbox scenario to proper UI tests.
What happens:
- Agent creates
TestCases.HostApp/Issues/Issue12345.xaml[.cs] - Agent creates
TestCases.Shared.Tests/Tests/Issues/Issue12345.cs - Copies working test logic from Sandbox
- Cleans up Sandbox
✅ FIX VALIDATED - Test scenario completes successfully, expected behavior observed
Meaning: PR fix works as expected, no issues found.
⚠️ PARTIAL - Fix appears to work but noticed a minor animation glitch
Meaning: Fix mostly works but there are concerns worth noting.
❌ ISSUES FOUND - App crashes when tapping button after navigation
Meaning: Test revealed problems with the fix.
🚫 CANNOT TEST - Build failed due to missing dependency
Meaning: Unable to complete testing due to technical issues.
The agent automatically selects platforms based on:
-
PR title tags -
[Android],[iOS], etc. - Modified file paths - Platform-specific code paths
- Issue description - Mentioned platforms
- Code changes - Cross-platform vs. platform-specific
Default: Tests on Android only (faster) unless PR affects iOS-specific code or cross-platform controls.
You can override by specifying:
test PR #12345 on iOS
| Platform | Command | Notes |
|---|---|---|
| Android | -Platform android |
Requires Android emulator |
| iOS | -Platform ios |
Requires iOS simulator (macOS only) |
| MacCatalyst | -Platform catalyst |
Runs on macOS host directly |
| Windows | -Platform windows |
Runs on Windows host directly |
The Sandbox Agent uses BuildAndRunSandbox.ps1:
# Android
pwsh .github/scripts/BuildAndRunSandbox.ps1 -Platform android
# iOS (auto-detects device)
pwsh .github/scripts/BuildAndRunSandbox.ps1 -Platform ios
# iOS with specific device
pwsh .github/scripts/BuildAndRunSandbox.ps1 -Platform ios -DeviceUdid "YOUR-DEVICE-UDID"
# MacCatalyst
pwsh .github/scripts/BuildAndRunSandbox.ps1 -Platform catalyst
# Windows
pwsh .github/scripts/BuildAndRunSandbox.ps1 -Platform windows| File | Purpose |
|---|---|
.github/agents/sandbox-agent.md |
Agent definition |
.github/instructions/sandbox.instructions.md |
Detailed testing workflow |
.github/scripts/BuildAndRunSandbox.ps1 |
Build, deploy, and test script |
.github/scripts/templates/RunWithAppiumTest.template.cs |
Appium test template |
- Sandbox Testing Instructions - Full workflow details
- UI Testing Guide - For creating permanent UI tests