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

[UI Testing] Add legacy tests (alternative) #22635

Merged
merged 47 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
ac4b9d1
Added Compatibility UITests (ported to Appium) to TestCases project
jsuarezruiz May 23, 2024
5f07e5a
Added tests pages
jsuarezruiz May 23, 2024
8357aa2
More changes
jsuarezruiz May 23, 2024
8fd5714
More changes
jsuarezruiz May 23, 2024
3e2c588
More changes
jsuarezruiz May 23, 2024
91a6ac2
More changes
jsuarezruiz May 23, 2024
596aed5
More fixes
jsuarezruiz May 23, 2024
e83a677
More fixes
jsuarezruiz May 23, 2024
ac1e986
More changes
jsuarezruiz May 23, 2024
ccbd48e
More changes
jsuarezruiz May 23, 2024
da634f7
More changes
jsuarezruiz May 23, 2024
c7f5a67
More changes
jsuarezruiz May 24, 2024
992df0d
More fixes
jsuarezruiz May 24, 2024
2576583
Avoid problems with duplicated issues
jsuarezruiz May 24, 2024
311508e
More changes
jsuarezruiz May 24, 2024
645e98f
More changes
jsuarezruiz May 24, 2024
4487ad5
More fixes
jsuarezruiz May 24, 2024
dcd9d4c
Fixes on Windows tests
jsuarezruiz May 24, 2024
143ece0
More fixes
jsuarezruiz May 24, 2024
4493085
More fixes
jsuarezruiz May 24, 2024
4956a10
More changes
jsuarezruiz May 24, 2024
9e96781
Removed duplicated tests
jsuarezruiz May 27, 2024
9c9f2e8
More fixes
jsuarezruiz May 27, 2024
a1ce59f
More changes
jsuarezruiz May 27, 2024
dbd7233
More changes
jsuarezruiz May 27, 2024
6ccd463
More changes
jsuarezruiz May 28, 2024
5913a85
More changes
jsuarezruiz May 28, 2024
5d2d025
More changes
jsuarezruiz May 28, 2024
a39726e
Removed unnecessary changes
jsuarezruiz May 28, 2024
ba30df0
More changes
jsuarezruiz May 29, 2024
ffde04a
Ignore golden tests on macOS
jsuarezruiz May 29, 2024
b6a121a
More changes
jsuarezruiz May 31, 2024
572e874
More changes
jsuarezruiz May 31, 2024
4b7e414
Merge branch 'main' into add-more-legacy-tests-testcases
jsuarezruiz Jun 3, 2024
c8bcf86
More changes
jsuarezruiz Jun 3, 2024
5a4d2f4
Changes in AppiumLifecycleActions
jsuarezruiz Jun 4, 2024
eaaf381
More changes
jsuarezruiz Jun 6, 2024
2dc29da
Removed IgnoreIfPlatforms usage
jsuarezruiz Jun 7, 2024
b3a75c0
Merge branch 'main' into add-more-legacy-tests-testcases
jsuarezruiz Jun 7, 2024
f0bb4c2
Small changes
jsuarezruiz Jun 7, 2024
0275333
Fix build errors
jsuarezruiz Jun 7, 2024
e549beb
Merge branch 'main' into add-more-legacy-tests-testcases
PureWeen Jul 9, 2024
a87e336
Merge branch 'main' into add-more-legacy-tests-testcases
jfversluis Aug 5, 2024
f1a0e71
Fix build error
jfversluis Aug 5, 2024
29840d1
Add missing category
jfversluis Aug 5, 2024
aef125d
Update Issue24574.cs
jfversluis Aug 6, 2024
cb2efb3
Ignore on Mac for now
jfversluis Aug 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
21 changes: 21 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Bugzilla23942.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8" ?>
<local:TestContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:test="clr-namespace:Maui.Controls.Sample.Issues"
xmlns:local="clr-namespace:Maui.Controls.Sample.Issues"
x:Class="Maui.Controls.Sample.Issues.Bugzilla23942">

<local:TestContentPage.Resources>
<ResourceDictionary>
<test:Bugzilla23942Options x:Key="opts"
Text="{Binding DoesItWork}" />
</ResourceDictionary>
</local:TestContentPage.Resources>

<local:TestContentPage.Content>
<StackLayout>
<test:Bugzilla23942Label x:Name="label" Options="{DynamicResource opts}" />
</StackLayout>
</local:TestContentPage.Content>

</local:TestContentPage>
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
using Microsoft.Maui.Controls;
using Microsoft.Maui.Controls.CustomAttributes;
using Microsoft.Maui.Controls.Internals;

namespace Maui.Controls.Sample.Issues
{
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Bugzilla, 23942, "Cannot bind properties in BindableObjects added to static resources in XAML", PlatformAffected.All)]
public partial class Bugzilla23942 : TestContentPage
{
[Preserve(AllMembers = true)]
public class TestViewModel : ViewModelBase
{
string _doesItWork;
public string DoesItWork
{
get
{
return _doesItWork;
}
set
{
_doesItWork = value;
OnPropertyChanged();
}
}
}

public Bugzilla23942()
{
InitializeComponent();
}

private void InitializeView()
{
TestViewModel vm = new TestViewModel() { DoesItWork = "initial binding works" };
BindingContext = vm;
vm.DoesItWork = "success";
}

protected override void Init()
{
InitializeView();
}

protected override void OnAppearing()
{
base.OnAppearing();
var lbl = this.FindByName<Bugzilla23942Label>("label");
lbl.Text = lbl.Options.Text;
}
}

[Preserve(AllMembers = true)]
public class Bugzilla23942Options : BindableObject
{
public static readonly BindableProperty TextProperty =
BindableProperty.Create(propertyName: nameof(Text),
returnType: typeof(string),
declaringType: typeof(Bugzilla23942Options),
defaultValue: default(string));

public string Text
{
get
{
return (string)GetValue(TextProperty);
}
set
{
SetValue(TextProperty, value);
}
}
}

[Preserve(AllMembers = true)]
public class Bugzilla23942Label : Label
{
public static readonly BindableProperty OptionsProperty =
BindableProperty.Create(propertyName: nameof(Options),
returnType: typeof(Bugzilla23942Options),
declaringType: typeof(Bugzilla23942Label),
defaultValue: default(Bugzilla23942Options));

public Bugzilla23942Options Options
{
get
{
return (Bugzilla23942Options)GetValue(OptionsProperty);
}
set
{
SetValue(OptionsProperty, value);
}
}
}
}
82 changes: 82 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Bugzilla25943.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
using Microsoft.Maui.Controls;
using Microsoft.Maui.Controls.Internals;
using Microsoft.Maui.Graphics;

namespace Maui.Controls.Sample.Issues
{
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Bugzilla, 25943,
"[Android] TapGestureRecognizer does not work with a nested StackLayout", PlatformAffected.Android)]
public class Bugzilla25943 : TestContentPage
{
Label _result;
int _taps;
const string InnerLayout = "innerlayout";
const string OuterLayout = "outerlayout";
const string Success = "Success";

protected override void Init()
{
StackLayout layout = GetNestedStackLayout();

var tapGestureRecognizer = new TapGestureRecognizer();
tapGestureRecognizer.Tapped += (sender, e) =>
{
_taps = _taps + 1;
if (_taps == 2)
{
_result.Text = Success;
}
};
layout.GestureRecognizers.Add(tapGestureRecognizer);

Content = layout;
}

public StackLayout GetNestedStackLayout()
{
_result = new Label();

#pragma warning disable CS0618 // Type or member is obsolete
var innerLayout = new StackLayout
{
AutomationId = InnerLayout,
HeightRequest = 100,
Orientation = StackOrientation.Horizontal,
HorizontalOptions = LayoutOptions.Fill,
BackgroundColor = Colors.AntiqueWhite,
Children =
{
new Label
{
Text = "inner label",
FontSize = 20,
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.CenterAndExpand
}
}
};
#pragma warning restore CS0618 // Type or member is obsolete

var outerLayout = new StackLayout
{
AutomationId = OuterLayout,
Orientation = StackOrientation.Vertical,
BackgroundColor = Colors.Brown,
Children =
{
_result,
innerLayout,
new Label
{
Text = "outer label",
FontSize = 20,
HorizontalOptions = LayoutOptions.Center,
}
}
};

return outerLayout;
}
}
}
22 changes: 22 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Bugzilla29128.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Microsoft.Maui.Controls;
using Microsoft.Maui.Controls.Internals;
using Microsoft.Maui.Graphics;

namespace Maui.Controls.Sample.Issues
{
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Bugzilla, 29128, "Slider background lays out wrong Android")]
public class Bugzilla29128 : TestContentPage
{
protected override void Init()
{
Content = new Slider
{
AutomationId = "SliderId",
BackgroundColor = Colors.Blue,
Maximum = 255,
Minimum = 0,
};
}
}
}
46 changes: 46 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Bugzilla29363.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using System;
using Microsoft.Maui.Controls;
using Microsoft.Maui.Controls.Internals;
using Microsoft.Maui.Graphics;

namespace Maui.Controls.Sample.Issues
{
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Bugzilla, 29363, "PushModal followed immediate by PopModal crashes")]
public class Bugzilla29363 : NavigationPage
{
public Bugzilla29363() : base(new MainPage())
{
}

public class MainPage : ContentPage
{
public MainPage()
{
#pragma warning disable CS0618 // Type or member is obsolete
var layout = new StackLayout() { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand };
#pragma warning restore CS0618 // Type or member is obsolete

Button modal = new Button
{
AutomationId = "ModalPushPopTest",
Text = "Modal Push Pop Test",
FontAttributes = FontAttributes.Bold,
FontSize = 25,
HorizontalOptions = LayoutOptions.Center
};
modal.Clicked += async (object sender, EventArgs e) =>
{
var page = new ContentPage() { BackgroundColor = Colors.Red };

await Navigation.PushModalAsync(page);

await Navigation.PopModalAsync(true);
};

layout.Children.Add(modal);
Content = layout;
}
}
}
}
66 changes: 66 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Bugzilla29453.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
using Microsoft.Maui;
using Microsoft.Maui.Controls;
using Microsoft.Maui.Controls.Internals;

namespace Maui.Controls.Sample.Issues
{
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Bugzilla, 29453, "Navigation.PopAsync(false) in Entry.Completed handler => System.ArgumentException", PlatformAffected.Android)]
public class Bugzilla29453 : NavigationPage
{
public Bugzilla29453() : base(new MainPage())
{
}

public class MainPage : ContentPage
{
public MainPage()
{
var page1Layout = new StackLayout
{
Children = {
new Label {
AutomationId = "Page1",
HorizontalTextAlignment = TextAlignment.Center,
Text = "Page 1"
}
}
};

var page2Layout = new StackLayout
{
Children = {
new Label {
HorizontalTextAlignment = TextAlignment.Center,
Text = "Page 2"
}
}
};

var entry = new Entry { AutomationId = "entryText" };

entry.Completed += async (sender, args) =>
{
await Navigation.PopAsync(false);
};

page2Layout.Children.Add(entry);

var page2 = new ContentPage
{
Content = page2Layout
};

var button = new Button
{
Text = "Go to page 2",
AutomationId = "btnGotoPage2",
Command = new Command(async () => await Navigation.PushAsync(page2))
};

page1Layout.Children.Add(button);
Content = page1Layout;
}
}
}
}
40 changes: 40 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Bugzilla30166.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using Microsoft.Maui.Controls;
using Microsoft.Maui.Controls.Internals;
using Microsoft.Maui.Graphics;

namespace Maui.Controls.Sample.Issues
{
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Bugzilla, 30166, "NavigationBar.BarBackgroundColor resets on Lollipop after popping modal page", PlatformAffected.Android)]
public class Bugzilla30166 : NavigationPage
{
public Bugzilla30166() : base(new MainPage())
{
BarBackgroundColor = Colors.Red;
}

public class MainPage : ContentPage
{
public MainPage()
{
Navigation.PushAsync(new ContentPage
{
Content = new Button
{
AutomationId = "PushModal",
Text = "Push Modal",
Command = new Command(async () => await Navigation.PushModalAsync(new ContentPage
{
Content = new Button
{
AutomationId = "Back",
Text = "Back",
Command = new Command(async () => await Navigation.PopModalAsync()),
},
})),
},
});
}
}
}
}
Loading
Loading