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 ported UITests from Xamarin.UITests to Appium - 54 #26676

Merged
merged 4 commits into from
Dec 19, 2024
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 @@ -31,7 +31,9 @@ Layout CreateContent()
ItemsSource = _listViewItemSource,
IsPullToRefreshEnabled = true,
IsGroupingEnabled = true,
GroupShortNameBinding = new Binding("Key"),
// While using this GroupShortNameBinding property it throws an exception on Windows
// for more information:/~https://github.com/dotnet/maui/issues/26534. For this test case we don't need this property.
// GroupShortNameBinding = new Binding("Key"),
GroupHeaderTemplate = new DataTemplate(typeof(HeaderCell)),
HasUnevenRows = true,
ItemTemplate = new DataTemplate(typeof(ContactItemTemplate))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@ public Bugzilla23942(TestDevice testDevice) : base(testDevice)
[Test]
[Category(UITestCategories.LifeCycle)]
[Category(UITestCategories.Compatibility)]
[FailsOnIOSWhenRunningOnXamarinUITest]
[FailsOnMacWhenRunningOnXamarinUITest]
public void Bugzilla23942Test()
{
App.WaitForNoElement("success");
App.WaitForElement("success");
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#if ANDROID
using NUnit.Framework;
using OpenQA.Selenium.Appium;
using UITest.Appium;
using UITest.Core;

Expand All @@ -16,13 +14,11 @@ public Bugzilla25662(TestDevice testDevice) : base(testDevice)

[Test]
[Category(UITestCategories.Cells)]
[FailsOnIOSWhenRunningOnXamarinUITest]
[FailsOnWindowsWhenRunningOnXamarinUITest]
public void Bugzilla25662Test()
{
App.WaitForElement("One");
App.Tap("One");
App.WaitForNoElement("FAIL");
}
}
#endif

Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#if TEST_FAILS_ON_IOS && TEST_FAILS_ON_CATALYST
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;
Expand All @@ -18,26 +17,11 @@ public Bugzilla25979(TestDevice testDevice) : base(testDevice)
public void Bugzilla25979Test()
{
App.WaitForElement("PageOneButtonId");
App.Screenshot("At page one");

App.Tap("PageOneButtonId");
#if MACCATALYST
System.Threading.Thread.Sleep(2000);
#endif

App.WaitForElement("PageTwoButtonId");
App.Screenshot("At page two - I didn't crash");

App.WaitForElementTillPageNavigationSettled("PageTwoButtonId");
App.Tap("PageTwoButtonId");
#if MACCATALYST
System.Threading.Thread.Sleep(2000);
#endif

App.WaitForElement("PopButton");
App.Screenshot("At page three - I didn't crash");

App.WaitForElementTillPageNavigationSettled("PopButton");
App.Tap("PopButton");
App.WaitForNoElement("PopAttempted");
App.WaitForElement("PopAttempted");
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,11 @@ public Bugzilla29363(TestDevice testDevice) : base(testDevice)
[Test]
[Category(UITestCategories.Navigation)]
[Category(UITestCategories.Compatibility)]
[FailsOnIOSWhenRunningOnXamarinUITest]
[FailsOnMacWhenRunningOnXamarinUITest]
public void PushButton()
{
App.WaitForElement("ModalPushPopTest");
App.Tap("ModalPushPopTest");
Thread.Sleep(2000);

// if it didn't crash, yay
App.WaitForElement("ModalPushPopTest");
App.WaitForElementTillPageNavigationSettled("ModalPushPopTest");
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using NUnit.Framework;
#if TEST_FAILS_ON_WINDOWS //PressEnter Method not supported on Windows
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

Expand All @@ -15,21 +16,16 @@ public Bugzilla29453(TestDevice testDevice) : base(testDevice)
[Test]
[Category(UITestCategories.Navigation)]
[Category(UITestCategories.Compatibility)]
[FailsOnAllPlatformsWhenRunningOnXamarinUITest]
public void Bugzilla29453Test()
{
App.Screenshot("I am at Issue Bugzilla29453");
App.WaitForElement("Page1");
App.Tap("btnGotoPage2");
App.WaitForElement("entryText");
App.Tap("entryText");
App.EnterText("entryText", "XF");

App.DismissKeyboard();
App.Back();

// TODO: Implement PressEnter method.
//App.PressEnter();
//App.WaitForElement("Page1");
App.PressEnter();
App.WaitForElement("Page1");
}
}
}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#if IOS
using NUnit.Framework;
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

Expand All @@ -16,17 +15,14 @@ public Bugzilla31395(TestDevice testDevice) : base(testDevice)
[Test]
[Category(UITestCategories.Navigation)]
[Category(UITestCategories.Compatibility)]
[FailsOnIOSWhenRunningOnXamarinUITest]
[FailsOnMacWhenRunningOnXamarinUITest]
public void Bugzilla31395Test()
{
App.WaitForElement("SwitchMainPage");
Assert.DoesNotThrow(() =>
{
App.Tap("SwitchMainPage");
});
App.WaitForNoElement("Hello");
App.WaitForElement("Hello");
}
}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#if IOS
using NUnit.Framework;
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

Expand All @@ -11,18 +10,14 @@ public Bugzilla31688(TestDevice testDevice) : base(testDevice)
{
}

public override string Issue => "[Bug] Exception Ancestor must be provided for all pushes except first";
public override string Issue => "'Navigation.InsertPageBefore()' does not work for more than two pages, \"throws java.lang.IndexOutOfBoundsException: index=3 count=2";

[Test]
[Category(UITestCategories.Navigation)]
[Category(UITestCategories.Compatibility)]
[FailsOnAndroidWhenRunningOnXamarinUITest]
[FailsOnIOSWhenRunningOnXamarinUITest]
[FailsOnMacWhenRunningOnXamarinUITest]
public void Bugzilla31688Test()
{
App.WaitForNoElement("Page3");
App.WaitForElement("Page3");
}
}
}
#endif
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#if TEST_FAILS_ON_CATALYST && TEST_FAILS_ON_WINDOWS
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;
Expand All @@ -15,20 +14,10 @@ public Bugzilla32148(TestDevice testDevice) : base(testDevice)

[Test]
[Category(UITestCategories.ListView)]
[FailsOnIOSWhenRunningOnXamarinUITest]
public void Bugzilla32148Test()
{
if (App is not AppiumApp app2 || app2 is null || app2.Driver is null)
{
throw new InvalidOperationException("Cannot run test. Missing driver to run quick tap actions.");
}

App.WaitForNoElement("Contact0 LastName");
var searchButton = app2.Driver.FindElement(OpenQA.Selenium.By.XPath("//*[@text='" + "Search" + "']"));
searchButton.Click();

App.WaitForNoElement("Contact0 LastName");
App.Screenshot("For manual review, verify that the first cell is visible");
App.WaitForElement("Contact0 LastName");
App.Tap("Search");
App.WaitForElementTillPageNavigationSettled("Contact0 LastName");
}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#if IOS
using NUnit.Framework;
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

Expand All @@ -14,34 +13,19 @@ public Bugzilla32206(TestDevice testDevice) : base(testDevice)
public override string Issue => "ContextActions cause memory leak: Page is never destroyed";

[Test]
[Category(UITestCategories.Page)]
[Category(UITestCategories.Compatibility)]
[FailsOnIOSWhenRunningOnXamarinUITest]
[Category(UITestCategories.ContextActions)]
public void Bugzilla32206Test()
{
try
for (var n = 0; n < 10; n++)
{
for (var n = 0; n < 10; n++)
{
App.WaitForElement("Push");
App.Tap("Push");

App.WaitForElement("ListView");
App.Back();
}

// At this point, the counter can be any value, but it's most likely not zero.
// Invoking GC once is enough to clean up all garbage data and set counter to zero
App.WaitForElement("GC");
App.Tap("GC");

App.WaitForNoElement("Counter: 0");
}
finally
{
App.Back();
App.WaitForElement("Push");
App.Tap("Push");
App.WaitForElement("ListView");
App.TapBackArrow();
}
App.WaitForElement("GC");
App.Tap("GC");
App.WaitForElement("Counter: 0");
}
}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#if TEST_FAILS_ON_CATALYST && TEST_FAILS_ON_WINDOWS
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;
Expand All @@ -15,14 +14,12 @@ public Bugzilla32462(TestDevice testDevice) : base(testDevice)

[Test]
[Category(UITestCategories.ListView)]
[FailsOnIOSWhenRunningOnXamarinUITest]
public void Bugzilla36729Test()
{
App.WaitForElement("Click!");
App.Tap("Click!");
App.WaitForElement("listview");
App.WaitForElement("some text 35");
App.Back();
App.TapBackArrow();
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@ public Bugzilla32615(TestDevice testDevice) : base(testDevice)
[Test]
[Category(UITestCategories.Navigation)]
[Category(UITestCategories.Compatibility)]
[FailsOnAllPlatformsWhenRunningOnXamarinUITest]
public async Task Bugzilla32615Test()
public void Bugzilla32615Test()
{
App.Tap("btnModal");
App.Tap("btnPop");
await Task.Delay(1000);
App.WaitForNoElement("1");
App.Tap("open");
App.Tap("pop");
App.WaitForElement("lblCount");
}
}
}
Loading