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 - 17 #26081

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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 @@ -15,16 +15,22 @@ protected override void Init()

AddBottomTab("Tab 1");
AddBottomTab("Tab 2");
AddBottomTab("Tab 3");
AddBottomTab("Tab 3");
AddBottomTab("Tab 4").AutomationId = "Tab 4 Content";
var contentPage5 = AddBottomTab("Tab 5");
AddBottomTab("Tab 5");
AddBottomTab("Tab 6");
AddBottomTab("Tab 7");
AddBottomTab("Tab 8");
AddBottomTab("Tab 9");
Comment on lines +18 to +24
Copy link

Choose a reason for hiding this comment

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

Same here

AddBottomTab("Tab 10");
var contentPage5 = AddBottomTab("Tab 11");
AddBottomTab("Tab 12");

shellItem.PropertyChanged += (sender, e) =>
{
if (e.PropertyName == CurrentItemProperty.PropertyName)
{
if (((ShellItem)sender).CurrentItem.AutomationId == "Tab 5")
if (((ShellItem)sender).CurrentItem.AutomationId == "Tab 11")
{
contentPage5.Content = new Label()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ protected override void Init()
{
Content = new Label()
{
Text = "Navigate between flyout items a few times. If app doesn't crash then test has passed"
Text = "Navigate between flyout items a few times. If app doesn't crash then test has passed",
AutomationId = "InstructionLabel"
}
}
};

CreateContentPage("Item2").Content =
new StackLayout() { new Frame() };
new StackLayout() { new Frame() { Content = new Label() { Text = "FrameContent", AutomationId ="FrameContent" } } };
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace Maui.Controls.Sample.Issues;

[Issue(IssueTracker.Github, 7856,
"[Bug] Shell BackButtonBehaviour TextOverride breaks back",
"[Bug] Shell BackButtonBehaviour TextOverride breaks back",
PlatformAffected.iOS)]
public class Issue7856 : TestShell
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Maui.Controls.Sample.Issues;

[Issue(IssueTracker.Github, 8145, "Shell System.ObjectDisposedException: 'Cannot access a disposed object. Object name: 'Android.Support.Design.Widget.BottomSheetDialog'.'", PlatformAffected.Android)]
[Issue(IssueTracker.Github, 8145, "Shell System.ObjectDisposedException: Cannot access a disposed object. Object name: Android.Support.Design.Widget.BottomSheetDialog", PlatformAffected.Android)]
public class Issue8145 : TestShell
{
string _titleElement = "Connect";
Expand Down Expand Up @@ -51,8 +51,40 @@ protected override void Init()
Items = {
new ContentPage { Title = "notme", Content = new Label { Text = "Click More, then choose the target. If it does not crash, this test has passed." } }
}
},
new Tab {
},new Tab {
Title = "notme",
Items = {
new ContentPage { Title = "notme", Content = new Label { Text = "Click More, then choose the target. If it does not crash, this test has passed." } }
}
#if WINDOWS || MACCATALYST // Add more tab for desktop platforms to make the more button visible
},new Tab {
Title = "notme",
Items = {
new ContentPage { Title = "notme", Content = new Label { Text = "Click More, then choose the target. If it does not crash, this test has passed." } }
}
},new Tab {
Title = "notme",
Items = {
new ContentPage { Title = "notme", Content = new Label { Text = "Click More, then choose the target. If it does not crash, this test has passed." } }
}
},new Tab {
Title = "notme",
Items = {
Comment on lines +60 to +72
Copy link

Choose a reason for hiding this comment

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

Maybe it's not that important in this case but why not just put it in a loop?

new ContentPage { Title = "notme", Content = new Label { Text = "Click More, then choose the target. If it does not crash, this test has passed." } }
}

},new Tab {
Title = "notme",
Items = {
new ContentPage { Title = "notme", Content = new Label { Text = "Click More, then choose the target. If it does not crash, this test has passed." } }
}
},new Tab {
Title = "notme",
Items = {
new ContentPage { Title = "notme", Content = new Label { Text = "Click More, then choose the target. If it does not crash, this test has passed." } }
}
#endif
},new Tab {
Title = "target",
Items = {
new ContentPage { Title = "Target", Content = new Label { Text = "Success" } }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using NUnit.Framework;
#if TEST_FAILS_ON_ANDROID && TEST_FAILS_ON_CATALYST && TEST_FAILS_ON_WINDOWS // Cell disabled is not behaves correctly except iOS. More Information: https://github.com/dotnet/maui/issues/5161
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

Expand All @@ -12,13 +13,15 @@ public Issue6184(TestDevice testDevice) : base(testDevice)

public override string Issue => "Throws exception when set isEnabled to false in ShellItem index > 5";

//[Test]
//[Category(UITestCategories.Shell)]
//public void GitHubIssue6184()
//{
// App.WaitForElement(q => q.Marked("More"));
// App.Tap(q => q.Marked("More"));
// App.Tap(q => q.Marked("Issue 5"));
// App.WaitForElement(q => q.Marked("Issue 5"));
//}
}
[Test]
[Category(UITestCategories.Shell)]
public void GitHubIssue6184()
{
App.WaitForElement("More");
App.Tap("More");
App.Tap("Issue 5");
App.WaitForElement("Issue 5");

}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using NUnit.Framework;
#if TEST_FAILS_ON_WINDOWS // When using App.Tap to interact with tab items which placed in the more section, the action targets the corner of the tabs, Line No 24
// which doesn't trigger navigation on Windows. Windows requires tapping directly on the tab title text.
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

Expand All @@ -13,42 +15,38 @@ public Issue6784(TestDevice testDevice) : base(testDevice)

public override string Issue => "ShellItem.CurrentItem is not set when selecting shell section aggregated in more tab";

//[Test]
//public void CurrentItemIsSetWhenSelectingShellSectionAggregatedInMoreTab()
//{
// App.WaitForElement(x => x.Class("UITabBarButton").Marked("More"));
// App.Tap(x => x.Class("UITabBarButton").Marked("More"));

// App.WaitForElement(x => x.Class("UITableViewCell").Text("Tab 5"));
// App.Tap(x => x.Class("UITableViewCell").Text("Tab 5"));

// App.WaitForElement(x => x.Text("Success"));
//}

//[Test]
//public void MoreControllerOpensOnFirstClick()
//{
// App.WaitForElement(x => x.Class("UITabBarButton").Marked("More"));
// App.Tap(x => x.Class("UITabBarButton").Marked("More"));

// App.WaitForElement(x => x.Class("UITableViewCell").Text("Tab 5"));
// App.Tap(x => x.Class("UITableViewCell").Text("Tab 5"));

// App.Tap(x => x.Class("UITabBarButton").Marked("Tab 4"));
// App.WaitForElement("Tab 4 Content");

// App.Tap(x => x.Class("UITabBarButton").Marked("More"));
// App.WaitForElement(x => x.Class("UITableViewCell").Text("Tab 6"));
//}

//[Test]
//public void MoreControllerDoesNotShowEditButton()
//{
// App.WaitForElement(x => x.Class("UITabBarButton").Marked("More"));
// App.Tap(x => x.Class("UITabBarButton").Marked("More"));
[Test]
public void CurrentItemIsSetWhenSelectingShellSectionAggregatedInMoreTab()
{
App.WaitForElement("More");
App.Tap("More");
App.WaitForElement("Tab 11");
App.Tap("Tab 11");
App.WaitForElementTillPageNavigationSettled("Success");
}

// App.WaitForElement(x => x.Class("UITableViewCell").Text("Tab 5"));
[Test]
public void OneMoreControllerOpensOnFirstClick()
{
App.WaitForElement("More");
App.Tap("More");
App.WaitForElement("Tab 11");
App.Tap("Tab 11");
App.WaitForElement("Tab 4");
App.Tap("Tab 4");
App.WaitForElement("More");
App.Tap("More");
App.WaitForElement("Tab 12");
App.Tap("Tab 12");
}

// Assert.AreEqual(App.Query(x => x.Marked("Edit")).Count(), 0);
//}
}
[Test]
public void TwoMoreControllerDoesNotShowEditButton()
{
App.WaitForElement("More");
App.Tap("More");
App.WaitForElement("Tab 11");
Assert.That(App.FindElements("Edit").Count(), Is.EqualTo(0));
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,20 @@ public Issue7339(TestDevice testDevice) : base(testDevice)

public override string Issue => "[iOS] Material frame renderer not being cleared";

// TODO: TapInFlyout was some helper method in ControlGallery? Do we have that here?
//[Test]
//[Category(UITestCategories.Shell)]
//public void MaterialFrameDisposesCorrectly()
//{
// TapInFlyout("Item1");
// TapInFlyout("Item2");
// TapInFlyout("Item1");
// TapInFlyout("Item2");
//}

[Test]
[Category(UITestCategories.Shell)]
public void MaterialFrameDisposesCorrectly()
{
App.WaitForElement("InstructionLabel");
App.TapInFlyout("Item1");
App.WaitForElementTillPageNavigationSettled("InstructionLabel");
App.TapInFlyout("Item2");
App.WaitForElementTillPageNavigationSettled("FrameContent");
App.TapInFlyout("Item1");
App.WaitForElementTillPageNavigationSettled("InstructionLabel");
App.TapInFlyout("Item2");
App.WaitForElementTillPageNavigationSettled("FrameContent");

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,17 @@ public Issue7856(TestDevice testDevice) : base(testDevice)
{
}

public override string Issue => "[Bug] Shell BackButtonBehaviour TextOverride breaks back";
public override string Issue => "[Bug] Shell BackButtonBehaviour TextOverride breaks back";

//[Test]
//[Category(UITestCategories.Shell)]
//public void BackButtonBehaviorTest()
//{
// App.Tap(x => x.Text("Tap to Navigate To the Page With BackButtonBehavior"));

// App.WaitForElement(x => x.Text("Navigate again"));

// App.Tap(x => x.Text("Navigate again"));

// App.WaitForElement(x => x.Text("Test"));

// App.Tap(x => x.Text("Test"));
//}
[Test]
[Category(UITestCategories.Shell)]
public void BackButtonBehaviorTest()
{
App.WaitForElementTillPageNavigationSettled("Tap to Navigate To the Page With BackButtonBehavior");
App.Tap("Tap to Navigate To the Page With BackButtonBehavior");
App.WaitForElement("Navigate again");
App.Tap("Navigate again");
App.WaitForElementTillPageNavigationSettled("Hello");
App.TapBackArrow("Test");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,16 @@ public Issue8145(TestDevice testDevice) : base(testDevice)
{
}

public override string Issue => "Shell System.ObjectDisposedException: 'Cannot access a disposed object. Object name: 'Android.Support.Design.Widget.BottomSheetDialog'.'";
public override string Issue => "Shell System.ObjectDisposedException: Cannot access a disposed object. Object name: Android.Support.Design.Widget.BottomSheetDialog";

//[Test]
//[Category(UITestCategories.Shell)]
//#if !(ANDROID || IOS)
// [Ignore("Shell test is only supported on Android and iOS")]
//#endif
// [FailsOnAndroidWhenRunningOnXamarinUITest]
// public void Issue8145ShellToolbarDisposedException()
// {
// App.WaitForElement("More");
// App.Tap("More");
// App.WaitForElement("target");
// App.Tap("target");
// App.WaitForElement("Success");
// }
[Test]
[Category(UITestCategories.Shell)]
public void Issue8145ShellToolbarDisposedException()
{
App.WaitForElement("More");
App.Tap("More");
App.WaitForElement("target");
App.Tap("target");
App.WaitForElement("Success");
}
}
Loading
Loading