Skip to content
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 some UITests from Issues folder in Appium-2 #27064

Merged
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
5 changes: 3 additions & 2 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue1685.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace Maui.Controls.Sample.Issues
{

[Issue(IssueTracker.Github, 1685, "Entry clears when upadting text from native with one-way binding", PlatformAffected.Android | PlatformAffected.iOS | PlatformAffected.WinPhone, NavigationBehavior.PushModalAsync)]
[Issue(IssueTracker.Github, 1685, "Entry clears when updating text from native with one-way binding", PlatformAffected.Android | PlatformAffected.iOS | PlatformAffected.WinPhone)]
public class Issue1685 : TestContentPage
{
const string ButtonId = "Button1685";
Expand Down Expand Up @@ -46,7 +46,8 @@ protected override void Init()

var entry = new Entry()
{
Placeholder = "Entry"
Placeholder = "Entry",
AutomationId = "TestEntry",
};
entry.SetBinding(Entry.TextProperty, "EntryValue", BindingMode.OneWay);

Expand Down
16 changes: 6 additions & 10 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue1769.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,28 +43,24 @@ public SwitchDemoPage()
HorizontalOptions = LayoutOptions.Center
};

#pragma warning disable CS0618 // Type or member is obsolete

var switcher = new Switch
{
AutomationId = SwitchAutomatedId,
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.CenterAndExpand
VerticalOptions = LayoutOptions.Center
};
#pragma warning restore CS0618 // Type or member is obsolete

switcher.Toggled += switcher_Toggled;

#pragma warning disable CS0618 // Type or member is obsolete
#pragma warning disable CS0612 // Type or member is obsolete
_label = new Label
{
AutomationId = string.Format(SwitchIsNowLabelTextFormat, switcher.IsToggled),
AutomationId = "SwitchLabel",
Text = string.Format(SwitchIsNowLabelTextFormat, switcher.IsToggled),
FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
FontSize = 20,
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.CenterAndExpand
VerticalOptions = LayoutOptions.Center
};
#pragma warning restore CS0612 // Type or member is obsolete
#pragma warning restore CS0618 // Type or member is obsolete

// Accomodate iPhone status bar.
Padding = DeviceInfo.Platform == DevicePlatform.iOS ? new Thickness(10, 20, 10, 5) : new Thickness(10, 0, 10, 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,19 @@ public Issue11962(TestDevice testDevice) : base(testDevice)
[Test]
[Category(UITestCategories.WebView)]
[Category(UITestCategories.Compatibility)]
[FailsOnAndroidWhenRunningOnXamarinUITest]
public void WebViewDisposesProperly()
{
App.WaitForElement("NextButton");
App.Tap("NextButton");
App.WaitForElement("BackButton");
App.Tap("BackButton");
App.WaitForElement("NextButton");
App.Tap("NextButton");
App.WaitForElement("BackButton");
App.Tap("BackButton");
App.WaitForElement("NextButton");
App.Tap("NextButton");
App.WaitForElement("BackButton");
App.Tap("BackButton");
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if IOS

using NUnit.Framework;
using UITest.Appium;
using UITest.Core;
Expand All @@ -9,6 +9,9 @@ public class Issue11969 : _IssuesUITest
{
const string SwipeViewId = "SwipeViewId";
const string SwipeButtonId = "SwipeButtonId";
const string TestPassId = "TestPassId";
const string SwipeViewCheckBoxId = "SwipeViewCheckBoxId";
const string SwipeViewContentCheckBoxId = "SwipeViewContentCheckBoxId";

const string Failed = "SwipeView Button not tapped";
const string Success = "SUCCESS";
Expand All @@ -22,16 +25,22 @@ public Issue11969(TestDevice testDevice) : base(testDevice)
[Test]
[Category(UITestCategories.SwipeView)]
[Category(UITestCategories.Compatibility)]
[FailsOnIOSWhenRunningOnXamarinUITest]
public void SwipeDisableChildButtonTest()
{
App.WaitForNoElement(Failed);
App.WaitForElement(SwipeViewId);
App.Tap("SwipeViewCheckBoxId");
App.Tap("SwipeViewContentCheckBoxId");
App.WaitForElement(TestPassId);
App.WaitForElement("Item 1");
App.WaitForElement(SwipeViewCheckBoxId);
App.Tap(SwipeViewCheckBoxId);

App.WaitForElement(SwipeViewContentCheckBoxId);
App.Tap(SwipeViewContentCheckBoxId);

App.WaitForElement(SwipeButtonId);
App.Tap(SwipeButtonId);
App.WaitForNoElement(Success);

App.WaitForElement("Ok");
App.Tap("Ok");
App.WaitForElement(TestPassId);
}
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@ public Issue1267(TestDevice testDevice) : base(testDevice)
[Test]
[Category(UITestCategories.Layout)]
[Category(UITestCategories.Compatibility)]
[FailsOnIOSWhenRunningOnXamarinUITest]
[FailsOnMacWhenRunningOnXamarinUITest]
public void StarInGridDoesNotCrash()
{
App.WaitForNoElement(Success);
App.WaitForElement(Success);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public Issue1469(TestDevice testDevice) : base(testDevice)
[Test]
[Category(UITestCategories.LifeCycle)]
[Category(UITestCategories.Compatibility)]
[FailsOnAllPlatformsWhenRunningOnXamarinUITest]
public void Issue1469Test()
{
App.WaitForElement(Go);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if ANDROID

using NUnit.Framework;
using UITest.Appium;
using UITest.Core;
Expand All @@ -14,18 +14,16 @@ public Issue1685(TestDevice testDevice) : base(testDevice)
{
}

public override string Issue => "Entry clears when upadting text from native with one-way binding";
public override string Issue => "Entry clears when updating text from native with one-way binding";

[Test]
[Category(UITestCategories.Entry)]
[Category(UITestCategories.Compatibility)]
[FailsOnAndroidWhenRunningOnXamarinUITest]
public void EntryOneWayBindingShouldUpdate()
{
Copy link
Contributor

Choose a reason for hiding this comment

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

This test is failing on iOS and Catalyst:

   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 2163
   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 2180
   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 665
   at Microsoft.Maui.TestCases.Tests.Issues.Issue1685.EntryOneWayBindingShouldUpdate() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1685.cs:line 24
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

Could you review it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @jsuarezruiz ,
These case failure encountered issues on Windows. I suspect there might have been a typo in the string that was autocorrected while entering the text. The problem has now been resolved, and I have committed the changes. Please review them and share any concerns you may have.

App.WaitForElement(ButtonId);
App.Tap(ButtonId);
App.WaitForNoElement(Success);
Assert.That(App.FindElement("TestEntry").GetText(), Is.EqualTo(Success));
}
}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using NUnit.Framework;
using NUnit.Framework;
using NUnit.Framework.Legacy;
using UITest.Appium;
using UITest.Core;
Expand Down Expand Up @@ -26,11 +26,13 @@ public void Issue1747Test()

var toggleSwitch = App.FindElement(ToggleSwitchAutomationId);
ClassicAssert.AreNotEqual(toggleSwitch, null);

Assert.That(toggleSwitch?.IsEnabled(), Is.False);
App.WaitForElement(ToggleButtonAutomationId);
App.Tap(ToggleButtonAutomationId);

toggleSwitch = App.FindElement(ToggleSwitchAutomationId);
ClassicAssert.AreNotEqual(toggleSwitch, null);
Assert.That(toggleSwitch?.IsEnabled(), Is.True);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@ public Issue1769(TestDevice testDevice) : base(testDevice)
[Test]
[Category(UITestCategories.Switch)]
[Category(UITestCategories.Compatibility)]
[FailsOnAllPlatformsWhenRunningOnXamarinUITest]
public void Issue1769Test()
{
App.WaitForElement(GoToPageTwoButtonText);
App.Tap(GoToPageTwoButtonText);

App.WaitForElement(SwitchAutomatedId);
App.WaitForElement(string.Format(SwitchIsNowLabelTextFormat, false));
Assert.That(App.FindElement("SwitchLabel").GetText(), Is.EqualTo(string.Format(SwitchIsNowLabelTextFormat, false)));
App.Tap(SwitchAutomatedId);
App.WaitForElement(string.Format(SwitchIsNowLabelTextFormat, true));
}
Assert.That(App.FindElement("SwitchLabel").GetText(), Is.EqualTo(string.Format(SwitchIsNowLabelTextFormat, true)));
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using NUnit.Framework;
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

Expand Down
Loading