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 - 5 #25772

Merged
merged 5 commits into from
Dec 2, 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 @@ -10,7 +10,19 @@ protected override void Init()
var stackLayout = new StackLayout();

var list = Enumerable.Range(0, 40).Select(c => $"Item {c}").ToArray();
var listview = new ListView { ItemsSource = list };
var listview = new ListView {
ItemsSource = list,
ItemTemplate = new DataTemplate(() =>
{
var viewCell = new ViewCell();
var itemTemplateLabel = new Label() { HeightRequest = 30};
itemTemplateLabel.SetBinding(Label.TextProperty, new Binding("."));
itemTemplateLabel.SetBinding(Label.AutomationIdProperty, new Binding("."));
viewCell.View = itemTemplateLabel;
return viewCell;
})

};

var swShouldAnimate = new Switch();
var lblShouldAnimate = new Label { Text = "Should Animate?" };
Expand All @@ -33,7 +45,7 @@ protected override void Init()
listview.ScrollTo(list[19], ScrollToPosition.Start, swShouldAnimate.IsToggled);
};

var btnEnd = new Button { Text = "End" };
var btnEnd = new Button { Text = "End", AutomationId = "End" };
btnEnd.Clicked += (s, e) =>
{
listview.ScrollTo(list[19], ScrollToPosition.End, swShouldAnimate.IsToggled);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public NestedNavTabPageRootView(string pageTitle)
{
new Button {
Text = "Push new page",
AutomationId = "PushPage",
Command = new Command (() => Navigation.PushAsync (new NestedNavTabPageOneLevel ()))
}
}
Expand All @@ -79,6 +80,7 @@ public NestedNavTabPageRootView(string pageTitle)
{
new Button {
Text = "Push new page",
AutomationId = "SecondTabPageButton",
Command = new Command (() => Navigation.PushAsync (new NestedNavTabPageOneLevel ()))
}
}
Expand All @@ -103,7 +105,8 @@ public NestedNavTabPageOneLevel()
Children = {
new Label {
TextColor = Colors.Red,
Text = "I have been pushed"
Text = "I have been pushed",
AutomationId = "PushedPageLabel"
}
}
};
Expand Down
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,5 +1,6 @@
/*
#if IOS
#if TEST_FAILS_ON_CATALYST && TEST_FAILS_ON_WINDOWS
// In Windows the app gets crashes randomly while executing the test.
// In Catalyst the animation happens while tab changes which cause additional delays. Tried by adding timespan still getting OpenQA.Selenium.InvalidSelectorException on line no 25.
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;
Expand All @@ -19,12 +20,12 @@ public Issue12642(TestDevice testDevice) : base(testDevice)
[Category(UITestCategories.Compatibility)]
public void ClickingQuicklyBetweenTopTabsBreaksContent()
{
jsuarezruiz marked this conversation as resolved.
Show resolved Hide resolved
App.WaitForElement("AutomatedRun");
App.Tap("AutomatedRun");
jsuarezruiz marked this conversation as resolved.
Show resolved Hide resolved
App.WaitForElement("Success");
App.Tap("AutomatedRun");
App.WaitForElement("Success");
App.WaitForElement("Success");
}
}
}
#endif
*/
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@ public Issue3318(TestDevice testDevice) : base(testDevice)

public override string Issue => "[MAC] ScrollTo method is not working in Xamarin.Forms for mac platform";

// [Test]
// [Category(UITestCategories.ListView)]
// [FailsOnIOS]
// public void Issue3318Test()
// {
// App.WaitForElement(q => q.Marked("End"));
// App.Tap(q => q.Marked("End"));
// App.WaitForElement(q => q.Marked("Item 19"));
// App.Back();
// }
[Test]
[Category(UITestCategories.ListView)]
public void Issue3318Test()
{
App.WaitForElement("End");
App.Tap("End");
App.WaitForElement("Item 19");
}
}
Original file line number Diff line number Diff line change
@@ -1,34 +1,40 @@
using NUnit.Framework;
#if ANDROID
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.TestCases.Tests.Issues;

public class Issue7311 : _IssuesUITest
{
const string FirstPickerItem = "Uno";

const string PickerId = "CaptainPickard";

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

public override string Issue => "[Bug] [Android] Error back hardware button with Picker";

//[Test]
//[Category(UITestCategories.Picker)]
//public void OpeningPickerPressingBackButtonTwiceShouldNotOpenPickerAgain()
//{
// App.WaitForElement(PickerId);
// App.Tap(PickerId);

// App.WaitForElement(FirstPickerItem);
[Test]
[Category(UITestCategories.Picker)]
public void OpeningPickerPressingBackButtonTwiceShouldNotOpenPickerAgain()
{
App.WaitForElement(PickerId);
App.Tap(PickerId);

// App.Back();
App.WaitForElement(FirstPickerItem);

// App.WaitForNoElement(FirstPickerItem);
App.Back();

// App.Back();
App.WaitForNoElement(FirstPickerItem);

// App.WaitForNoElement(FirstPickerItem, "Picker is again visible after second back button press", TimeSpan.FromSeconds(10));
//The Below actions are not possible due to the current implementation of the Host app, the issue page has designated the MainPage of the Current Application.
//App.Back();
//App.WaitForNoElement(FirstPickerItem, "Picker is again visible after second back button press", TimeSpan.FromSeconds(10));

// App.Screenshot("Back at the previous page, not showing the picker again");
//}
}
App.Screenshot("Back at the previous page, not showing the picker again");
}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,29 +1,38 @@
using NUnit.Framework;
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.TestCases.Tests.Issues;

public class Issue889 : _IssuesUITest
{

#if ANDROID
const string Tab2Title = "TAB 2 TITLE";
#else
const string Tab2Title = "Tab 2 Title";
#endif
public Issue889(TestDevice testDevice) : base(testDevice)
{
}

public override string Issue => "Assigning to FlyoutPage.Detail after construction doesn't work";

//[Test]
//[Category(UITestCategories.FlyoutPage)]
//[Description("Reproduce app crash - Issue #983")]
//public void Issue899TestsAppCrashWhenSwitchingTabs()
//{
// App.Tap(q => q.Marked("Push new page"));
// App.WaitForElement(q => q.Marked("I have been pushed"));
// App.Screenshot("Push page");
// App.Back();
// App.Screenshot("Navigate back");
[Test]
[Category(UITestCategories.FlyoutPage)]
public void Issue899TestsAppCrashWhenSwitchingTabs()
{
jsuarezruiz marked this conversation as resolved.
Show resolved Hide resolved
jsuarezruiz marked this conversation as resolved.
Show resolved Hide resolved
App.WaitForElement("PushPage");
App.Tap("PushPage");
App.WaitForElement("PushedPageLabel");

#if IOS || MACCATALYST
App.Tap(AppiumQuery.ByName("Initial Page"));
#else
App.TapBackArrow();
#endif
jsuarezruiz marked this conversation as resolved.
Show resolved Hide resolved

// App.Tap(q => q.Marked("Tab 2 Title"));
// App.Screenshot("Go to second tab");
//}
}
App.Tap(Tab2Title);
App.WaitForElement("SecondTabPageButton");
}
}
Loading