diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue12888.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue12888.cs new file mode 100644 index 000000000000..108d4da1e50b --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue12888.cs @@ -0,0 +1,72 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Microsoft.Maui.Controls; +using Microsoft.Maui.Controls.CustomAttributes; + +namespace Maui.Controls.Sample.Issues +{ + [Issue(IssueTracker.Github, 12888, + "Fix timing on iOS Toolbar", + PlatformAffected.iOS)] + public class Issue12888 : Shell + { + const string Success = "Success"; + const string Show = "Show"; + + public Issue12888() + { + var page1 = CreatePage("Item 1"); + var page2 = CreatePage("Item 2"); + + var shellTitleView = + new HorizontalStackLayout() + { + new Editor() { AutomationId = "Success", WidthRequest = 100}, + new Label() { Text = "Title View" }, + }; + + Shell.SetTitleView(this, shellTitleView); + this.Items.Add(new TabBar() + { + Items = + { + new ShellContent() + { + Route = "Item1", + Content = page1, + Title = "Item 1" + }, + new ShellContent() + { + Route = "Item2", + Content = page2, + Title = "Item 2" + }, + } + }); + } + + ContentPage CreatePage(string title) + { + return new ContentPage() + { + Title = title, + Content = new StackLayout() + { + Children = + { + new Label() { Text = "Click on different buttons to navigate around shell. The TitleView should remain in place as you navigate" }, + new Button() { Text = "Go to Item 1", Command = new Command(async () => await this.GoToAsync("//Item1")), AutomationId = "GoToItem1" }, + new Button() { Text = "Go to Item 2", Command = new Command(async () => await this.GoToAsync("//Item2")), AutomationId = "GoToItem2" }, + new Button() { Text = "Push New Page", + Command = + new Command(async () => await this.Navigation.PushAsync(CreatePage($"Pushed Page: {DateTime.Now.ToLongTimeString()}"))), + AutomationId = "PushPage" }, + new Button() { Text = "Pop Page", Command = new Command(async () => await this.Navigation.PopAsync()), AutomationId = "PopPage" }, + } + } + }; + } + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue12888.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue12888.cs new file mode 100644 index 000000000000..d0777dbb5bd1 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue12888.cs @@ -0,0 +1,37 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues +{ + public class Issue12888 : _IssuesUITest + { + public Issue12888(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Fix timing on iOS Toolbar"; + + [Category(UITestCategories.Shell)] + [Test(Description = "TitleView Set On Shell Works After Navigation")] + public void TitleViewSetOnShellWorksAfterNavigation() + { + App.WaitForElement("Success"); + + App.Click("GoToItem2"); + App.WaitForElement("Success"); + + App.Click("GoToItem1"); + App.WaitForElement("Success"); + + App.Click("GoToItem2"); + App.WaitForElement("Success"); + + App.Click("PushPage"); + App.WaitForElement("Success"); + + App.Click("PopPage"); + App.WaitForElement("Success"); + } + } +} \ No newline at end of file