Skip to content

Commit

Permalink
Added a UiTest (dotnet#20199)
Browse files Browse the repository at this point in the history
  • Loading branch information
kubaflo authored and dustin-wojciechowski committed Apr 24, 2024
1 parent 3428bfc commit 697f1cf
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8" ?>
<Shell xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:ns="clr-namespace:Maui.Controls.Sample.Issues"
x:Class="Maui.Controls.Sample.Issues.Issue20199">
<TabBar>
<ShellContent
Title="Home page"
ContentTemplate="{DataTemplate ns:Issue20199Page}"
Route="MainPage">
</ShellContent>
</TabBar>
</Shell>
Original file line number Diff line number Diff line change
@@ -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 { }
}
27 changes: 27 additions & 0 deletions src/Controls/tests/UITests/Tests/Issues/Issue20199.cs
Original file line number Diff line number Diff line change
@@ -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();
}
}
}

0 comments on commit 697f1cf

Please sign in to comment.