-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[Testing] Enabling ported UITests from Xamarin.UITests to Appium - 16 #26029
base: main
Are you sure you want to change the base?
[Testing] Enabling ported UITests from Xamarin.UITests to Appium - 16 #26029
Conversation
Co-authored-by: nivetha-nagalingam <[email protected]>
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
@@ -1,4 +1,5 @@ | |||
using NUnit.Framework; | |||
#if TEST_FAILS_ON_ANDROID && TEST_FAILS_ON_CATALYST && TEST_FAILS_ON_IOS && TEST_FAILS_ON_WINDOWS //Issue reproduced and logged: https://github.com/dotnet/maui/issues/26019. |
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 issue was a duplicated and has been closed, could you update the comment to replace it by #26026?
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.
Replaced the issue link and committed the changes, kindly review and share your feedback.
/// <param name="app">The IApp instance.</param> | ||
/// <param name="elementId">The id of the element to wait for.</param> | ||
/// <param name="timeout">Optional timeout for the wait operation. Default is null, which uses the default timeout.</param> | ||
public static void WaitForElementTillPageNavigationSettled(this IApp app, string elementId, TimeSpan? timeout = null) |
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.
Could include another override passing IQuery query
as parameter instead the elementId? In that way we can wait for elements based on a query.
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.
Thank you for your suggestion. I've added an override method WaitForElementTillPageNavigationSettled
which accepts the query parameter.
Please kindly review and share your feedback or have additional suggestions.
app.Tap(AppiumQuery.ByAccessibilityId("NavigationViewBackButton")); | ||
/// <param name="app">The IApp instance representing the main gateway to interact with the application.</param> | ||
/// <param name="customBackButtonIdentifier">Optional. The custom identifier for the back button. If not provided, default platform-specific identifiers will be used.</param> | ||
public static void TapBackArrow(this IApp app, string customBackButtonIdentifier = "") |
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.
Why not split in two methods?
static void TapBackArrow(this IApp app);
static void TapBackArrow(this IApp app, IQuery query);
The first one will just use the default platform-specific identifiers and the second one will allow any custom query like for example AppiumQuery.ByAccessibilityId("Back")
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.
Thank you for your suggestion. I've refactored the code into three methods:
- TapBackArrow(this IApp app)
- TapBackArrow(this IApp app, string customBackButtonIdentifier)
- TapBackArrow(this IApp app, IQuery query)
Please kindly review and share your feedback or have additional suggestions.
App.WaitForElementTillPageNavigationSettled(PushNewPage); | ||
App.Tap(PushNewPage); | ||
App.WaitForElementTillPageNavigationSettled(TabPage2); | ||
App.Tap(TabPage2); |
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.
Mnnn, maybe I could include a TapTab method that internally does the wait, and also in the case of Android the ToUpperCase.
Description of Change
This PR focuses on re-enabling and updating following tests from the Xamarin.UITest framework to be compatible with Appium. The tests, previously commented out, are reviewed, and modified to ensure they are functional with the Appium framework. We are going to enable tests in blocks in different PRs. This is the 16th group of tests enabled.
Add WaitForElementTillPageNavigationSettled Extension Method
Description
Also introduces a new extension method
WaitForElementTillPageNavigationSettled
to enhance the stability of UI tests, particularly for MacCatalyst applications. The method provides a more robust way to wait for elements during page transitions, helping to prevent null reference exceptions.TestCases