

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
123456# Sandbox Testing Guide78Comprehensive guide for working with the .NET MAUI Sandbox app for manual testing, PR validation, issue reproduction, and experimentation with MAUI features.910## When This Applies1112This guide applies when you:13- Work with files in `src/Controls/samples/Controls.Sample.Sandbox/`14- User asks to "test this PR" or "validate PR #XXXXX" in Sandbox15- User asks to "reproduce issue #XXXXX" in Sandbox16- User wants to deploy to iOS/Android for manual testing17- User mentions Sandbox app by name in testing context1819## 🚨 CRITICAL VALIDATION RULES - READ FIRST2021**YOU MUST FOLLOW THESE RULES WHEN RUNNING SANDBOX TESTS:**2223### What You NEVER Do (Absolute Rules)2425- ❌ **NEVER** assume test completion without validation26- ❌ **NEVER** claim success based on HTTP 200 responses alone (element found ≠ test completed)27- ❌ **NEVER** skip the mandatory validation checklist28- ❌ **NEVER** proceed without verifying device logs show expected behavior29- ❌ **NEVER** assume Appium connection means test finished30- ❌ **NEVER** claim button was tapped without checking device logs31- ❌ **NEVER** switch branches (e.g., `git checkout main`) during reproduction - stay on current branch3233### What You ALWAYS Do (Mandatory Steps)3435- ✅ **ALWAYS** save full output to file for analysis36- ✅ **ALWAYS** check for errors/exceptions FIRST before claiming success37- ✅ **ALWAYS** verify "Test completed" marker appears in output38- ✅ **ALWAYS** verify expected test actions in logs (Tapping, Screenshot, etc.)39- ✅ **ALWAYS** check device logs for Console.WriteLine markers (e.g., "SANDBOX: ...")40- ✅ **ALWAYS** verify artifacts exist (screenshots, if test captures them)4142### Rule 1: NEVER ASSUME TEST COMPLETION43- ❌ **DO NOT** assume the test completed successfully just because Appium connected44- ❌ **DO NOT** assume success based on HTTP 200 responses (element found ≠ test completed)45- ✅ **DO** verify test completion by checking for completion markers in output46- ✅ **DO** search for "Test completed", "═══════", or final summary messages4748### Rule 2: ALWAYS VALIDATE TEST OUTPUT49After running BuildAndRunSandbox.ps1, you MUST:501. **Save full output to file**: `pwsh .github/scripts/BuildAndRunSandbox.ps1 -Platform ios > CustomAgentLogsTmp/Sandbox/build-run-output.log 2>&1`512. **Check for errors FIRST**: `grep -E "ERROR|Exception|failed" CustomAgentLogsTmp/Sandbox/build-run-output.log`523. **Verify completion markers**: `grep "Test completed\|══════" CustomAgentLogsTmp/Sandbox/build-run-output.log`534. **Check for expected actions**: `grep "Tapping\|Screenshot saved\|switched to" CustomAgentLogsTmp/Sandbox/build-run-output.log`5455### Rule 3: VALIDATE DEVICE LOGS FOR EXPECTED BEHAVIOR56- ✅ **DO** check device logs confirm your expected test actions happened57- ✅ **DO** grep for your Console.WriteLine markers (e.g., "SANDBOX.*CLICKED")58- ❌ **DO NOT** claim the test worked without verifying device logs show the action5960### Rule 4: SYSTEMATIC VALIDATION CHECKLIST61After EVERY test run, verify ALL of these **IN THIS ORDER**:6263```bash64# Step 1: Check for errors/exceptions FIRST65grep -iE "error|exception|failed" CustomAgentLogsTmp/Sandbox/build-run-output.log | grep -v "no such element" | head -206667# Step 2: Verify expected test actions (MOST IMPORTANT - proves test actually ran)68grep -E "Tapping|Screenshot saved|Found.*element|Clicking|Entering text" CustomAgentLogsTmp/Sandbox/build-run-output.log6970# Step 3: Verify test completion marker71grep "Test completed" CustomAgentLogsTmp/Sandbox/build-run-output.log7273# Step 4: Verify device logs show expected behavior74grep "SANDBOX" CustomAgentLogsTmp/Sandbox/android-device.log # or ios-device.log7576# Step 5: Check screenshots were saved (if test captures them)77ls -lh CustomAgentLogsTmp/Sandbox/*.png7879# Step 6: Check exit code80echo $? # Should be 0 for success81```8283**CRITICAL**: If Step 2 shows NO test actions, the test didn't actually run even if it "completed successfully". Update your Appium test and rerun.8485**If ANY of these checks fail, the test DID NOT complete successfully. Investigate and fix before proceeding.**8687---8889## 🚨 WARNING: "Test Completed Successfully" ≠ Test Actually Worked9091**CRITICAL UNDERSTANDING**: The message "✅ Test completed successfully" only means:92- ✅ Appium test script finished running without crashing93- ✅ Script exit code was 09495**It does NOT mean**:96- ❌ Appium found your UI elements97- ❌ Buttons were clicked98- ❌ Navigation happened99- ❌ Your test scenario actually ran100101### Example of False Success102103**What you see in output**:104```105✅ Test completed successfully106107╔═══════════════════════════════════════════════════════════╗108║ Test Summary ║109╠═══════════════════════════════════════════════════════════╣110║ Platform: ANDROID ║111║ Device: emulator-5554 ║112║ Result: SUCCESS ✅ ║113╚═══════════════════════════════════════════════════════════╝114```115116**What actually happened**:117```bash118# Check the logs:119grep "no such element" CustomAgentLogsTmp/Sandbox/build-run-output.log120# Result: 20+ lines of "no such element" errors121122# The test looked for "InstructionLabel" which doesn't exist in MainPage123# Appium never found ANY elements124# Test script just gave up and exited with code 0125# NO ACTUAL TESTING WAS PERFORMED126```127128### How to Detect False Success129130**MANDATORY check after EVERY "successful" test**:131```bash132# Look for actual test actions in output133grep -E "Tapping|Clicking|Found element|Screenshot saved" CustomAgentLogsTmp/Sandbox/build-run-output.log134```135136**If grep returns NOTHING → FALSE SUCCESS**:137- Test didn't actually do anything138- Template test is looking for elements that don't exist139- You MUST update `CustomAgentLogsTmp/Sandbox/RunWithAppiumTest.cs` to match your MainPage140- Rerun BuildAndRunSandbox.ps1 after updating test141142**If grep returns multiple lines → REAL SUCCESS**:143- Test found elements and interacted with them144- Proceed with full validation checklist145146---147148## Purpose149150Work with the Sandbox app for manual testing, PR validation, issue reproduction, and experimentation with MAUI features.151152## When to Use Sandbox Testing153154- ✅ User asks to "test this PR" (functional testing, not code review)155- ✅ User asks to "validate PR #XXXXX" or "validate PR #XXXXX in Sandbox"156- ✅ User asks to "reproduce issue #XXXXX" or "try out issue #XXXXX"157- ✅ User asks to "try out" or "experiment with" a feature in Sandbox158- ✅ PR modifies core MAUI functionality (controls, layouts, platform code)159- ✅ Need to manually verify a fix works on device/simulator160- ✅ Need to create a quick test scenario for hands-on validation161162## When NOT to Use Sandbox163164- ❌ User asks to "review PR #XXXXX" → Use **pr** agent for code review165- ❌ User asks to "write tests" or "create automated tests" → Use **write-tests-agent**166- ❌ User asks to "validate the UI tests" or "verify test quality" → Review test code instead167- ❌ User asks to "fix issue #XXXXX" (no PR exists) → Suggest `/delegate` command168- ❌ PR only adds documentation (no code changes to test)169- ❌ PR only modifies build scripts (no functional changes)170171## Distinction: Code Review vs. Functional Testing172173**Code Review** (pr-review skill):174- Analyzes code quality, patterns, best practices175- Reviews test coverage and correctness176- Checks for potential bugs or issues in the code itself177- Trigger: "review PR", "work on PR"178179**Functional Testing** (sandbox-agent):180- Builds and deploys PR to device/simulator181- Manually validates the fix works as expected182- Reproduces issues and verifies they're resolved183- Trigger: "test this PR", "validate PR in Sandbox", "reproduce issue"184185## 🚨 Critical Requirements for Android Testing186187**ANDROID-ONLY REQUIREMENT - appium:noReset**188189⚠️ **This ONLY applies to Android, NOT iOS**190191When testing on Android, the Appium test script **MUST** have this capability:192193```csharp194// ANDROID ONLY - Do NOT add this for iOS195if (PLATFORM == "android")196{197 options.AddAdditionalAppiumOption("appium:noReset", true);198}199```200201**Why this is critical for Android:**202- Without `noReset`, Appium clears app data between runs203- This breaks .NET MAUI's Fast Deployment mechanism on Android204- App crashes with: `"No assemblies found in '.../__override__/...' ... Assuming this is part of Fast Deployment. Exiting..."`205- The app will crash immediately on launch before any test can run206207**iOS does NOT need this** - iOS deployment works differently and doesn't use Fast Deployment208209**Where to set it:**210- Template: `.github/scripts/templates/RunWithAppiumTest.template.cs` (line ~68, Android section only)211- Active test: `CustomAgentLogsTmp/Sandbox/RunWithAppiumTest.cs` (Android section only)212213**Platform detection is automatic** - The template automatically detects Android vs iOS from the UDID format, so you don't need to manually set the platform. The `if (PLATFORM == "android")` block will execute automatically when testing on Android.214215**⚠️ NEVER REMOVE THIS CAPABILITY FROM ANDROID** - All Android tests depend on it216217---218219## Core Workflow220221**🚨 CRITICAL RULES FOR ENTIRE WORKFLOW:**222- **ALWAYS use BuildAndRunSandbox.ps1 script** for building, deploying, and testing223- **NEVER use manual `dotnet build`, `adb`, or `xcrun` commands**224- **NEVER switch branches during reproduction** - stay on the current branch225- **ALWAYS stop and ask user if you cannot reproduce** - do not try alternative branches226- The script handles device detection, build, deployment, and test execution automatically227- See "BuildAndRunSandbox.ps1 Script" section below for full details228229---230231### Step 1: Understand Issue (DO NOT Checkout PR Unless Instructed)232233**⚠️ IMPORTANT**: Only checkout a PR if the user explicitly asks you to test a specific PR. For general issue reproduction, work on the current branch.234235```bash236# ONLY if user explicitly asks to test a PR:237gh pr checkout <PR_NUMBER>238```239240**Understand the issue thoroughly:**241- Read issue report or PR description242- Identify what bug needs to be reproduced243- Note affected platforms244- Look for reproduction steps in the issue245- If testing a PR: Review PR changes to understand the fix246247---248249### Step 2: Create Test Scenario in Sandbox250251**Choose test scenario source (in priority order):**2522531. **From Issue Reproduction** (Preferred)254 - Look for "Reproduction" or "Steps to Reproduce" in the linked issue255 - Use the exact scenario the user reported256 - This proves you're testing what the user experienced2572582. **From PR's UI Tests** (Alternative)259 - Check if PR includes files in `TestCases.HostApp/Issues/IssueXXXXX.*`260 - Adapt the test page code to Sandbox261 - Simplify if needed for manual testing2622633. **Create Your Own** (Last Resort)264 - If no repro available, design scenario based on PR changes265 - Focus on the specific code paths modified by the fix266 - Keep it simple and focused267268**Files to modify**:269- `src/Controls/samples/Controls.Sample.Sandbox/MainPage.xaml[.cs]` - UI and code for reproduction270- `CustomAgentLogsTmp/Sandbox/RunWithAppiumTest.cs` - Appium test script (MANDATORY - see setup below)271272**Setting up the Appium test file (MANDATORY):**273274🚨 **CRITICAL**: Update Appium test BEFORE running script. Template will give FALSE SUCCESS otherwise.2752761. **Create test file**:277```bash278 mkdir -p CustomAgentLogsTmp/Sandbox279 cp .github/scripts/templates/RunWithAppiumTest.template.cs CustomAgentLogsTmp/Sandbox/RunWithAppiumTest.cs280```2812822. **Update test to match MainPage**:283 - Check AutomationIds: `grep AutomationId MainPage.xaml`284 - Update test to use those IDs (not template defaults)285 - Add test logic: tap buttons, verify labels286 - Add Console.WriteLine markers for debugging2872883. **Example**:289```bash290 # Check MainPage291 grep 'AutomationId=' MainPage.xaml292 # Update test: App.WaitForElement("NavigateButton");293```294295**Checklist**:296- ✅ Add AutomationIds to MainPage.xaml elements297- ✅ Update RunWithAppiumTest.cs to match298- ✅ Add SANDBOX markers for debugging299300**🚨 CRITICAL - Document Your Test Scenario:**301302You MUST include in your final report:303- ✅ **Source**: Where did the test scenario come from? (issue reproduction / PR UITest / custom)304- ✅ **Why**: Why did you choose that source? (e.g., "Issue #XXXXX provides detailed repro steps")305- ✅ **What**: What specific actions does your test perform? (e.g., "Tap button → verify label changes to 'Success'")306- ✅ **Expected**: What behavior should occur? (from issue description or PR changes)307308Without this documentation, user cannot verify you tested the right thing.309310---311312### Step 3: Test WITH PR Fix313314**Platform Selection Decision Tree:**315316Follow this flowchart in order - stop at the first match:317318```319┌─────────────────────────────────────────────────────────────────┐320│ 1. Does PR title have platform tag? [Android], [iOS], etc. │321│ YES → Test that platform ONLY │322│ NO → Continue to step 2 │323├─────────────────────────────────────────────────────────────────┤324│ 2. Are ALL modified files in platform-specific paths? │325│ (Platform/Android/, Platform/iOS/, *.Android.cs, etc.) │326│ YES → Test that platform ONLY │327│ NO → Continue to step 3 │328├─────────────────────────────────────────────────────────────────┤329│ 3. Does issue report mention a specific platform? │330│ YES (one platform) → Test that platform ONLY │331│ YES (multiple) → Test Android + iOS │332│ NO → Continue to step 4 │333├─────────────────────────────────────────────────────────────────┤334│ 4. Is this high-risk cross-platform code? │335│ (Controls/, Core/, layout, navigation, critical controls) │336│ YES → Test Android + iOS │337│ NO → Test Android ONLY (default - faster) │338└─────────────────────────────────────────────────────────────────┘339```340341**Platform-specific path indicators:**342- `Platform/Android/` or `Platform/iOS/` → Platform-specific343- Files with `.Android.`, `.iOS.`, `.MacCatalyst.` in name → Platform-specific344- `Controls/`, `Core/` without platform subfolders → Cross-platform345346**Hard rule:** Never test more than 2 platforms unless user explicitly requests it.347348**Run Test on Specific iOS Device/Version:**349350When user requests a specific iOS version or device:3513521. **Find the UDID for that device/version combination**:353```bash354 # Example: Find iPhone Xs with iOS 18.5355 UDID=$(xcrun simctl list devices available --json | jq -r '356 .devices357 | to_entries358 | map(select(.key | contains("iOS-18-5")))359 | map(.value)360 | flatten361 | map(select(.name == "iPhone Xs"))362 | first363 | .udid364 ')365366 echo "Found UDID: $UDID"367```3683692. **Pass the UDID to the script**:370```bash371 pwsh .github/scripts/BuildAndRunSandbox.ps1 -Platform ios -DeviceUdid "$UDID"372```373374**Examples:**375- **"Run on iOS 18.5"** → Find iPhone Xs with iOS 18.5, get UDID, pass to script376- **"Run on iPhone 15"** → Find iPhone 15 (any iOS), get UDID, pass to script377- **"Run on iPhone 16 Pro with iOS 18.0"** → Find iPhone 16 Pro with iOS 18.0, get UDID, pass to script378379---380381## How the Template Works382383**The template ALWAYS does the same thing:**3843851. ✅ Verifies app launched successfully (WaitForElement)3862. ✅ Optionally runs automated UI tests (if you add them)3873. ✅ Exits WITHOUT closing the app (stays running for manual validation)388389**Usage:**390```bash391# Copy the template392cp .github/scripts/templates/RunWithAppiumTest.template.cs CustomAgentLogsTmp/Sandbox/RunWithAppiumTest.cs393394# OPTIONAL: Add automated test logic in the TEST LOGIC section395# If you don't add test logic, it just verifies launch and exits396397# Run the script398pwsh .github/scripts/BuildAndRunSandbox.ps1 -Platform ios399```400401**Result:**402- App launches and stays running403- You can manually validate in the simulator404- Test script exits without closing the app405406---407408## 🚨 CRITICAL: BuildAndRunSandbox.ps1 Script - ONLY Way to Deploy Sandbox409410**YOU MUST ALWAYS USE THIS SCRIPT. NEVER USE MANUAL `dotnet build`, `adb`, or `xcrun` COMMANDS.**411412### Script Location413`.github/scripts/BuildAndRunSandbox.ps1`414415### Basic Usage416```powershell417# Android418pwsh .github/scripts/BuildAndRunSandbox.ps1 -Platform Android419420# iOS (auto-detects device)421pwsh .github/scripts/BuildAndRunSandbox.ps1 -Platform iOS422423# iOS with specific device424pwsh .github/scripts/BuildAndRunSandbox.ps1 -Platform iOS -DeviceUdid "YOUR-DEVICE-UDID"425```426427### What the Script Does Automatically428- ✅ **Device detection and boot** - Finds and boots simulator/emulator429- ✅ **UDID extraction** - Sets DEVICE_UDID environment variable430- ✅ **Fresh app build** - Builds Sandbox project for target platform431- ✅ **App deployment** - Installs and launches app432- ✅ **Appium server management** - Starts/stops Appium automatically433- ✅ **Log capture** - Saves device and Appium logs to `CustomAgentLogsTmp/Sandbox/`434- ✅ **Test execution** - Runs your Appium test script435436### Requirements Before Running437Copy and update test file (see Step 2 above). Template looks for "InstructionLabel" which doesn't exist - update first!438439**🚨 POST-TEST VALIDATION (MANDATORY):**440441After script completes, run Rule 4 validation checklist (see above). If ANY check fails: investigate, fix, rerun.442443**Key reminders**:444- HTTP 200 = element found, NOT test completed445- If no test actions in logs = FALSE SUCCESS446- If Appium can't find initial element = app crashed or AutomationIds wrong447448---449450### 📝 Note for User451452**Test scenario is ready in Sandbox for manual verification.**453454**To verify bug reproduction (optional):**455```bash456# 1. Revert the PR fix files457git checkout main -- [list specific fix files from PR]458459# 2. Rerun test - bug should appear460pwsh .github/scripts/BuildAndRunSandbox.ps1 -Platform [android|ios]461462# 3. Restore fix463git checkout HEAD -- [fix files]464465# 4. Rerun test - bug should be gone466pwsh .github/scripts/BuildAndRunSandbox.ps1 -Platform [android|ios]467```468469This proves the test scenario correctly reproduces the bug.470471---472473## 🔄 Iterative Testing Workflow (MANDATORY PROCESS)474475**🚨 CRITICAL**: This is THE workflow for Sandbox testing. Do NOT use manual `adb`/`xcrun` commands to bypass it.476477### The Required Loop478479```480┌─────────────────────────────────────────────────────────────┐481│ 1. Update MainPage.xaml[.cs] with your test scenario │482│ - Add UI elements for reproduction │483│ - Add AutomationIds to all interactive elements │484│ - Add Console.WriteLine markers for debugging │485├─────────────────────────────────────────────────────────────┤486│ 2. Update Appium test to match your MainPage │487│ CustomAgentLogsTmp/Sandbox/RunWithAppiumTest.cs │488│ - Update element locators to match AutomationIds │489│ - Add test logic (tap buttons, verify labels) │490├─────────────────────────────────────────────────────────────┤491│ 3. Run BuildAndRunSandbox.ps1 │492│ pwsh .github/scripts/BuildAndRunSandbox.ps1 -Platform X │493├─────────────────────────────────────────────────────────────┤494│ 4. Validate results using SYSTEMATIC CHECKLIST │495│ - Step 1: Check for errors/exceptions │496│ - Step 2: Verify test actions (Tapping, etc.) │497│ - Step 3: Verify "Test completed" │498│ - Step 4: Check device logs for SANDBOX markers │499│ - Step 5-6: Screenshots and exit code │500├─────────────────────────────────────────────────────────────┤501│ 5. Did ALL validation checks pass? │502│ YES → Report success with summary (go to step 8) │503│ NO → Continue to step 6 │504├─────────────────────────────────────────────────────────────┤505│ 6. Investigate failure from captured logs │506│ - Read CustomAgentLogsTmp/Sandbox/android-device.log │507│ - Read CustomAgentLogsTmp/Sandbox/build-run-output.log │508│ - Identify root cause (element not found? crash?) │509├─────────────────────────────────────────────────────────────┤510│ 7. Fix the issue and LOOP BACK TO STEP 3 │511│ - Update MainPage if UI/code issue │512│ - Update RunWithAppiumTest.cs if test issue │513│ - Update both if AutomationId mismatch │514│ - Max 3 iterations before reporting as blocked │515├─────────────────────────────────────────────────────────────┤516│ 8. Report comprehensive summary to user │517│ - Test scenario source and justification │518│ - Validation results │519│ - Verdict (success/partial/issues/blocked) │520└─────────────────────────────────────────────────────────────┘521```522523### ❌ What NOT To Do524525**Never use manual commands during testing**:526- ❌ `adb logcat`, `adb shell`, `adb install`527- ❌ `xcrun simctl spawn`, `xcrun simctl install`528- ❌ `dotnet build`, `dotnet run`529530**Why**: Script already captured everything. Manual commands show CURRENT state, not test execution state.531532**✅ Correct**: Edit files → Rerun `BuildAndRunSandbox.ps1`533534### ✅ Correct Iteration Example535536**Most common case - Test fails to find element**:537```bash538# 1. Check what went wrong539grep "no such element" CustomAgentLogsTmp/Sandbox/build-run-output.log540541# 2. Check what DOES exist in MainPage542grep AutomationId src/Controls/samples/Controls.Sample.Sandbox/MainPage.xaml543544# 3. Fix MainPage: Add AutomationIds545# Edit MainPage.xaml: <Button AutomationId="NavigateButton" ...546547# 4. Fix test: Update to match548# Edit RunWithAppiumTest.cs: App.WaitForElement("NavigateButton");549550# 5. Rerun551pwsh .github/scripts/BuildAndRunSandbox.ps1 -Platform android552```553554**When validation passes**: Report success with comprehensive summary555556### When to Stop Iterating557558- ✅ **All validation checks pass** → Report success with detailed summary559- ❌ **Max 3 iterations reached** → **STOP and report**: "I wasn't able to reproduce the issue. What should I try next?"560- ❌ **Build fails repeatedly** → **STOP and report**: "I wasn't able to reproduce the issue due to build failures. What should I try next?"561- ❌ **Root cause unclear after log analysis** → **STOP and report**: "I wasn't able to reproduce the issue. What should I try next?"562- ❌ **Issue appears to be PR bug, not test** → **STOP and report findings to user**: "I wasn't able to reproduce the issue - it appears there may be an issue with [details]. What should I try next?"563- ❌ **Cannot reproduce the issue** → **STOP immediately**: "I wasn't able to reproduce the issue. What should I try next?"564565**CRITICAL**: When you cannot reproduce or hit blockers, **PAUSE and ask the user**. Do NOT:566- ❌ Switch to a different branch (e.g., `git checkout main`)567- ❌ Try alternative approaches without asking first568- ❌ Change the workflow significantly without user guidance569570### Mental Model: The Script is Your Robot571572BuildAndRunSandbox.ps1 handles: build → deploy → capture logs → run test → report573574**Your workflow**: Edit files → Run script → Read logs → Fix issues → Repeat575576---577578## Output Format579580Provide a concise test summary:581582```markdown583## PR Testing Summary584585**PR**: #XXXXX - [Title]586**Platform Tested**: Android/iOS587**Issue**: [Brief description]588589---590591### Test Scenario Setup592593**🚨 REQUIRED - Source of Test Scenario**:594- **Source**: [From issue reproduction / From PR UITest / Custom scenario]595- **Why this source**: [e.g., "Issue #XXXXX provides detailed repro steps" / "PR includes UITest that demonstrates the fix" / "No repro available, created scenario based on PR code changes"]596- **Link to source**: [URL to issue comment with repro, or path to UITest file]597598**What was tested**:599- [Specific actions taken - e.g., "Tap 'Toggle RTL' button, then tap 'Show Dialog' button"]600- [UI elements involved - e.g., "Button with AutomationId='ToggleButton', Dialog with Label"]601- [Expected behavior - e.g., "Dialog should appear with correct RTL padding on label"]602603---604605### Test Results WITH PR Fix606607**Observed Behavior**:608- [What happened when running the test]609- [Appium test results]610- [Relevant log excerpts]611612**Screenshots**: [Reference if taken, but not for validation]613614---615616### Verdict617618✅ **FIX VALIDATED** - Test scenario completes successfully, expected behavior observed619OR620⚠️ **PARTIAL** - Fix appears to work but [note any concerns]621OR622❌ **ISSUES FOUND** - [Specific problems encountered]623OR624🚫 **CANNOT TEST** - [Build failures, setup issues, etc.]625626---627628### Notes for User629- Test scenario is set up in Sandbox and ready for manual verification if needed630- To verify bug reproduction without fix, revert PR changes: `git checkout main -- [fix files]`631- Then rerun: `pwsh .github/scripts/BuildAndRunSandbox.ps1 -Platform [android|ios]`632```633634---635636## Best Practices6376381. **Use issue reproduction when available** - Most reliable test scenario6392. **Adapt PR's UITests if no repro** - They're already designed to test the fix6403. **Validate programmatically, reference visually** - Use Appium element queries for validation, screenshots only for additional context6414. **Use colored backgrounds** - Makes layout issues visible6425. **Add console markers** - Easy to grep logs6436. **Test multiple iterations** - Race conditions need multiple runs (3-5 times)6447. **Leave Sandbox as-is** - User will iterate on it after your testing6458. **Document your test scenario thoroughly** - Include source (issue/UITest/custom), why you chose it, specific actions, and expected behavior so user can verify646647**Screenshot Usage**:648- ✅ Take screenshots for **context and reference** (e.g., showing layout before/after)649- ✅ Include in report if they provide **additional insight** beyond what logs show650- ❌ Do NOT rely on screenshots as **primary validation** - use Appium element queries and log analysis651- ❌ Do NOT take screenshots just to show "it works" - validation should come from test assertions652653---654655## Log Capture and Review656657### Where Logs Are Saved658659After running BuildAndRunSandbox.ps1, all logs are in `CustomAgentLogsTmp/Sandbox/`:6606611. **Android**: `CustomAgentLogsTmp/Sandbox/android-device.log`6622. **iOS**: `CustomAgentLogsTmp/Sandbox/ios-device.log`6633. **Appium**: `CustomAgentLogsTmp/Sandbox/appium.log`664665### Viewing Logs666667```bash668# View device logs669cat CustomAgentLogsTmp/Sandbox/android-device.log670# or671cat CustomAgentLogsTmp/Sandbox/ios-device.log672673# Search for specific output674grep "TEST OUTPUT" CustomAgentLogsTmp/Sandbox/android-device.log675676# View Appium logs677cat CustomAgentLogsTmp/Sandbox/appium.log678```679680### 📝 Adding Debug Logging to Your Test Scenario681682**Use `Console.WriteLine` for logging** - it works on all platforms.683684```csharp685// Use a unique prefix for easy grep686Console.WriteLine("SANDBOX: Button clicked");687Console.WriteLine($"SANDBOX: Value is {myValue}");688```689690**Searching logs:**691```bash692grep "SANDBOX" CustomAgentLogsTmp/Sandbox/android-device.log693grep "SANDBOX" CustomAgentLogsTmp/Sandbox/ios-device.log694grep "SANDBOX" CustomAgentLogsTmp/Sandbox/catalyst-device.log695```696697---698699## 🚨 ABSOLUTE RULE: BuildAndRunSandbox.ps1 is THE ONLY Deployment Method700701**THIS IS MANDATORY. NOT A SUGGESTION.**702703❌ If typing `adb`/`xcrun` commands during testing → STOP. You're violating the workflow.704705**Why**: Manual commands show CURRENT state, not test execution state. Script already captured correct logs during test.706707**❌ NEVER during testing**: `adb logcat`, `adb install`, `adb shell`, `xcrun simctl install/spawn`, `dotnet build/run`708709**✅ ONLY exception**: Finding/booting specific iOS device BEFORE running script (`xcrun simctl list/boot`)710711**Correct workflow**:7121. Edit files (MainPage, RunWithAppiumTest.cs)7132. Run: `pwsh .github/scripts/BuildAndRunSandbox.ps1 -Platform X`7143. Analyze logs in `CustomAgentLogsTmp/Sandbox/` (android-device.log, appium.log)7154. Fix issues, rerun script716717**Expected logs**: `android-device.log` or `ios-device.log`, `appium.log`, `RunWithAppiumTest.cs`, optional screenshots718719---720721## Troubleshooting & Recovery722723**Retry up to 3 times before reporting as blocked.** After each failure: analyze logs → fix → rerun script.724725### Common Issues726727| Issue | Recovery | Max Retries |728|-------|----------|-------------|729| Build error | Check SDK version, `dotnet tool restore` | 2 |730| App crash | Check stack trace in device log, fix code/XAML | 3 |731| Element not found | Verify AutomationIds match, check app loaded | 2 |732| Fast Deployment (Android) | Add `appium:noReset` capability | 1 |733| XAML parse error | Verify event handler exists in code-behind | 2 |734735### Element Not Found Debugging736737🚨 If Appium can't find initial element, app is NOT running correctly.738739**Check**:740```bash741# Look for crashes742grep -i "FATAL\|crash\|exception" CustomAgentLogsTmp/Sandbox/android-device.log | tail -20743744# Verify app launched745grep "SANDBOX.*MainPage" CustomAgentLogsTmp/Sandbox/android-device.log746```747748**Root causes**: App crashed, XAML parse error, AutomationId mismatch, Android Fast Deployment749750### When to Stop & Report751- ✅ **Continue**: Minor warnings, non-critical timeouts, platform differences752- ❌ **Stop and ask user**: Can't checkout PR, build fails after max retries, SDK mismatch, root cause unclear, cannot reproduce issue753754**When blocked, ALWAYS report to user with this format**:755```markdown756I wasn't able to reproduce the issue. Here's what I tried:7577581. [What I attempted]7592. [Issues encountered]7603. [Current state of reproduction attempt]761762What should I try next?763```764765**DO NOT** try alternative approaches without asking first. **DO NOT** switch branches.766767### Test Shows Unexpected Behavior768**Action**: Document and report769770```markdown771⚠️ Unexpected behavior during testing772773**What I expected**: [Based on issue description]774775**What I observed**: [Actual behavior]776777**Test scenario**: [What was tested]778779**Logs**: [Relevant excerpts]780781**Question for user**: Is this expected behavior, or does this indicate an issue?782```783784---785786## Common Mistakes to Avoid787788- ❌ Using TestCases.HostApp for manual PR validation (use Sandbox)789- ❌ Manual build/deploy commands instead of BuildAndRunSandbox.ps1790- ❌ Testing only one platform when PR affects multiple791- ❌ Using screenshots for validation (use Appium element queries)792- ❌ Creating test scenario without checking issue for reproduction steps793- ❌ Ignoring PR's existing UITests when available794- ❌ Cleaning up or reverting Sandbox changes (user will iterate on it)795796**Testing Tips**:797- For layout bugs: Use `element.GetRect()` to measure positions798- For SafeArea PRs: Measure child content position, not parent size799- Add `Console.WriteLine("SANDBOX: ...")` markers for debugging800801---802803## Appendix: Cleanup (Only When User Requests)804805⚠️ **DO NOT clean up after testing** - Leave Sandbox as-is so user can iterate on it.806807Only use these commands if the **user explicitly requests cleanup**:808809### Sandbox App Cleanup (User Request Only)810```bash811# Revert all changes to Sandbox app812git checkout -- src/Controls/samples/Controls.Sample.Sandbox/813```814815### Sandbox Test Files Cleanup (User Request Only)816```bash817# Remove Appium test directory (gitignored)818rm -rf CustomAgentLogsTmp/Sandbox/819```820
One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| dotnet/maui.github/instructions/public-api.instructions.md · 23k | Copilot instructions | apido-not | 59/100 | 9 days ago | |
| dotnet/maui.github/copilot-instructions.md · 23k | Copilot instructions | setuptestlint-formatstyle+6 | 76/100 | 14 days ago | |
| dotnet/maui.github/instructions/android.instructions.md · 23k | Copilot instructions | buildstyle | 70/100 | 14 days ago | |
| dotnet/maui.github/instructions/ci-copilot-pipeline-security.instructions.md · 23k | Copilot instructions | gitsecuritydeploymentdo-not+1 | 76/100 | 14 days ago | |
| dotnet/maui.github/instructions/collectionview-android.instructions.md · 23k | Copilot instructions | stylearchperformanceagent-behaviour | 52/100 | 14 days ago | |
| dotnet/maui.github/instructions/collectionview-handler-detection.instructions.md · 23k | Copilot instructions | stylegitdo-not | 73/100 | 14 days ago | |
| dotnet/maui.github/instructions/collectionview-ios.instructions.md · 23k | Copilot instructions | styleperformance | 48/100 | 14 days ago | |
| dotnet/maui.github/instructions/collectionview-windows.instructions.md · 23k | Copilot instructions | stylearch | 52/100 | 14 days ago | |
| dotnet/maui.github/instructions/handler-patterns.instructions.md · 23k | Copilot instructions | styledo-not | 55/100 | 14 days ago | |
| dotnet/maui.github/instructions/helix-device-tests.instructions.md · 23k | Copilot instructions | setupbuildtestarch | 74/100 | 14 days ago | |
| dotnet/maui.github/instructions/integration-tests.instructions.md · 23k | Copilot instructions | setupteststyledo-not | 92/100 | 14 days ago | |
| dotnet/maui.github/instructions/layout-system.instructions.md · 23k | Copilot instructions | archapiperformancedo-not | 55/100 | 14 days ago | |
| dotnet/maui.github/instructions/performance-hotpaths.instructions.md · 23k | Copilot instructions | styleperformancedo-not | 55/100 | 14 days ago | |
| dotnet/maui.github/instructions/templates.instructions.md · 23k | Copilot instructions | buildteststylearch+1 | 92/100 | 14 days ago | |
| dotnet/maui.github/instructions/threading-async.instructions.md · 23k | Copilot instructions | styleui | 48/100 | 14 days ago | |
| dotnet/maui.github/instructions/xaml-unittests.instructions.md · 23k | Copilot instructions | teststyledocs | 70/100 | 14 days ago | |
| dotnet/maui.github/instructions/safe-area-ios.instructions.md · 23k | Copilot instructions | stylegit | 43/100 | 14 days ago | |
| dotnet/maui.github/instructions/uitests.instructions.md · 23k | Copilot instructions | setupbuildteststyle+5 | 79/100 | 14 days ago |
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| dotnet/roslyn.github/instructions/Compiler.instructions.md · 21k | Copilot instructions | buildteststylearch+3 | 99/100 | today | |
| ardalis/CleanArchitecture.github/copilot-instructions.md · 18k | Copilot instructions | buildteststylearch+4 | 96/100 | 14 days ago | |
| dotnet/maui.github/instructions/templates.instructions.md · 23k | Copilot instructions | buildteststylearch+1 | 92/100 | 14 days ago | |
| dotnet/maui.github/instructions/integration-tests.instructions.md · 23k | Copilot instructions | setupteststyledo-not | 92/100 | 14 days ago | |
| dotnet/roslyn.github/copilot-instructions.md · 21k | Copilot instructions | buildteststylearch+3 | 89/100 | 8 days ago | |
| we-promise/sure.github/copilot-instructions.md · 9.5k | Copilot instructions | setuptestlint-formatstyle+10 | 88/100 | 13 days ago | |
| microsoft/WSL.github/copilot-instructions.md · 33k | Copilot instructions | setupbuildtestlint-format+7 | 88/100 | 14 days ago | |
| PowerShell/PowerShell.github/instructions/start-native-execution.instructions.md · 55k | Copilot instructions | buildstylearchgit+1 | 86/100 | 14 days ago |
A badge carrying the measured quality of the strongest agent config file in this repository, out of 100. It reads from this index every time somebody loads your page, so it changes when the measurement changes and there is nothing to keep up to date. Free, no account, and the value is not something you or we can set by hand.
[](https://rulestack.kynth.studio/configs/dotnet-maui-github-instructions-sandbox-instructions)Would rather not hotlink us? Every badge is also served in shields.io’s endpoint schema, so shields renders the image and your readers never talk to our domain:
Published by Toolproof, the masthead over this index and eight others. The method behind the number is at toolproof.kynth.studio/methodology, and the whole thing is readable as JSON with no key at /api.