From 697f1cf0bfd5ecd35edc9085ffe97a3015bb9e76 Mon Sep 17 00:00:00 2001 From: Jakub Florkowski Date: Wed, 14 Feb 2024 12:19:23 +0100 Subject: [PATCH] Added a UiTest (#20199) --- .../Issues/Issue20199.xaml | 13 +++++++++ .../Issues/Issue20199.xaml.cs | 29 +++++++++++++++++++ .../tests/UITests/Tests/Issues/Issue20199.cs | 27 +++++++++++++++++ 3 files changed, 69 insertions(+) create mode 100644 src/Controls/samples/Controls.Sample.UITests/Issues/Issue20199.xaml create mode 100644 src/Controls/samples/Controls.Sample.UITests/Issues/Issue20199.xaml.cs create mode 100644 src/Controls/tests/UITests/Tests/Issues/Issue20199.cs diff --git a/src/Controls/samples/Controls.Sample.UITests/Issues/Issue20199.xaml b/src/Controls/samples/Controls.Sample.UITests/Issues/Issue20199.xaml new file mode 100644 index 000000000000..aac6bcca0c2a --- /dev/null +++ b/src/Controls/samples/Controls.Sample.UITests/Issues/Issue20199.xaml @@ -0,0 +1,13 @@ + + + + + + + \ No newline at end of file diff --git a/src/Controls/samples/Controls.Sample.UITests/Issues/Issue20199.xaml.cs b/src/Controls/samples/Controls.Sample.UITests/Issues/Issue20199.xaml.cs new file mode 100644 index 000000000000..260cd69e0ec6 --- /dev/null +++ b/src/Controls/samples/Controls.Sample.UITests/Issues/Issue20199.xaml.cs @@ -0,0 +1,29 @@ +using Microsoft.Maui.Controls; +using Microsoft.Maui.Controls.Xaml; + +namespace Maui.Controls.Sample.Issues +{ + [XamlCompilation(XamlCompilationOptions.Compile)] + [Issue(IssueTracker.Github, 20199, "[iOS] Page titles do not appear until navigating when pushing a modal page at startup", PlatformAffected.iOS)] + public partial class Issue20199 : Shell + { + public Issue20199() + { + InitializeComponent(); + } + + protected override async void OnAppearing() + { + base.OnAppearing(); + + var closeModalPageButton = new Button() { Text = "Hide", AutomationId = "button" }; + closeModalPageButton.Clicked += (s, e) => Navigation.PopAsync(); + + var modalPage = new ContentPage() { Content = closeModalPageButton }; + + await Navigation.PushModalAsync(modalPage); + } + } + + public class Issue20199Page : ContentPage { } +} \ No newline at end of file diff --git a/src/Controls/tests/UITests/Tests/Issues/Issue20199.cs b/src/Controls/tests/UITests/Tests/Issues/Issue20199.cs new file mode 100644 index 000000000000..3599b45bb34e --- /dev/null +++ b/src/Controls/tests/UITests/Tests/Issues/Issue20199.cs @@ -0,0 +1,27 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.AppiumTests.Issues +{ + public class Issue20199 : _IssuesUITest + { + public override string Issue => "[iOS] Page titles do not appear until navigating when pushing a modal page at startup"; + + public Issue20199(TestDevice device) : base(device) + { + } + + [Test] + public void TitleViewShouldBeVisible() + { + this.IgnoreIfPlatforms(new TestDevice[] { TestDevice.Android, TestDevice.Mac, TestDevice.Windows }); + + _ = App.WaitForElement("button"); + App.Click("button"); + + // The test passes if the 'Home Page' title is visible + VerifyScreenshot(); + } + } +}