-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Testing] Rework Catalyst Test Runner to use startup arguments instead of UI navigation #31673
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Hey there @@NafeelaNazhir! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR reworks the Mac Catalyst test runner to enable direct test execution via startup arguments instead of requiring UI navigation. The change streamlines test execution by allowing tests to launch directly through environment variables and programmatic page creation.
Key Changes:
- Enhanced test lifecycle management for Mac Catalyst with direct page loading via startup arguments
- Introduced a new
_GalleryUITest
base class to simplify gallery-based test implementations - Added PageFactory mechanism for dynamic test page instantiation
Reviewed Changes
Copilot reviewed 76 out of 78 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
src/TestUtils/src/UITest.NUnit/UITestContextBase.cs |
Added Mac-specific app launch handling in InitialSetup |
src/TestUtils/src/UITest.NUnit/UITestBase.cs |
Enhanced teardown logic with Mac-specific app closure |
src/TestUtils/src/UITest.Appium/HelperExtensions.cs |
Added LaunchApp overload to support test name parameters |
src/TestUtils/src/UITest.Appium/AppiumCatalystApp.cs |
Enhanced Appium options to include environment variables |
src/TestUtils/src/UITest.Appium/Actions/AppiumLifecycleActions.cs |
Modified Mac app launch to use environment variables |
src/Controls/tests/TestCases.Shared.Tests/UtilExtensions.cs |
Updated NavigateToGallery to skip navigation for Catalyst |
src/Controls/tests/TestCases.Shared.Tests/UITest.cs |
Implemented Close and LaunchAppWithTest methods |
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/_IssuesUITest.cs |
Added Mac Catalyst startup argument support |
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/_GalleryUITest.cs |
New base class for gallery-based tests |
src/Controls/tests/TestCases.HostApp/TestCases.cs |
Added PageFactory property and TryToGetTestPage method |
src/Controls/tests/TestCases.HostApp/MauiProgram.cs |
Enhanced CreateDefaultMainPage with startup argument handling |
Various test classes | Updated to inherit from _GalleryUITest and added GalleryPageName properties |
@@ -20,7 +20,7 @@ public Bugzilla40092(TestDevice testDevice) : base(testDevice) | |||
[Category(UITestCategories.BoxView)] | |||
public void AllScreenIsBlack() | |||
{ | |||
#if !ANDROID // Display alert not shown in android also this is not a needed one for ensuring this case, so ignored the below steps on Android. | |||
#if !ANDROID && !MACCATALYST // Display alert is not shown on Android, and it is not required to validate this case, so the following steps are skipped for Android. For Catalyst, the test page loading flow has been modified, making the popup validation unnecessary here as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The comment should be split into separate lines for better readability and clarity. Consider formatting as a multi-line comment or breaking it into shorter, more focused comments.
#if !ANDROID && !MACCATALYST // Display alert is not shown on Android, and it is not required to validate this case, so the following steps are skipped for Android. For Catalyst, the test page loading flow has been modified, making the popup validation unnecessary here as well. | |
// Display alert is not shown on Android, and it is not required to validate this case, | |
// so the following steps are skipped for Android. | |
// For Catalyst, the test page loading flow has been modified, | |
// making the popup validation unnecessary here as well. | |
#if !ANDROID && !MACCATALYST |
Copilot uses AI. Check for mistakes.
public SearchBarFeatureTests(TestDevice testDevice) : base(testDevice) | ||
{ | ||
} | ||
override public string GalleryPageName => SearchBarFeatureMatrix; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The access modifier 'override' should come after 'public' according to C# coding conventions. It should be 'public override string GalleryPageName'.
override public string GalleryPageName => SearchBarFeatureMatrix; | |
public override string GalleryPageName => SearchBarFeatureMatrix; |
Copilot uses AI. Check for mistakes.
{ | ||
public const string ScrollViewFeatureMatrix = "ScrollView Feature Matrix"; | ||
override public string GalleryPageName => ScrollViewFeatureMatrix; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The access modifier 'override' should come after 'public' according to C# coding conventions. It should be 'public override string GalleryPageName'.
override public string GalleryPageName => ScrollViewFeatureMatrix; | |
public override string GalleryPageName => ScrollViewFeatureMatrix; |
Copilot uses AI. Check for mistakes.
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
Description of Change
This PR reopens the work from the closed #30651
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
PageFactory
mechanism 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:
Startup Argument Support: Added logic to retrieve test names from environment variables and dynamically load the corresponding test page in
CreateDefaultMainPage()
(MauiProgram.cs
).Dynamic Page Creation: Introduced a
PageFactory
property in theIssueModel
class to enable dynamic test page instantiation (TestCases.cs
).Direct Test Page Retrieval: Implemented
TryToGetTestPage()
inTestCaseScreen
to retrieve test pages by description usingPageFactory
(TestCases.cs
).Platform-Specific Test Lifecycle Improvements:
Mac Catalyst Test Configuration: Enhanced
_IssuesUITest
to pass test names as startup arguments and manage app launch/close lifecycle specifically for Mac Catalyst (_IssuesUITest.cs
). [1] [2]** Appium Options for Mac Catalyst**: Updated
AppiumCatalystApp
to include environment variables in Appium options for test execution (AppiumCatalystApp.cs
).Helper Methods for Test Execution:
Parameterized App Launch: Added a method to launch apps with additional parameters, supporting test-specific configurations (
HelperExtensions.cs
).Mac-Specific App Closure: Modified
FixtureOneTimeTearDown()
to handle app closure for Mac Catalyst during test teardown (UITestBase.cs
).Output
467025436-e594828d-93bb-4e41-b583-7d5b4ab2a0b9.mov
Issues Fixed
Fixes #30285