-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Issue10134.cs
89 lines (74 loc) · 1.94 KB
/
Issue10134.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
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
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)]
#endif
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Github, 10134, "Shell Top Tabbar focus issue", PlatformAffected.iOS)]
public class Issue10134 : TestShell
{
protected override void Init()
{
ContentPage page1 = AddTopTab("Tab 1");
page1.Title = "Top Bar Page 1";
for(int i = 2; i < 20; i++)
{
AddTopTab($"Tab {i}");
}
page1.Content =
new StackLayout()
{
Children =
{
new Label()
{
Text = "Scroll and click on any of the currently non visible tabs. After clicking, if the Top Tabs don't scroll back to the beginninig the test has passed"
}
}
};
}
#if UITEST && __SHELL__
[Test]
public void TopTabsDontScrollBackToStartWhenSelected()
{
var element1 = RunningApp.WaitForElement("Tab 1", "Shell hasn't loaded")[0].Rect;
RunningApp.WaitForNoElement("Tab 12", "Tab shouldn't be visible");
UITest.Queries.AppRect element2 = element1;
for (int i = 2; i < 20; i++)
{
var results = RunningApp.Query($"Tab {i}");
if (results.Length == 0)
break;
element2 = results[0].Rect;
}
RunningApp.DragCoordinates(element2.CenterX, element2.CenterY, element1.CenterX, element1.CenterY);
RunningApp.WaitForNoElement("Tab 1");
bool testPassed = false;
// figure out what tabs are visible
for (int i = 20; i > 1; i--)
{
var results = RunningApp.Query($"Tab {i}");
if (results.Length > 0)
{
RunningApp.Tap($"Tab {i}");
RunningApp.WaitForElement($"Tab {i}");
testPassed = true;
break;
}
}
RunningApp.WaitForNoElement("Tab 1");
Assert.IsTrue(testPassed);
}
#endif
}
}