Skip to content

Add native coverage for screenshot-prone tests - #38919

Closed
kubaflo wants to merge 1 commit into
mainfrom
kubaflo-screenshot-free-regression-tests
Closed

kubaflo wants to merge 1 commit into
mainfrom
kubaflo-screenshot-free-regression-tests

Conversation

@kubaflo

@kubaflo kubaflo commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Description

This PR replaces a focused set of flaky full-window screenshot coverage with native assertions and screenshot-free UI checks:

  • Adds native Controls device-test coverage for Shell.SearchHandler.TextColor on iOS/MacCatalyst and Windows by asserting the real platform search control (UISearchBar / AutoSuggestBox) updates to red text after runtime property changes.
  • Replaces the VerifyShellSearch_TextColor full-window UI screenshot with a screenshot-free smoke assertion that text entry still works, while the native device tests protect the actual text-color mapping.
  • Splits Issue17389 UI coverage into independent stateful tests so the background-color test no longer depends on the tap-routing test running first.
  • Adds a Windows native regression test for the original Issue17389 / [Windows] - Fix InputTransparent layouts losing background color visibility #30311 fix: an InputTransparent layout keeps its non-hit-testable native background Canvas, with ZIndex=int.MinValue, full arranged bounds, expected brush color, rendered pixel color, and preservation across child mutations plus InputTransparent/background transitions.

Relationship to nearby PRs

Validation

  • git diff --check passed.
  • Attempted pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform maccatalyst -TestFilter "Category=Shell"; blocked before tests by stale/missing in-tree build tasks.
  • Attempted ./build.sh -restore -build -configuration Release -projects $(pwd)/Microsoft.Maui.BuildTasks.slnf /bl:BuildBuildTasks.binlog -warnAsError false; stopped after an extended workload-install/restore phase with no logged build errors yet.
  • Attempted direct .dotnet/dotnet build Microsoft.Maui.BuildTasks.slnf -c Release --no-restore /p:TreatWarningsAsErrors=false /bl:BuildBuildTasks-Narrow.binlog; failed due environment prerequisites unrelated to this diff: missing restored assets, missing net472 reference assemblies, and missing Android workload.
  • Attempted direct MacCatalyst-only Controls device-test build; still blocked by the in-tree build-task freshness check.

Windows-specific native background validation requires PR CI because this macOS host cannot run Windows device tests.

Add native Shell SearchHandler text color assertions and replace the flaky full-window text-color screenshot with a screenshot-free smoke assertion. Strengthen Issue17389 with independent tap-routing coverage and Windows native background-layer assertions that target the original InputTransparent background rendering regression.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 26, 2026 18:20
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 38919

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 38919"

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The Windows layout regression test has an unresolved child-clear lifecycle failure.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
What changed in this PR

Replaces flaky screenshot checks with native Shell assertions and independent UI tests, adding Windows layout regression coverage.

Changes:

  • Adds native SearchHandler text-color tests for iOS/MacCatalyst and Windows.
  • Replaces Shell screenshot coverage with a text-entry smoke test.
  • Splits Issue17389 scenarios into independent tests.
  • Adds Windows InputTransparent background-layer validation.
File Summary
src/​Controls/​tests/​TestCases.Shared.Tests/​Tests/​Issues/​Issue17389.cs Independent tap-routing and background-toggle tests.
src/​Controls/​tests/​TestCases.Shared.Tests/​Tests/​FeatureMatrix/​ShellSearchHandlerFeatureTests.cs Screenshot-free text-entry validation.
src/​Controls/​tests/​TestCases.HostApp/​Issues/​Issue17389.cs Test-state labels and automation identifiers.
src/​Controls/​tests/​DeviceTests/​Elements/​Shell/​ShellTests.Windows.cs Native AutoSuggestBox text-color assertion.
src/​Controls/​tests/​DeviceTests/​Elements/​Shell/​ShellTests.iOS.cs Native UISearchBar text-color assertion.
src/​Controls/​tests/​DeviceTests/​Elements/​Layout/​LayoutTests.Windows.cs Native background-layer regression coverage. Moderate issue: clearing cached children removes the background canvas while state remains non-null, causing the subsequent assertion to fail (4 votes). Also includes two nits regarding tautological ordering and arranged-size validation (1 vote each).

Comment on lines +96 to +97
transparentChild.Clear();
transparentChild.Add(new Label { Text = "Replacement", InputTransparent = false });
@kubaflo

kubaflo commented Sep 26, 2026

Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — 6a5cffba Deployed Sep 26, 2026 by kubaflo via conclusion #2102
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants