Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,8 @@ public void ShapesPathReceiveGestureRecognizers()
{
var testLabel = App.WaitForFirstElement(StatusLabelId);
Assert.That(testLabel.ReadText(), Is.EqualTo(ResetStatus));
var labelRect = App.WaitForFirstElement(StatusLabelId).GetRect(); // Path element not able get via automationid so getting the rect of the label calculated points to tap on the path
#if MACCATALYST // TapCoordinates is not working on MacCatalyst Issue: https://github.com/dotnet/maui/issues/19754
App.ClickCoordinates(labelRect.X + 3, labelRect.Y - 10);
#else
var labelRect = App.WaitForFirstElement(StatusLabelId).GetRect(); // Path element not able get via AutomationId so getting the rect of the label calculated points to tap on the path
App.TapCoordinates(labelRect.X + 3, labelRect.Y - 10);
#endif
App.WaitForElement(StatusLabelId);
Assert.That(testLabel.ReadText(), Is.EqualTo(ClickedStatus));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,7 @@ public void VariousSpanGesturePermutation()

void PerformGestureAction(float x, float y)
{
#if MACCATALYST // TapCoordinates is not working on MacCatalyst Issue: https://github.com/dotnet/maui/issues/19754
App.ClickCoordinates(x, y);
#else
App.TapCoordinates(x, y);
#endif
}

void PerformGestureActionForFirstSpan(Rectangle target)
Expand Down
36 changes: 22 additions & 14 deletions src/TestUtils/src/UITest.Appium/HelperExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ public static class HelperExtensions
/// <summary>
/// For desktop, this will perform a mouse click on the target element.
/// For mobile, this will tap the element.
/// This API works for all platforms whereas TapCoordinates currently doesn't work on Catalyst
/// https://github.com/dotnet/maui/issues/19754
/// </summary>
/// <param name="app">Represents the main gateway to interact with an app.</param>
/// <param name="element">Target Element.</param>
Expand All @@ -29,8 +27,6 @@ public static void Tap(this IApp app, string element)
/// <summary>
/// For desktop, this will perform a mouse click on the target element.
/// For mobile, this will tap the element.
/// This API works for all platforms whereas TapCoordinates currently doesn't work on Catalyst
/// https://github.com/dotnet/maui/issues/19754
/// </summary>
/// <param name="app">Represents the main gateway to interact with an app.</param>
/// <param name="query">Represents the query that identify an element by parameters such as type, text it contains or identifier.</param>
Expand Down Expand Up @@ -308,8 +304,6 @@ public static void Click(this IUIElement element)
/// <summary>
/// For desktop, this will perform a mouse click on the target element.
/// For mobile, this will tap the element.
/// This API works for all platforms whereas TapCoordinates currently doesn't work on Catalyst
/// https://github.com/dotnet/maui/issues/19754
/// </summary>
/// <param name="element">Target Element.</param>
public static void Tap(this IUIElement element)
Expand Down Expand Up @@ -409,11 +403,18 @@ internal static void DoubleTap(this IApp app, IUIElement? element)
/// <param name="y">The y coordinate to double tap.</param>
public static void DoubleTapCoordinates(this IApp app, float x, float y)
{
app.CommandExecutor.Execute("doubleTapCoordinates", new Dictionary<string, object>
if (app is AppiumCatalystApp)
{
{ "x", x },
{ "y", y }
});
app.DoubleClickCoordinates(x, y); // Directly invoke coordinate-based double click for AppiumCatalystApp.
}
else
{
app.CommandExecutor.Execute("doubleTapCoordinates", new Dictionary<string, object>
{
{ "x", x },
{ "y", y }
});
}
}

/// <summary>
Expand Down Expand Up @@ -1422,11 +1423,18 @@ public static void ClickCoordinates(this IApp app, float x, float y)
/// <param name="y">The y coordinate to tap.</param>
public static void TapCoordinates(this IApp app, float x, float y)
{
app.CommandExecutor.Execute("tapCoordinates", new Dictionary<string, object>
if (app is AppiumCatalystApp)
{
{ "x", x },
{ "y", y }
});
app.ClickCoordinates(x, y); // // Directly invoke coordinate-based click for AppiumCatalystApp.
}
else
{
app.CommandExecutor.Execute("tapCoordinates", new Dictionary<string, object>
{
{ "x", x },
{ "y", y }
});
}
}

/// <summary>
Expand Down
Loading