-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move TitleViewSetOnShellWorksAfterNavigation to Appium (#25094)
* Move TitleViewSetOnShellWorksAfterNavigation to Appium * - give width to editor so that it's visible
- Loading branch information
Showing
2 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" }, | ||
} | ||
} | ||
}; | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue12888.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"); | ||
} | ||
} | ||
} |