Skip to content

Commit

Permalink
[Testing] Enabling ported UITests from Xamarin.UITests to Appium - 18 (
Browse files Browse the repository at this point in the history
…#26097)

* Enabled UITests from XamarinUITests to Appium - 18th set (#15)

* migrated uitests xamarian to appium

* added a region and command line

* Issue2891 migrated to appium

* Updated the migrated code changes

* Added issue report link

* Update Bugzilla40161

---------

Co-authored-by: LogishaSelvarajSF4525 <[email protected]>

* Updated test

---------

Co-authored-by: LogishaSelvarajSF4525 <[email protected]>
Co-authored-by: Javier Suárez <[email protected]>
  • Loading branch information
3 people authored Dec 2, 2024
1 parent 0d2c8f3 commit 0f6f6dc
Show file tree
Hide file tree
Showing 12 changed files with 94 additions and 108 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Maui.Controls.Sample.Issues;

[Issue(IssueTracker.Github, 416, "NavigationPage in PushModal does not show NavigationBar", PlatformAffected.Android, NavigationBehavior.PushModalAsync)]
[Issue(IssueTracker.Github, 416, "NavigationPage in PushModal does not show NavigationBar", PlatformAffected.Android)]
public class Issue416 : TestNavigationPage
{
protected override void Init()
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using NUnit.Framework;
#if TEST_FAILS_ON_WINDOWS //Image rendering size inside AbsoluteLayout is inconsistent on Windows. Created a issue report: https://github.com/dotnet/maui/issues/26094.
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

Expand All @@ -12,22 +13,18 @@ public Bugzilla40161(TestDevice testDevice) : base(testDevice)

public override string Issue => "Issue Bugzilla40161";

// [Test]
// [Category(UITestCategories.Layout)]
// [FailsOnIOSWhenRunningOnXamarinUITest]
// public void Issue1Test()
// {
// App.Screenshot("I am at Issue 40161");
// App.WaitForElement("REFRESH");
// App.Screenshot("I see the first image");

// App.Tap("SWAP");
// App.Tap("REFRESH");
[Test]
[Category(UITestCategories.Layout)]
public void Issue1Test()
{
App.WaitForElement("REFRESH");

// App.WaitForTextToBePresentInElement("counter", "step=0");
App.Tap("SWAP");
App.Tap("REFRESH");

// App.Screenshot("I swap the image");
Assert.That(App.FindElement("counter").GetText(), Is.EqualTo("step=0"));

// App.WaitForTextToBePresentInElement("width", "w=50");
// }
}
Assert.That(App.FindElement("width").GetText(), Is.EqualTo("w=50"));
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,30 @@ public Bugzilla43941(TestDevice testDevice) : base(testDevice)

public override string Issue => "Memory leak with ListView's RecycleElement on iOS";

// [FailsOnAndroidWhenRunningOnXamarinUITest]
// [Test]
// [Category(UITestCategories.ListView)]
// public void Bugzilla43941Test()
// {
// 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");

// var i = 0;
// while (!App.FindElement("counterlabel")?.GetText()?.Equals("Counter: 0",
// StringComparison.OrdinalIgnoreCase) ?? false && i < 10)
// {
// i++;
// Task.Delay(2000);

// App.Tap("GC");
// }
// }
[Test]
[Category(UITestCategories.ListView)]
public void Bugzilla43941Test()
{
for (var n = 0; n < 10; n++)
{
App.WaitForElement("Push");
App.Tap("Push");

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

// 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");

var i = 0;
while (!App.FindElement("counterlabel")?.GetText()?.Equals("Counter: 0",
StringComparison.OrdinalIgnoreCase) ?? false && i < 10)
{
i++;

App.Tap("GC");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,13 @@ public Bugzilla44129(TestDevice testDevice) : base(testDevice)

public override string Issue => "Crash when adding tabbed page after removing all pages using DataTemplates";

// [Test]
// [Category(UITestCategories.TabbedPage)]
// public void Issue44129Test()
// {
// App.Screenshot("I am at Issue 1");
// App.WaitForElement("First");
// App.Screenshot("I see the Label");
// App.WaitForElement("Second");
// App.Tap("Second");
// App.Tap("Crash Me");
// }
[Test]
[Category(UITestCategories.TabbedPage)]
public void Issue44129Test()
{
App.WaitForElement("First");
App.FindElement("Second");
App.Tap("Crash Me");
App.FindElement("Third");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@ public Bugzilla44886(TestDevice testDevice) : base(testDevice)

public override string Issue => "UWP Listview ItemSelected event triggered twice for each selection";

// [Test]
// [Category(UITestCategories.ListView)]
// [FailsOnIOSWhenRunningOnXamarinUITest]
// public void Bugzilla44886Test()
// {
// App.WaitForElement("Item 1");
// App.Tap("Item 1");
[Test]
[Category(UITestCategories.ListView)]
public void Bugzilla44886Test()
{
App.WaitForElement("Item 1");
App.Tap("Item 1");

// int count = int.Parse(App.FindElement(CountId)?.GetText() ?? "0");
int count = int.Parse(App.FindElement(CountId)?.GetText() ?? "0");

// Assert.That(count, Is.EqualTo(1));
// }
Assert.That(count, Is.EqualTo(1));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using UITest.Core;

namespace Microsoft.Maui.TestCases.Tests.Issues;

public class Bugzilla47923 : _IssuesUITest
{
public Bugzilla47923(TestDevice testDevice) : base(testDevice)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using NUnit.Framework;
#if TEST_FAILS_ON_IOS && TEST_FAILS_ON_CATALYST // Issue reproduced and logged the issue report: https://github.com/dotnet/maui/issues/26091.
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

Expand All @@ -12,16 +13,13 @@ public Issue2954(TestDevice testDevice) : base(testDevice)

public override string Issue => "Cell becomes empty after adding a new one with context actions (TableView) ";

// [Test]
// [Category(UITestCategories.TableView)]
// [FailsOnIOS]
// public void Issue2954Test()
// {
// App.Screenshot("I am at Issue 2954");
// App.WaitForElement(q => q.Marked("Cell2"));
// App.Screenshot("I see the Cell2");
// App.Tap(c => c.Marked("Add new"));
// App.WaitForElement(q => q.Marked("Cell2"));
// App.Screenshot("I still see the Cell2");
// }
}
[Test]
[Category(UITestCategories.TableView)]
public void Issue2954Test()
{
App.WaitForElement("Cell2");
App.Tap("Add new");
App.WaitForElement("Cell2");
}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#if !WINDOWS
// This test won't work on Windows right now because we can only test desktop, so touch events
// (like LongPress) don't really work. The test should work manually on a touch screen, though.
using NUnit.Framework;
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

Expand All @@ -15,16 +12,18 @@ public Issue2981(TestDevice testDevice) : base(testDevice)

public override string Issue => "Long Press on ListView causes crash";

// [Test]
// [Category(UITestCategories.ListView)]
// [FailsOnIOS]
// public void Issue2981Test()
// {
// App.Screenshot("I am at Issue 1");
// App.TouchAndHold(q => q.Marked("Cell1"));
// App.Screenshot("Long Press first cell");
// App.TouchAndHold(q => q.Marked("Cell2"));
// App.Screenshot("Long Press second cell");
// }
}
#endif
[Test]
[Category(UITestCategories.ListView)]
public void Issue2981Test()
{
App.WaitForElement("Cell1");

#if MACCATALYST
App.LongPress("Cell1");
App.LongPress("Cell2");
#else
App.TouchAndHold("Cell1");
App.TouchAndHold("Cell2");
#endif
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.TestCases.Tests.Issues;
public class Issue3798 : _IssuesUITest
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ public Issue416(TestDevice testDevice) : base(testDevice)

public override string Issue => "NavigationPage in PushModal does not show NavigationBar";

//[Test]
//[Category(UITestCategories.Navigation)]
//public void Issue416TestsNavBarPresent()
//{
// App.WaitForElement(q => q.Marked("Test Page"));
// App.WaitForElement(q => q.Marked("I should have a nav bar"));
// App.Screenshot("All element present");
//}
[Test]
[Category(UITestCategories.Navigation)]
public void Issue416TestsNavBarPresent()
{
App.WaitForElement("Test Page");
App.WaitForElement("I should have a nav bar");
}
}

0 comments on commit 0f6f6dc

Please sign in to comment.