[Testing] Rework Catalyst Test Runner to use startup arguments instead of UI navigation#30651
Conversation
|
/azp run MAUI-UITests-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |
jsuarezruiz
left a comment
There was a problem hiding this comment.
One of the most repeated errors is the following one:
Exception details: System.TimeoutException: Timed out waiting for Go To Test button to appear
at UITest.Appium.HelperExtensions.Wait(Func`1 query, Func`2 satisfactory, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2475
at UITest.Appium.HelperExtensions.WaitForAtLeastOne(Func`1 query, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2490
at UITest.Appium.HelperExtensions.WaitForElement(IApp app, String marked, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency, Nullable`1 postTimeout) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 679
at Microsoft.Maui.TestCases.Tests.UtilExtensions.NavigateToGallery(IApp app, String page) in /_/src/Controls/tests/TestCases.Shared.Tests/UtilExtensions.cs:line 34
at Microsoft.Maui.TestCases.Tests.CheckBoxUITests.NavigateToGallery() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/CheckBoxUITests.cs:line 17
at Microsoft.Maui.TestCases.Tests.CoreGalleryBasePageTest.FixtureSetup() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/CoreGalleryBasePageTest.cs:line 19
Could you try to run locally a group of tests, like for example all the test from CheckBoxUITests.cs? What's the result?
@jsuarezruiz @rmarinho , Resolved the issues and committed changes, also ensured with multiple controls combination. Can you please re-trigger the CI once.
|
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
There was a problem hiding this comment.
Pull Request Overview
This pull request reworks the Mac Catalyst test runner to streamline test execution by launching test pages directly via startup arguments instead of UI navigation. The changes enable programmatic test execution, reducing test setup time and improving reliability by bypassing the manual navigation flow required for other platforms.
Key changes include:
- Added environment variable support for passing test names at startup to directly load test pages
- Introduced
PageFactorymechanism for dynamic page creation in test cases - Enhanced Mac Catalyst-specific test lifecycle management with direct app launch/close operations
Reviewed Changes
Copilot reviewed 60 out of 60 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| MauiProgram.cs | Added logic to check environment variables for test names and directly create test pages for Mac Catalyst |
| TestCases.cs | Added PageFactory property and TryToGetTestPage() method for dynamic page retrieval |
| CorePageView.cs | Added TryToGetGalleryPage() method for gallery page retrieval by title |
| _IssuesUITest.cs | Enhanced with Mac Catalyst startup argument configuration and direct test launching |
| UITestContextBase.cs | Added abstract methods for app lifecycle management and Mac-specific initialization |
| UITestBase.cs | Modified teardown to handle Mac-specific app closure |
| AppiumCatalystApp.cs | Updated to include environment variables in Appium options |
| AppiumLifecycleActions.cs | Modified to use launchApp instead of activateApp for Mac with environment variables |
| HelperExtensions.cs | Added parameterized app launch method supporting test-specific configurations |
| UtilExtensions.cs | Updated navigation logic to skip UI navigation for Mac Catalyst |
| Multiple test files | Added GalleryPageName property overrides and converted to _GalleryUITest base class |
Comments suppressed due to low confidence (3)
src/Controls/tests/TestCases.Shared.Tests/Tests/SwipeViewUITests.cs:11
- The constant name
SwipeViewGalleryshould follow the existing naming pattern. The previous constant was namedScrollViewGallerybut should have beenSwipeViewGalleryto match the content.
const string SwipeViewGallery = "SwipeView Gallery";
...rols/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/CollectionView_GroupingFeatureTests.cs
Show resolved
Hide resolved
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>


Description of Change
This pull request introduces functionality to streamline test execution by allowing tests to be launched directly via startup arguments or programmatically. Key changes include adding support for passing test names as environment variables, introducing a
PageFactorymechanism for dynamic page creation, and enhancing test lifecycle management for specific platforms like Mac Catalyst.Note: This PR is an extension of the PR(#30286) with a proper implementation.
Test Execution Enhancements:
CreateDefaultMainPage()(MauiProgram.cs).PageFactoryproperty in theIssueModelclass to enable dynamic test page instantiation (TestCases.cs).TryToGetTestPage()inTestCaseScreento retrieve test pages by description usingPageFactory(TestCases.cs).Platform-Specific Test Lifecycle Improvements:
_IssuesUITestto pass test names as startup arguments and manage app launch/close lifecycle specifically for Mac Catalyst (_IssuesUITest.cs). [1] [2]AppiumCatalystAppto include environment variables in Appium options for test execution (AppiumCatalystApp.cs).Helper Methods for Test Execution:
HelperExtensions.cs).FixtureOneTimeTearDown()to handle app closure for Mac Catalyst during test teardown (UITestBase.cs).Output
Screen.Recording.2025-07-15.at.7.08.33.PM.mov
Issues Fixed
Fixes #30285