-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Issue6784.cs
91 lines (76 loc) · 2.52 KB
/
Issue6784.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
89
90
91
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
#if UITEST
using NUnit.Framework;
using System.Linq;
using Xamarin.Forms.Core.UITests;
#endif
namespace Xamarin.Forms.Controls.Issues
{
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Github, 6784, "ShellItem.CurrentItem is not set when selecting shell section aggregated in more tab", PlatformAffected.iOS)]
#if UITEST
[NUnit.Framework.Category(UITestCategories.Shell)]
#endif
public class Issue6784 : TestShell
{
protected override void Init()
{
var shellItem = new ShellItem()
{
Title = "ShellItem"
};
Items.Add(shellItem);
AddBottomTab("Tab 1");
AddBottomTab("Tab 2");
AddBottomTab("Tab 3");
AddBottomTab("Tab 4").AutomationId = "Tab 4 Content";
var contentPage5 = AddBottomTab("Tab 5");
AddBottomTab("Tab 6");
shellItem.PropertyChanged += (sender, e) =>
{
if (e.PropertyName == CurrentItemProperty.PropertyName)
{
if (((ShellItem)sender).CurrentItem.AutomationId == "Tab 5")
{
contentPage5.Content = new Label()
{
Text = "Success"
};
}
}
};
}
#if UITEST && __IOS__
[Test]
public void CurrentItemIsSetWhenSelectingShellSectionAggregatedInMoreTab()
{
RunningApp.WaitForElement(x => x.Class("UITabBarButton").Marked("More"));
RunningApp.Tap(x => x.Class("UITabBarButton").Marked("More"));
RunningApp.WaitForElement(x => x.Class("UITableViewCell").Text("Tab 5"));
RunningApp.Tap(x => x.Class("UITableViewCell").Text("Tab 5"));
RunningApp.WaitForElement(x => x.Text("Success"));
}
[Test]
public void MoreControllerOpensOnFirstClick()
{
RunningApp.WaitForElement(x => x.Class("UITabBarButton").Marked("More"));
RunningApp.Tap(x => x.Class("UITabBarButton").Marked("More"));
RunningApp.WaitForElement(x => x.Class("UITableViewCell").Text("Tab 5"));
RunningApp.Tap(x => x.Class("UITableViewCell").Text("Tab 5"));
RunningApp.Tap(x => x.Class("UITabBarButton").Marked("Tab 4"));
RunningApp.WaitForElement("Tab 4 Content");
RunningApp.Tap(x => x.Class("UITabBarButton").Marked("More"));
RunningApp.WaitForElement(x => x.Class("UITableViewCell").Text("Tab 6"));
}
[Test]
public void MoreControllerDoesNotShowEditButton()
{
RunningApp.WaitForElement(x => x.Class("UITabBarButton").Marked("More"));
RunningApp.Tap(x => x.Class("UITabBarButton").Marked("More"));
RunningApp.WaitForElement(x => x.Class("UITableViewCell").Text("Tab 5"));
Assert.AreEqual(RunningApp.Query(x => x.Marked("Edit")).Count(), 0);
}
#endif
}
}