blob: 88d280e5e12aa621cd5a6aa8e728c60b64fd9e9c (
plain)
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
using NUnit.Framework;
using Xamarin.UITest.Queries;
namespace Xamarin.Forms.Core.UITests
{
[TestFixture]
[Category(UITestCategories.ActionSheet)]
internal class ActionSheetUITests : BaseTestFixture
{
AppRect screenSize;
protected override void NavigateToGallery()
{
App.NavigateToGallery(GalleryQueries.ActionSheetGallery);
}
static void CheckExtras()
{
App.WaitForElement(c => c.Marked("Extra One"));
App.WaitForElement(c => c.Marked("Extra Six"));
}
protected override void TestSetup()
{
base.TestSetup();
#if !__MACOS__
screenSize = App.Query(q => q.Marked("ActionSheetPage"))[0].Rect;
#endif
}
[Test]
public void TestDisplayActionSheet()
{
ScrollAndTap("ActionSheet Extras");
CheckExtras();
App.Tap(c => c.Marked("Extra One"));
}
[Test]
public void TestDisplayActionSheetCancel()
{
ScrollAndTap("ActionSheet Cancel");
// iPad does not have a Cancel button for action sheet
if (App.Query(q => q.Marked("Cancel")).Length > 0)
App.Tap(c => c.Marked("Cancel"));
else
App.TapCoordinates(20, screenSize.Height / 2);
}
[Test]
public void TestDisplayActionSheetCancelDestruction()
{
ScrollAndTap("ActionSheet Cancel Destruction");
App.WaitForNoElement(c => c.Marked("Extra One"));
App.WaitForElement(c => c.Marked("Destruction"));
if (App.Query(q => q.Marked("Cancel")).Length > 0)
App.Tap(c => c.Marked("Cancel"));
else
App.TapCoordinates(20, screenSize.Height / 2);
}
[Test]
public void TestDisplayActionSheetCancelExtras()
{
ScrollAndTap("ActionSheet Cancel Extras");
CheckExtras();
if (App.Query(q => q.Marked("Cancel")).Length > 0)
App.Tap(c => c.Marked("Cancel"));
else
App.TapCoordinates(20, screenSize.Height / 2);
}
[Test]
public void TestDisplayActionSheetCancelExtrasDestruction()
{
ScrollAndTap("ActionSheet Cancel Destruction Extras");
CheckExtras();
App.WaitForElement(c => c.Marked("Destruction"));
if (App.Query(q => q.Marked("Cancel")).Length > 0)
App.Tap(c => c.Marked("Cancel"));
else
App.TapCoordinates(20, screenSize.Height / 2);
}
[Test]
public void TestDisplayActionSheetDestruction()
{
ScrollAndTap("ActionSheet Destruction");
App.WaitForNoElement(c => c.Marked("Extra One"));
App.Tap(c => c.Marked("Destruction"));
}
[Test]
public void TestDisplayActionSheetDestructionExtras()
{
ScrollAndTap("ActionSheet Destruction Extras");
CheckExtras();
App.Tap(c => c.Marked("Extra One"));
}
[Test]
public void TestDisplayActionSheetTitleCancel()
{
ScrollAndTap("ActionSheet Title Cancel");
App.WaitForElement(c => c.Marked("Title"));
if (App.Query(q => q.Marked("Cancel")).Length > 0)
App.Tap(c => c.Marked("Cancel"));
else
App.TapCoordinates(20, screenSize.Height / 2);
}
[Test]
public void TestDisplayActionSheetTitleCancelDestruction()
{
ScrollAndTap("ActionSheet Title Cancel Destruction");
App.WaitForElement(c => c.Marked("Title"));
App.WaitForNoElement(c => c.Marked("Extra One"));
App.Tap(c => c.Marked("Destruction"));
}
[Test]
public void TestDisplayActionSheetTitleCancelDestructionExtras()
{
ScrollAndTap("ActionSheet Title Cancel Destruction Extras");
App.WaitForElement(c => c.Marked("Title"));
CheckExtras();
App.Tap(c => c.Marked("Destruction"));
}
[Test]
public void TestDisplayActionSheetTitleDestruction()
{
ScrollAndTap("ActionSheet Title Destruction");
App.WaitForElement(c => c.Marked("Title"));
App.WaitForNoElement(c => c.Marked("Extra One"));
App.Tap(c => c.Marked("Destruction"));
}
[Test]
public void TestDisplayActionSheetTitleDestructionExtras()
{
ScrollAndTap("ActionSheet Title Destruction Extras");
App.WaitForElement(c => c.Marked("Title"));
CheckExtras();
App.Tap(c => c.Marked("Destruction"));
}
[Test]
public void TestDisplayActionSheetTitleExtras()
{
ScrollAndTap("ActionSheet Title Extras");
CheckExtras();
App.Tap(c => c.Marked("Extra One"));
}
void ScrollAndTap(string actionSheet)
{
#if !__MACOS__
App.ScrollForElement(string.Format("* text:'{0}'", actionSheet), new Drag(App.Query(q => q.Marked("ActionSheetPage"))[0].Rect, Drag.Direction.BottomToTop, Drag.DragLength.Long));
#endif
App.Tap(q => q.Raw(string.Format("* text:'{0}'", actionSheet)));
}
}
}
|