Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Housekeeping] Fix iOS 14 broken tests #13638

Merged
merged 3 commits into from
Feb 5, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -56,10 +56,14 @@ protected override void Init()
Content = new StackLayout { Children = { label, listView, listView2, listView3 } };
}

#if (UITEST && __IOS__)
#if UITEST && __IOS__
[Test]
public void Bugzilla43161Test()
{
// Avoid launch the test (temporarily) in iOS 14 due to a bug sometimes not rendering some cell.
if (RunningApp.IsVersionOrNewer(14))
Copy link
Member

Choose a reason for hiding this comment

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

well not sure ignoring the test is a good call since it's actually catching the failure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to avoid ignore this tests in iOS 14.

return;

RunningApp.WaitForElement(q => q.Marked("0"));
RunningApp.WaitForElement(q => q.Marked("10"));
RunningApp.WaitForElement(q => q.Marked("20"));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.ComponentModel;
using System.Windows.Input;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
using Xamarin.Forms.Shapes;

Expand All @@ -21,6 +18,9 @@ namespace Xamarin.Forms.Controls.Issues
#endif
public partial class Issue12685 : TestContentPage
{
const string StatusLabelId = "StatusLabelId";
const string PathId = "PathId";

const string ResetStatus = "Path touch event not fired, touch path above.";
const string ClickedStatus = "Path was clicked, click reset button to start over.";

Expand All @@ -29,7 +29,7 @@ protected override void Init()
var layout = new StackLayout();
var statusLabel = new Label
{
AutomationId = "LabelValue",
AutomationId = StatusLabelId,
Text = ResetStatus,
};

Expand All @@ -42,6 +42,7 @@ protected override void Init()

var path = new Path
{
AutomationId = PathId,
Data = pathGeometry,
Fill = lgb
};
Expand Down Expand Up @@ -69,11 +70,12 @@ protected override void Init()
[Test]
public void ShapesPathReceiveGestureRecognizers()
{
var testLabel = RunningApp.WaitForFirstElement("LabelValue");
var testLabel = RunningApp.WaitForFirstElement(StatusLabelId);
Assert.AreEqual(ResetStatus, testLabel.ReadText());
var pathRect = testLabel.Rect;
RunningApp.TapCoordinates(pathRect.X + 100, pathRect.Y-100);
Assert.AreEqual(ClickedStatus, RunningApp.WaitForFirstElement("LabelValue").ReadText());
var testPath = RunningApp.WaitForFirstElement(PathId);
var pathRect = testPath.Rect;
RunningApp.TapCoordinates(pathRect.X + 1, pathRect.Y + 1);
Assert.AreEqual(ClickedStatus, RunningApp.WaitForFirstElement(StatusLabelId).ReadText());
}
#endif
}
Expand Down
10 changes: 10 additions & 0 deletions Xamarin.Forms.Core.UITests.Shared/Utilities/AppExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,16 @@ public static bool IsApiHigherThan(this IApp app, int apiLevel, string apiLabelI
return true;
}

#if __IOS__
public static bool IsVersionOrNewer(this IApp app, int version)
{
if (app is iOSApp iOSApp)
return iOSApp.Device.OSVersion.Major >= version;

return true;
}
#endif

public static void TapOverflowMenuButton(this IApp app)
{
#if __ANDROID__
Expand Down