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 - 12 #25917

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Maui.Controls.Sample.Issues
{
// Issue12777 (src\ControlGallery\src\Issues.Shared\Issue12777.cs
[Issue(IssueTracker.None, 12777, "[Bug] CarouselView NRE if item template is not specified", PlatformAffected.iOS)]
public class CarouselViewNoItemTemplate : ContentPage
{
Expand All @@ -17,14 +16,12 @@ public CarouselViewNoItemTemplate()
Padding = new Thickness(12),
BackgroundColor = Colors.Black,
TextColor = Colors.White,
Text = "Without exceptions, the test has passed."
};

var carouselView = new CarouselView
{
Text = "Without exceptions, the test has passed.",
AutomationId = "TestCarouselView"
};

var carouselView = new CarouselView();

carouselView.SetBinding(ItemsView.ItemsSourceProperty, nameof(Issue12777ViewModel.Items));

layout.Children.Add(instructions);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public ExpenseListViewCell()
expenseNameLabel.SetBinding(Label.TextProperty, "Name");

var expenseAmountLabel = new Label();
expenseAmountLabel.SetBinding(Label.AutomationIdProperty, new Binding("Amount"));
var expenseAmountToStringConverter = new GenericValueConverter(obj => string.Format("{0:C}", ((decimal)obj)));
expenseAmountLabel.SetBinding(Label.TextProperty, new Binding("Amount", converter: expenseAmountToStringConverter));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,37 @@
namespace Maui.Controls.Sample.Issues;

[Issue(IssueTracker.None, 0, "TabbedPage nav tests", PlatformAffected.All)]
public class TabbedPageTests : TestTabbedPage
[Issue(IssueTracker.None, 0, "TabbedPage nav basic tests", PlatformAffected.All)]
public class TabbedPageTests : ContentPage
{
protected override void Init()
public TabbedPageTests()
{
var popButton1 = new Button() { Text = "Pop", BackgroundColor = Colors.Blue };
popButton1.Clicked += (s, a) => Navigation.PopModalAsync();
var navigate = new Button() { Text = "HomePage", AutomationId="HomePage"};

var popButton2 = new Button() { Text = "Pop 2", BackgroundColor = Colors.Blue };
popButton2.Clicked += (s, a) => Navigation.PopModalAsync();
navigate.Clicked += async (s, a) =>
{
var tabbedPage = new TabbedPage();
var popButton1 = new Button() { Text = "Pop", BackgroundColor = Colors.Blue };
var popButton2 = new Button() { Text = "Pop 2", BackgroundColor = Colors.Blue };

popButton1.Clicked += (s, a) => Navigation.PopModalAsync();
popButton2.Clicked += (s, a) => Navigation.PopModalAsync();

tabbedPage.Children.Add(new ContentPage() { Title = "Page 1", Content = popButton1 });
tabbedPage.Children.Add(new ContentPage() { Title = "Page 2", Content = popButton2 });

await Navigation.PushModalAsync(tabbedPage);

};

this.Content = new StackLayout
{
Children = {
navigate
}
};



Children.Add(new ContentPage() { Title = "Page 1", Content = popButton1 });
Children.Add(new ContentPage() { Title = "Page 2", Content = popButton2 });
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ public CarouselViewNoItemTemplate(TestDevice device)

public override string Issue => "[Bug] CarouselView NRE if item template is not specified";

// Issue12777 (src\ControlGallery\src\Issues.Shared\Issue12777.cs
[Test]
[Category(UITestCategories.CarouselView)]
[FailsOnAllPlatformsWhenRunningOnXamarinUITest("This test is failing, likely due to product issue")]
public void Issue12777Test()
{
App.WaitForElement("TestCarouselView");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,63 @@ namespace Microsoft.Maui.TestCases.Tests.Issues;

public class Issue11869 : _IssuesUITest
{

// In Android the top tab title was displayed with uppercase so we need to use uppercase string to find the element
#if ANDROID
const string TopTab2 = "TOPTAB2";
const string TopTab3 = "TOPTAB3";

#else
const string TopTab2 = "TopTab2";
const string TopTab3 = "TopTab3";
#endif
const string HideTop2 = "HideTop2";
const string HideTop3 = "HideTop3";
const string HideBottom2 = "HideBottom2";
const string HideBottom3 = "HideBottom3";
const string Tab2 = "Tab 2";
const string Tab3 = "Tab 3";
const string ShowAllTabs = "ShowAllTabs";



public Issue11869(TestDevice testDevice) : base(testDevice)
{
}

public override string Issue => "[Bug] ShellContent.IsVisible issue on Android";

// [Test]
// [Category(UITestCategories.Shell)]
// public void IsVisibleWorksForShowingHidingTabs()
// {
// App.WaitForElement("TopTab2");
// App.Tap("HideTop2");
// App.WaitForNoElement("TopTab2");

// App.WaitForElement("TopTab3");
// App.Tap("HideTop3");
// App.WaitForNoElement("TopTab3");

// App.WaitForElement("Tab 2");
// App.Tap("HideBottom2");
// App.WaitForNoElement("Tab 2");

// App.WaitForElement("Tab 3");
// App.Tap("HideBottom3");
// App.WaitForNoElement("Tab 3");

// App.Tap("ShowAllTabs");
// App.WaitForElement("TopTab2");
// App.WaitForElement("TopTab3");
// App.WaitForElement("Tab 2");
// App.WaitForElement("Tab 3");
// }
[Test]
[Category(UITestCategories.Shell)]
public void IsVisibleWorksForShowingHidingTabs()
{
// Ignored on Windows: The BottomTabs are displayed as a popup with a dropdown icon on Windows.
// This causes a visibility issue where the content does not function as expected, a bug has been logged to address this behavior.
// Once the issue is fixed, the test case should be re-enabled for Windows. https://github.com/dotnet/maui/issues/25913
#if !WINDOWS
App.WaitForElement(TopTab2);
App.Tap(HideTop2);
App.WaitForNoElement(TopTab2);

App.WaitForElement(TopTab3);
App.Tap(HideTop3);
App.WaitForNoElement(TopTab3);
#endif

App.WaitForElement(Tab2);
App.Tap(HideBottom2);
App.WaitForNoElement(Tab2);

App.WaitForElement(Tab3);
App.Tap(HideBottom3);
App.WaitForNoElement(Tab3);

App.Tap(ShowAllTabs);
#if !WINDOWS
App.WaitForElement(TopTab2);
App.WaitForElement(TopTab3);
#endif
App.WaitForElement(Tab2);
App.WaitForElement(Tab3);
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,39 +13,35 @@ public ListViewViewCellBinding(TestDevice testDevice) : base(testDevice)

public override string Issue => "ListView ViewCell binding";

//[Test]
//[FailsOnIOS]
//public void ListViewViewCellBindingTestsAllElementsPresent()
//{
// App.WaitForElement(q => q.Marked("Remove"));
// App.WaitForElement(q => q.Marked("Add"));
// App.WaitForElement(q => q.Marked("1"));
// App.WaitForElement(q => q.Marked("$100.00"));
// App.WaitForElement(q => q.Marked("2"));
// App.WaitForElement(q => q.Marked("$200.00"));
// App.WaitForElement(q => q.Marked("3"));
// App.WaitForElement(q => q.Marked("$300.00"));

// App.Screenshot("All elements exist");
//}

//[Test]
//[FailsOnIOS]
//public void ListViewViewCellBindingTestsAddListItem()
//{
// App.Tap(q => q.Button("Add"));
// App.WaitForElement(q => q.Marked("4"));
// App.WaitForElement(q => q.Marked("$400.00"));
// App.Screenshot("List item added");
//}

//[Test]
//[FailsOnIOS]
//public void ListViewViewCellBindingTestsRemoveListItem()
//{
// App.Tap(q => q.Button("Remove"));
// App.WaitForNoElement(q => q.Marked("1"));
// App.WaitForNoElement(q => q.Marked("$100.00"));
// App.Screenshot("List item removed");
//}
[Test]

public void ListViewViewCellBindingTestsAllElementsPresent()
{
App.WaitForElement("Remove");
App.WaitForElement( "Add");
App.WaitForElement( "1");
App.WaitForElement("100.0");
jsuarezruiz marked this conversation as resolved.
Show resolved Hide resolved
App.WaitForElement("2");
App.WaitForElement("200.0");
App.WaitForElement("3");
App.WaitForElement("300.0");
}

[Test]

public void ListViewViewCellBindingTestsAddListItem()
{
App.Tap("Add");
App.WaitForElement("4");
App.WaitForElement("400.0");
}

[Test]

public void ListViewViewCellBindingTestsRemoveListItem()
{
App.Tap("Remove");
App.WaitForNoElement("1");
App.WaitForNoElement("100.0");
}
}
Loading
Loading