-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Github6384.cs
88 lines (79 loc) · 2.27 KB
/
Github6384.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
#if UITEST
using Xamarin.Forms.Core.UITests;
using Xamarin.UITest;
using NUnit.Framework;
#endif
namespace Xamarin.Forms.Controls.Issues
{
#if UITEST
[Category(UITestCategories.Shell)]
[NUnit.Framework.Category(Core.UITests.UITestCategories.Github5000)]
#endif
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Github, 6384, "content page in tabbed page not showing inside shell tab", PlatformAffected.iOS | PlatformAffected.Android)]
public class Github6384 : TestShell
{
protected override void Init()
{
var tabOneButton = new Button
{
AutomationId = "NavigationButton",
Text = "Push me!"
};
tabOneButton.Clicked += TabOneButton_Clicked;
var tabOnePage = new ContentPage { Content = tabOneButton };
var tabTwoPage = new ContentPage { Content = new Label { Text = "Go to TabOne" } };
var tabOne = new Tab { Title = "TabOne" };
var tabTwo = new Tab { Title = "TabTwo" };
tabOne.Items.Add(tabOnePage);
tabTwo.Items.Add(tabTwoPage);
Items.Add(
new TabBar
{
Items = { tabOne, tabTwo }
}
);
}
private void TabOneButton_Clicked(object sender, System.EventArgs e)
{
var subTabPageOne = new ContentPage
{
Content = new Label
{
Text = "SubPage One",
AutomationId = "SubTabLabel1",
VerticalTextAlignment = TextAlignment.Center,
}
};
var subTabPageTwo = new ContentPage
{
Content = new Label
{
Text = "SubPage Two",
AutomationId = "SubTabLabel2",
VerticalTextAlignment = TextAlignment.Center,
}
};
var tabbedPage = new TabbedPage { Title = "TabbedPage" };
tabbedPage.Children.Add(subTabPageOne);
tabbedPage.Children.Add(subTabPageTwo);
Shell.SetTabBarIsVisible(tabbedPage, false);
this.Navigation.PushAsync(tabbedPage);
}
#if UITEST
[Test]
public void Github6384Test()
{
RunningApp.Screenshot("I am at Github6384");
RunningApp.WaitForElement(q => q.Marked("NavigationButton"));
RunningApp.Tap("NavigationButton");
RunningApp.WaitForElement(q => q.Marked("SubTabLabel1"));
// The label is visible!
// Note: This check only catches the bug on iOS. Android will pass also without the fix.
RunningApp.Screenshot("The new page is visible!");
}
#endif
}
}