Skip to content

Commit

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

* enabled UI tests from XamarinUItests into Appium

* enabled Issue13390

* Enabled Issue 4356
  • Loading branch information
anandhan-rajagopal authored Nov 12, 2024
1 parent fd12356 commit c1bb5fd
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 166 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ protected override void Init()
Increment = 0.1,
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.CenterAndExpand,
IsEnabled = false
IsEnabled = false,
AutomationId = "Stepper"
};
#pragma warning restore CS0618 // Type or member is obsolete
stepper.ValueChanged += OnStepperValueChanged;
Expand All @@ -33,6 +34,7 @@ protected override void Init()
#pragma warning disable CS0612 // Type or member is obsolete
_label = new Label
{
AutomationId = "StepperValue",
Text = "Stepper value is 0",
FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
HorizontalOptions = LayoutOptions.Center,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class Issue2681 : TestNavigationPage
const string NavigateToPage = "Click Me.";
protected override void Init()
{
PushAsync(new ContentPage() { Title = "Freeze Test", Content = new Button() { Text = NavigateToPage, Command = new Command(() => this.PushAsync(new FreezeMe())) } });
PushAsync(new ContentPage() { Title = "Freeze Test", Content = new Button() { AutomationId = "NavigateToPage", Text = NavigateToPage, Command = new Command(() => this.PushAsync(new FreezeMe())) } });
}


Expand All @@ -27,6 +27,7 @@ public FreezeMe()
{
var label = new Label() { Text = "sassifrass" };
label.SetBinding(Label.TextProperty, ".");
label.SetBinding(AutomationIdProperty, new Binding(".", stringFormat: "{0}"));
return new ViewCell() { View = label };
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<local:TestContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:Maui.Controls.Sample.Issues" x:Class="Maui.Controls.Sample.Issues.Issue4356">
<StackLayout Orientation="Vertical">
<StackLayout Orientation="Horizontal">
<Button Text="Add item" HorizontalOptions="CenterAndExpand" Command="{Binding AddCommand}" />
<Button Text="Remove item" HorizontalOptions="CenterAndExpand" Command="{Binding RemoveCommand}" />
<Button Text="Add item" HorizontalOptions="CenterAndExpand" AutomationId="AddItem" Command="{Binding AddCommand}" />
<Button Text="Remove item" HorizontalOptions="CenterAndExpand" AutomationId="RemoveItem" Command="{Binding RemoveCommand}" />
</StackLayout>
<ListView x:Name="listView"
ItemsSource="{Binding FavoriteArticles}"
Expand All @@ -28,7 +28,7 @@
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackLayout Grid.Column="1" Padding="5" Spacing="1" VerticalOptions="Center">
<Label Text="{Binding ArticleTitle}" FontSize="Medium" FontAttributes="Bold" TextColor="#333333" LineBreakMode="WordWrap" />
<Label Text="{Binding ArticleTitle}" AutomationId="{Binding ArticleTitle}" FontSize="Medium" FontAttributes="Bold" TextColor="#333333" LineBreakMode="WordWrap" />
<Label Text="{Binding AuthorString}" FontSize="Small" TextColor="#919191" LineBreakMode="TailTruncation" />
<Label Text="{Binding FormattedPostedDate}" FontSize="Small" TextColor="#919191" LineBreakMode="NoWrap" />
<Label Text="{Binding ItemId}" FontSize="Small" TextColor="#919191" LineBreakMode="NoWrap" IsVisible="false" />
Expand Down
82 changes: 0 additions & 82 deletions src/Controls/tests/TestCases.HostApp/Issues/XFIssue2681.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,18 @@ public Bugzilla38978(TestDevice testDevice) : base(testDevice)

public override string Issue => "Cell.ForceUpdateSize issues with row selection/deselection (ViewCell)";

// [Test]
// [FailsOnIOSWhenRunningOnXamarinUITest]
// [Category(UITestCategories.ManualReview)]
// public void Bugzilla38978Test ()
// {
// App.WaitForElement("2");
// App.Tap("2");
// App.Screenshot("If the tapped image is not larger, this test has failed.");
// }
[Test]
[FailsOnIOSWhenRunningOnXamarinUITest]
[Category(UITestCategories.ManualReview)]
public void Bugzilla38978Test()
{
App.WaitForElement("2");
var beforeRect = App.FindElement("2").GetRect();

App.Tap("2");
var afterRect = App.FindElement("2").GetRect();

Assert.That(afterRect.Width, Is.GreaterThan(beforeRect.Width));
Assert.That(afterRect.Height, Is.GreaterThan(beforeRect.Height));
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/*
#if IOS
using NUnit.Framework;
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.TestCases.Tests.Issues
{
Expand All @@ -23,5 +22,3 @@ public void CustomSlideFlyoutTransitionCausesCrash()
}
}
}
#endif
*/
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,16 @@ public Issue2597(TestDevice testDevice) : base(testDevice)

public override string Issue => "Stepper control .IsEnabled doesn't work";

// [Test]
// [Category(UITestCategories.Stepper)]
// [FailsOnIOSWhenRunningOnXamarinUITest]
// public void Issue2597Test()
// {
// #if __IOS__
// App.Tap(x => x.Marked("Increment"));
// #else
// App.Tap("+");
// #endif

// App.WaitForElement(q => q.Marked("Stepper value is 0"));
[Test]
[Category(UITestCategories.Stepper)]
public void Issue2597Test()
{
App.IncreaseStepper("Stepper");

Assert.That(App.FindElement("StepperValue").GetText(), Is.EqualTo("Stepper value is 0"));

// #if __IOS__
// App.Tap(x => x.Marked("Decrement"));
// #else
// App.Tap("−");
// #endif
App.DecreaseStepper("Stepper");

// App.WaitForElement(q => q.Marked("Stepper value is 0"));
// }
Assert.That(App.FindElement("StepperValue").GetText(), Is.EqualTo("Stepper value is 0"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ public Issue2681(TestDevice testDevice) : base(testDevice)

public override string Issue => "[UWP] Label inside Listview gets stuck inside infinite loop";

// [Test]
// [Category(UITestCategories.ListView)]
// public void ListViewDoesntFreezeApp()
// {
// App.Tap(x => x.Marked(NavigateToPage));
// App.WaitForElement("3");
// }
[Test]
[Category(UITestCategories.ListView)]
public void ListViewDoesntFreezeApp()
{
App.WaitForElement("NavigateToPage");
App.Tap("NavigateToPage");
App.WaitForElement("3");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@ public Issue4356(TestDevice testDevice) : base(testDevice)

public override string Issue => "[iOS] NSInternalInconsistencyException thrown when adding item to ListView after clearing bound ObservableCollection";

//[Test]
//[Category(UITestCategories.ListView)]
//[FailsOnIOS]
//public void Issue4356Test()
//{
// App.WaitForElement(q => q.Marked("Will this repo work?"));
// App.WaitForElement(q => q.Marked("Remove item"));
// App.Tap(q => q.Marked("Remove item"));
// App.Tap(q => q.Marked("Remove item"));
// App.Tap(q => q.Marked("Add item"));
// App.WaitForElement(q => q.Marked("Added from Button Command"));
//}
[Test]
[Category(UITestCategories.ListView)]
public void Issue4356Test()
{
App.WaitForElement("Will this repo work?");
App.Tap("RemoveItem");
App.Tap("RemoveItem");
App.Tap("AddItem");
App.WaitForElement("Added from Button Command");
}
}

This file was deleted.

0 comments on commit c1bb5fd

Please sign in to comment.