diff --git a/.github/instructions/uitests.instructions.md b/.github/instructions/uitests.instructions.md index f69bcb4f4aee..b8eb01bab8f3 100644 --- a/.github/instructions/uitests.instructions.md +++ b/.github/instructions/uitests.instructions.md @@ -523,6 +523,17 @@ cat /tmp/ios_crash.log | grep -A 20 -B 5 "Exception" 5. **Check for platform-specific issues** - iOS version compatibility, permissions, etc. 6. If you can't determine the fix, **ask for guidance** with the full exception details +### Dangerous System Commands (Never Run) + +**🚨 NEVER run these commands — they cause destructive system-wide side effects:** + +- **`tccutil reset`** — Wipes ALL macOS permissions (Accessibility, Camera, etc.) system-wide. This breaks Appium/WebDriverAgent, Xcode, and other tools. Once reset, permissions must be manually re-granted through System Settings. +- **`csrutil disable`** — Disables System Integrity Protection +- **`networksetup`** — Modifies network configuration +- **`defaults delete`** on system domains — Resets system preferences + +**General rule:** Do not run commands that modify macOS system-level privacy, security, or permission settings. If you need to check permissions, read them — never reset or modify them. + ## Before Committing Verify the following checklist before committing UI tests: diff --git a/.github/scripts/BuildAndRunHostApp.ps1 b/.github/scripts/BuildAndRunHostApp.ps1 index c6103609de46..60d15963eb66 100644 --- a/.github/scripts/BuildAndRunHostApp.ps1 +++ b/.github/scripts/BuildAndRunHostApp.ps1 @@ -260,7 +260,9 @@ if ($Platform -eq "catalyst") { & chmod +x $executablePath } - Write-Success "MacCatalyst app prepared (Appium will launch with test name)" + # Set MAC_APP_PATH so Appium mac2 driver can launch the app directly + $env:MAC_APP_PATH = $appPath + Write-Success "MacCatalyst app prepared (MAC_APP_PATH=$appPath)" } else { Write-Warn "MacCatalyst app not found at: $appPath" Write-Warn "Test may use wrong app bundle if another version is registered" diff --git a/.github/scripts/shared/Start-Emulator.ps1 b/.github/scripts/shared/Start-Emulator.ps1 index 9fd9d227331a..b842d840a6cc 100644 --- a/.github/scripts/shared/Start-Emulator.ps1 +++ b/.github/scripts/shared/Start-Emulator.ps1 @@ -6,7 +6,7 @@ .DESCRIPTION Handles device detection and startup for both Android and iOS platforms. - Android: Automatically selects and starts emulator with priority: API 30 Nexus > API 30 > Nexus > First available - - iOS: Automatically selects iPhone Xs with iOS 18.5 by default + - iOS: Automatically selects iPhone Xs with iOS 18.x (or iPhone 11 Pro with iOS 26.x) to match CI .PARAMETER Platform Target platform: "android" or "ios" @@ -344,10 +344,17 @@ if ($Platform -eq "android") { Write-Info "Auto-detecting iOS simulator..." $simList = xcrun simctl list devices available --json | ConvertFrom-Json - # Preferred devices in order of priority - $preferredDevices = @("iPhone 16 Pro", "iPhone 15 Pro", "iPhone 14 Pro", "iPhone Xs") # Preferred iOS versions in order (stable preferred, beta fallback) $preferredVersions = @("iOS-18", "iOS-17", "iOS-26") + # Preferred devices per iOS version to match CI configuration: + # iOS 18.x → iPhone Xs (matches CI default in UITest.cs) + # iOS 26.x → iPhone 11 Pro (matches CI visual test requirement) + # iOS 17.x → iPhone Xs (fallback) + $preferredDevicesPerVersion = @{ + "iOS-18" = @("iPhone Xs", "iPhone 16 Pro", "iPhone 15 Pro", "iPhone 14 Pro") + "iOS-17" = @("iPhone Xs", "iPhone 15 Pro", "iPhone 14 Pro") + "iOS-26" = @("iPhone 11 Pro", "iPhone 16 Pro", "iPhone 15 Pro") + } $selectedDevice = $null $selectedVersion = $null @@ -356,13 +363,16 @@ if ($Platform -eq "android") { foreach ($version in $preferredVersions) { if ($selectedDevice) { break } - # Get all runtimes matching this version prefix + # Get all runtimes matching this version prefix, sorted by version descending + # so the latest minor version is preferred (e.g., iOS-18-5 before iOS-18-3) $matchingRuntimes = $simList.devices.PSObject.Properties | - Where-Object { $_.Name -match $version } + Where-Object { $_.Name -match $version } | + Sort-Object { $_.Name } -Descending if ($matchingRuntimes) { - # Try each preferred device - foreach ($deviceName in $preferredDevices) { + # Try each preferred device for this version + $devicesForVersion = if ($preferredDevicesPerVersion.ContainsKey($version)) { $preferredDevicesPerVersion[$version] } else { @("iPhone Xs", "iPhone 16 Pro") } + foreach ($deviceName in $devicesForVersion) { $device = $null $deviceRuntime = $null foreach ($rt in $matchingRuntimes) { diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue16910.xaml b/src/Controls/tests/TestCases.HostApp/Issues/Issue16910.xaml index 0e44acbe1f7e..b790faef3092 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue16910.xaml +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue16910.xaml @@ -2,20 +2,35 @@ - - -