Add Windows MAUI integration tests with Appium screenshot verification#3969
Open
mattleibow wants to merge 7 commits into
Open
Add Windows MAUI integration tests with Appium screenshot verification#3969mattleibow wants to merge 7 commits into
mattleibow wants to merge 7 commits into
Conversation
- Add MauiWindowsTests.cs with SKCanvasView and SKGLView test cases - Add Appium-based screenshot capture with geometric canvas fallback (WinUI raw surfaces lack UIA peers, so commandBar y=40+h=60 used as anchor) - Add AppiumFixture.cs with shell-wrapper for launching Appium on Windows - Add PlatformTestBase verbose logging and xunit.runner.json with diagnostics - Add reference-test-image-windows.png from real GPU-rendered app output - MauiTestBase: virtual hooks PrepareWindowAsync/GetFullScreenshot/GetCanvasBounds - All tests pass: SKCanvasView 100%, SKGLView 99.3% Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…eadlock - Update Dockerfile base image from dotnet/sdk:8.0 to dotnet/sdk:10.0 to match the net10.0 target framework of the test projects - Fix deadlock in PlatformTestBase.Run() where stdout and stderr were read sequentially — if the process fills the stderr buffer while we're waiting for stdout to close, the process blocks and both sides hang Fix: read both streams concurrently with Task.WhenAll, then apply the timeout via Task.WhenAny, and use process.Kill(entireProcessTree: true) - Increase docker build timeout from 180s to 600s to allow dotnet restore to download packages from the EAP feed on first run (takes ~3 min) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Remove duplicate 'Crop region' log line in MauiTestBase.VerifyWithAppium (VerifyCanvasScreenshot already logs it) - Remove unused 'completed' variable from PlatformTestBase.Run() - Fix RunAdbCommand in MauiAndroidTests to read stderr concurrently with stdout, preventing a potential deadlock when adb writes to stderr - Remove trailing blank line in MauiWindowsTests.cs Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Root cause: AutomationId='SkiaCanvas' was on SKCanvasView/SKGLView, which are
WinUI raw rendering surfaces (SwapChainPanel-based) with NO UIA automation peers.
WinAppDriver could never find the element, so a geometric fallback ran instead.
That fallback centered the canvas below the commandBar height offset, but the
MAUI ContentPage centers its content in the full page - so y was ~34px too low,
clipping the top of the canvas and the 'SkiaSharp Test' text.
Fix: move AutomationId='SkiaCanvas' to the wrapping Grid element, which has a
proper WinUI UIA peer (GridAutomationPeer). The Grid also gets explicit
WidthRequest/HeightRequest so its bounds match the canvas exactly. This one
change makes the same accessibility id lookup work on all platforms:
- Windows: UIA GridAutomationPeer -> WinAppDriver finds it
- Android: contentDescription set by MAUI -> UIAutomator2 finds it
- iOS: accessibilityIdentifier -> XCUITest finds it
Removed:
- MauiWindowsTests.GetCanvasBounds override (try/catch + geometric fallback)
- MauiTestBase.FindCanvasElement virtual (unnecessary indirection)
- MauiTestBase.PrepareWindowAsync virtual (never overridden)
- MauiTestBase.GetFullScreenshot virtual (never overridden)
- MauiAndroidTests.FindCanvasElement override (base works for Grid)
- reference-test-image-windows.png (captured with wrong crop; falls back to
base CPU reference which is sufficient for GPU similarity >= 95%)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use commandBar as geometric anchor to calculate canvas position since WinUI MAUI does not expose page content elements in the UIA tree. The entire page content below the commandBar is a single opaque Custom element with no accessible children, so element lookup via AutomationId/accessibility id is not possible on Windows. The commandBar AppBar is the only MAUI Shell navigation element reliably present in the UIA tree. Also add reference-test-image-windows.png captured from the GPU-rendered Windows app (DirectX/ANGLE) as a platform-specific reference to avoid false failures from CPU vs GPU text rendering differences (~82% similarity without platform-specific reference vs 99-100% with it). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Bring in latest main (37 commits) including CI fixes, new APIs, and workflow improvements. No conflicts. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
📦 Try the packages from this PRWarning Do not run these scripts without first reviewing the code in this PR. Step 1 — Download the packages bash / macOS / Linux: curl -fsSL https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.sh | bash -s -- 3969PowerShell / Windows: iex "& { $(irm https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.ps1) } 3969"Step 2 — Add the local NuGet source dotnet nuget add source ~/.skiasharp/hives/pr-3969/packages --name skiasharp-pr-3969More options
Or download manually from Azure Pipelines — look for the Remove the source when you're done: dotnet nuget remove source skiasharp-pr-3969 |
Contributor
|
📖 Documentation Preview The documentation for this PR has been deployed and is available at: 🔗 View Staging Site This preview will be updated automatically when you push new commits to this PR. This comment is automatically updated by the documentation staging workflow. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Windows MAUI integration tests using Appium + WinAppDriver for screenshot-based verification of
SKCanvasViewandSKGLViewrendering.Changes
New: Windows MAUI Tests (
MauiWindowsTests)reference-test-image-windows.png)commandBarAppBar as a geometric anchor to calculate canvas bounds (WinUI MAUI doesn't expose page content in the UIA tree — the entire content area is a single opaqueCustomelement)Fixed: Test Infrastructure
AutomationIdfrom canvas element to outerGridwrapper (canvas elements likeSwapChainPanelhave no UIA automation peers on Windows)MauiTestBase.cs: Removed unnecessary virtual methods (FindCanvasElement,PrepareWindowAsync,GetFullScreenshot) — simplified the test baseRunAdbCommandadb.exeextension on Windowscmd.exe /Con Windows,/bin/bash -con Unix) for cross-platform process executionTest Results (verified on this machine)
Technical Notes
Why geometric calculation instead of element lookup on Windows?
WinUI MAUI renders all page content as a single opaque
Customelement with no children in the UIA accessibility tree. Only MAUI Shell navigation elements (likecommandBar) are accessible. The canvas position is calculated geometrically:commandBar.Y + commandBar.Heightgives the content top, then the canvas is centered within the remaining space.