appium-webdriveragent 6.1.0 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/WebDriverAgent.xcodeproj/project.pbxproj +0 -20
- package/WebDriverAgentLib/Categories/XCUIApplication+FBTouchAction.h +0 -37
- package/WebDriverAgentLib/Categories/XCUIApplication+FBTouchAction.m +0 -15
- package/WebDriverAgentLib/Commands/FBSessionCommands.m +12 -12
- package/WebDriverAgentLib/Commands/FBTouchActionCommands.m +0 -13
- package/package.json +1 -1
- package/WebDriverAgentLib/Utilities/FBAppiumActionsSynthesizer.h +0 -20
- package/WebDriverAgentLib/Utilities/FBAppiumActionsSynthesizer.m +0 -554
- package/WebDriverAgentTests/IntegrationTests/FBAppiumMultiTouchActionsIntegrationTests.m +0 -206
- package/WebDriverAgentTests/IntegrationTests/FBAppiumTouchActionsIntegrationTests.m +0 -404
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2015-present, Facebook, Inc.
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the BSD-style license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
#import <XCTest/XCTest.h>
|
|
11
|
-
|
|
12
|
-
#import "FBIntegrationTestCase.h"
|
|
13
|
-
|
|
14
|
-
#import "FBMacros.h"
|
|
15
|
-
#import "XCUIElement.h"
|
|
16
|
-
#import "XCUIApplication+FBTouchAction.h"
|
|
17
|
-
#import "FBTestMacros.h"
|
|
18
|
-
#import "XCUIDevice+FBRotation.h"
|
|
19
|
-
#import "FBRunLoopSpinner.h"
|
|
20
|
-
|
|
21
|
-
@interface FBAppiumMultiTouchActionsIntegrationTestsPart1 : FBIntegrationTestCase
|
|
22
|
-
@end
|
|
23
|
-
|
|
24
|
-
@interface FBAppiumMultiTouchActionsIntegrationTestsPart2 : FBIntegrationTestCase
|
|
25
|
-
@property (nonatomic) XCUIElement *touchesLabel;
|
|
26
|
-
@property (nonatomic) XCUIElement *tapsLabel;
|
|
27
|
-
@end
|
|
28
|
-
|
|
29
|
-
@implementation FBAppiumMultiTouchActionsIntegrationTestsPart1
|
|
30
|
-
|
|
31
|
-
- (void)verifyGesture:(NSArray<NSArray<NSDictionary<NSString *, id> *> *> *)gesture orientation:(UIDeviceOrientation)orientation
|
|
32
|
-
{
|
|
33
|
-
[[XCUIDevice sharedDevice] fb_setDeviceInterfaceOrientation:orientation];
|
|
34
|
-
NSError *error;
|
|
35
|
-
XCTAssertTrue([self.testedApplication fb_performAppiumTouchActions:gesture elementCache:nil error:&error]);
|
|
36
|
-
FBAssertWaitTillBecomesTrue(self.testedApplication.alerts.count > 0);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
- (void)setUp
|
|
40
|
-
{
|
|
41
|
-
[super setUp];
|
|
42
|
-
static dispatch_once_t onceToken;
|
|
43
|
-
dispatch_once(&onceToken, ^{
|
|
44
|
-
[self launchApplication];
|
|
45
|
-
[self goToAlertsPage];
|
|
46
|
-
});
|
|
47
|
-
[self clearAlert];
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
- (void)tearDown
|
|
51
|
-
{
|
|
52
|
-
[self clearAlert];
|
|
53
|
-
[self resetOrientation];
|
|
54
|
-
[super tearDown];
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
- (void)testErroneousGestures
|
|
58
|
-
{
|
|
59
|
-
NSArray<NSArray<NSDictionary<NSString *, id> *> *> *invalidGestures =
|
|
60
|
-
@[
|
|
61
|
-
// One of the chains is empty
|
|
62
|
-
@[
|
|
63
|
-
@[],
|
|
64
|
-
@[@{@"action": @"tap",
|
|
65
|
-
@"options": @{
|
|
66
|
-
@"ELEMENT": self.testedApplication.buttons[FBShowAlertButtonName],
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
],
|
|
70
|
-
],
|
|
71
|
-
|
|
72
|
-
];
|
|
73
|
-
|
|
74
|
-
for (NSArray<NSArray<NSDictionary<NSString *, id> *> *> *invalidGesture in invalidGestures) {
|
|
75
|
-
NSError *error;
|
|
76
|
-
XCTAssertFalse([self.testedApplication fb_performAppiumTouchActions:invalidGesture elementCache:nil error:&error]);
|
|
77
|
-
XCTAssertNotNil(error);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
- (void)testSymmetricTwoFingersTap
|
|
82
|
-
{
|
|
83
|
-
XCUIElement *element = self.testedApplication.buttons[FBShowAlertButtonName];
|
|
84
|
-
NSArray<NSArray<NSDictionary<NSString *, id> *> *> *gesture =
|
|
85
|
-
@[
|
|
86
|
-
@[@{
|
|
87
|
-
@"action": @"tap",
|
|
88
|
-
@"options": @{
|
|
89
|
-
@"ELEMENT": element
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
],
|
|
93
|
-
@[@{
|
|
94
|
-
@"action": @"tap",
|
|
95
|
-
@"options": @{
|
|
96
|
-
@"ELEMENT": element
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
],
|
|
100
|
-
];
|
|
101
|
-
|
|
102
|
-
[self verifyGesture:gesture orientation:UIDeviceOrientationPortrait];
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
@end
|
|
106
|
-
|
|
107
|
-
@implementation FBAppiumMultiTouchActionsIntegrationTestsPart2
|
|
108
|
-
|
|
109
|
-
- (void)verifyGesture:(NSArray<NSArray<NSDictionary<NSString *, id> *>*>*)gesture orientation:(UIDeviceOrientation)orientation tapsCount:(int)tapsCount touchesCount:(int)touchesCount
|
|
110
|
-
{
|
|
111
|
-
[[XCUIDevice sharedDevice] fb_setDeviceInterfaceOrientation:orientation];
|
|
112
|
-
NSError *error;
|
|
113
|
-
XCTAssertTrue([self.testedApplication fb_performAppiumTouchActions:gesture elementCache:nil error:&error]);
|
|
114
|
-
NSString *taps = [[self tapsLabel] label];
|
|
115
|
-
NSString *touches = [[self touchesLabel] label] ;
|
|
116
|
-
BOOL tapsEqual = [[NSString stringWithFormat:@"%d", tapsCount] isEqualToString:taps];
|
|
117
|
-
BOOL touchesEqual = [[NSString stringWithFormat:@"%d", touchesCount] isEqualToString:touches];
|
|
118
|
-
XCTAssertTrue(tapsEqual);
|
|
119
|
-
XCTAssertTrue(touchesEqual);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
- (void)setUp
|
|
123
|
-
{
|
|
124
|
-
[super setUp];
|
|
125
|
-
static dispatch_once_t onceToken;
|
|
126
|
-
dispatch_once(&onceToken, ^{
|
|
127
|
-
[self launchApplication];
|
|
128
|
-
[self goToTouchPage];
|
|
129
|
-
});
|
|
130
|
-
self.touchesLabel = self.testedApplication.staticTexts[FBTouchesCountLabelIdentifier];
|
|
131
|
-
self.tapsLabel = self.testedApplication.staticTexts[FBTapsCountLabelIdentifier];
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
- (void)testMultiTouchWithMultiTaps
|
|
135
|
-
{
|
|
136
|
-
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"15.0")) {
|
|
137
|
-
// Does not work on iOS 15.
|
|
138
|
-
// It tapped two times, but one was touch count was one. Not two finguer taps.
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
XCUIElement *touchableView = self.testedApplication.otherElements[@"touchableView"];
|
|
143
|
-
XCTAssertNotNil(touchableView);
|
|
144
|
-
NSArray<NSArray<NSDictionary<NSString *, id> *>*> *gesture =
|
|
145
|
-
@[@[@{
|
|
146
|
-
@"action": @"tap",
|
|
147
|
-
@"options": @{
|
|
148
|
-
@"ELEMENT": touchableView
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
@{
|
|
152
|
-
@"action": @"wait",
|
|
153
|
-
@"options": @{
|
|
154
|
-
@"ms": @1000
|
|
155
|
-
}
|
|
156
|
-
},
|
|
157
|
-
@{
|
|
158
|
-
@"action": @"tap",
|
|
159
|
-
@"options": @{
|
|
160
|
-
@"ELEMENT": touchableView
|
|
161
|
-
}
|
|
162
|
-
},
|
|
163
|
-
@{
|
|
164
|
-
@"action": @"wait",
|
|
165
|
-
@"options": @{
|
|
166
|
-
@"ms": @1000
|
|
167
|
-
}
|
|
168
|
-
},
|
|
169
|
-
@{
|
|
170
|
-
@"action": @"release"
|
|
171
|
-
}
|
|
172
|
-
],
|
|
173
|
-
@[@{
|
|
174
|
-
@"action": @"tap",
|
|
175
|
-
@"options": @{
|
|
176
|
-
@"ELEMENT": touchableView
|
|
177
|
-
}
|
|
178
|
-
},
|
|
179
|
-
@{
|
|
180
|
-
@"action": @"wait",
|
|
181
|
-
@"options": @{
|
|
182
|
-
@"ms": @1000
|
|
183
|
-
}
|
|
184
|
-
},
|
|
185
|
-
@{
|
|
186
|
-
@"action": @"tap",
|
|
187
|
-
@"options": @{
|
|
188
|
-
@"ELEMENT": touchableView
|
|
189
|
-
}
|
|
190
|
-
},
|
|
191
|
-
@{
|
|
192
|
-
@"action": @"wait",
|
|
193
|
-
@"options": @{
|
|
194
|
-
@"ms": @1000
|
|
195
|
-
}
|
|
196
|
-
},
|
|
197
|
-
@{
|
|
198
|
-
@"action": @"release"
|
|
199
|
-
}
|
|
200
|
-
]
|
|
201
|
-
|
|
202
|
-
];
|
|
203
|
-
[self verifyGesture:gesture orientation:UIDeviceOrientationPortrait tapsCount:2 touchesCount:2];
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
@end
|
|
@@ -1,404 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2015-present, Facebook, Inc.
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the BSD-style license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
#import <XCTest/XCTest.h>
|
|
11
|
-
|
|
12
|
-
#import "FBIntegrationTestCase.h"
|
|
13
|
-
|
|
14
|
-
#import "XCUIElement.h"
|
|
15
|
-
#import "XCUIApplication+FBTouchAction.h"
|
|
16
|
-
#import "FBTestMacros.h"
|
|
17
|
-
#import "XCUIDevice+FBRotation.h"
|
|
18
|
-
#import "FBRunLoopSpinner.h"
|
|
19
|
-
#import "FBXCodeCompatibility.h"
|
|
20
|
-
|
|
21
|
-
@interface FBAppiumTouchActionsIntegrationTestsPart1 : FBIntegrationTestCase
|
|
22
|
-
@end
|
|
23
|
-
|
|
24
|
-
@interface FBAppiumTouchActionsIntegrationTestsPart2 : FBIntegrationTestCase
|
|
25
|
-
@property (nonatomic) XCUIElement *pickerWheel;
|
|
26
|
-
@end
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
@implementation FBAppiumTouchActionsIntegrationTestsPart1
|
|
30
|
-
|
|
31
|
-
- (void)verifyGesture:(NSArray<NSDictionary<NSString *, id> *> *)gesture orientation:(UIDeviceOrientation)orientation
|
|
32
|
-
{
|
|
33
|
-
[[XCUIDevice sharedDevice] fb_setDeviceInterfaceOrientation:orientation];
|
|
34
|
-
NSError *error;
|
|
35
|
-
XCTAssertTrue([self.testedApplication fb_performAppiumTouchActions:gesture elementCache:nil error:&error]);
|
|
36
|
-
FBAssertWaitTillBecomesTrue(self.testedApplication.alerts.count > 0);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
- (void)setUp
|
|
40
|
-
{
|
|
41
|
-
[super setUp];
|
|
42
|
-
static dispatch_once_t onceToken;
|
|
43
|
-
dispatch_once(&onceToken, ^{
|
|
44
|
-
[self launchApplication];
|
|
45
|
-
[self goToAlertsPage];
|
|
46
|
-
});
|
|
47
|
-
[self clearAlert];
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
- (void)tearDown
|
|
51
|
-
{
|
|
52
|
-
[self clearAlert];
|
|
53
|
-
[self resetOrientation];
|
|
54
|
-
[super tearDown];
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
- (void)testErroneousGestures
|
|
58
|
-
{
|
|
59
|
-
XCUIElement *dstButton = self.testedApplication.buttons[FBShowAlertButtonName];
|
|
60
|
-
|
|
61
|
-
NSArray<NSArray<NSDictionary<NSString *, id> *> *> *invalidGestures =
|
|
62
|
-
@[
|
|
63
|
-
// Empty chain
|
|
64
|
-
@[],
|
|
65
|
-
|
|
66
|
-
// Chain element without 'action' key
|
|
67
|
-
@[@{
|
|
68
|
-
@"options": @{
|
|
69
|
-
@"ms": @100
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
],
|
|
73
|
-
|
|
74
|
-
// Empty chain because of cancel
|
|
75
|
-
@[@{
|
|
76
|
-
@"action": @"moveTo",
|
|
77
|
-
@"options": @{
|
|
78
|
-
@"ELEMENT": dstButton,
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
@{
|
|
82
|
-
@"action": @"cancel"
|
|
83
|
-
},
|
|
84
|
-
],
|
|
85
|
-
|
|
86
|
-
// Chain with unknown action
|
|
87
|
-
@[@{
|
|
88
|
-
@"action": @"tapP",
|
|
89
|
-
@"options": @{
|
|
90
|
-
@"ELEMENT": dstButton,
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
],
|
|
94
|
-
|
|
95
|
-
// Wait without preceeding coordinate
|
|
96
|
-
@[@{
|
|
97
|
-
@"action": @"wait"
|
|
98
|
-
}
|
|
99
|
-
],
|
|
100
|
-
|
|
101
|
-
// Wait with negative duration
|
|
102
|
-
@[@{
|
|
103
|
-
@"action": @"press",
|
|
104
|
-
@"options": @{
|
|
105
|
-
@"x": @1,
|
|
106
|
-
@"y": @1
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
@{
|
|
110
|
-
@"action": @"wait",
|
|
111
|
-
@"options": @{
|
|
112
|
-
@"ms": @-1.0
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
],
|
|
116
|
-
|
|
117
|
-
// Release without preceeding coordinate
|
|
118
|
-
@[@{
|
|
119
|
-
@"action": @"release"
|
|
120
|
-
},
|
|
121
|
-
@{
|
|
122
|
-
@"action": @"tap",
|
|
123
|
-
@"options": @{
|
|
124
|
-
@"x": @1,
|
|
125
|
-
@"y": @1
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
],
|
|
129
|
-
|
|
130
|
-
// Press without coordinates
|
|
131
|
-
@[@{
|
|
132
|
-
@"action": @"press"
|
|
133
|
-
}
|
|
134
|
-
],
|
|
135
|
-
|
|
136
|
-
// longPress with invalid coordinates
|
|
137
|
-
@[@{
|
|
138
|
-
@"action": @"longPress",
|
|
139
|
-
@"options": @{
|
|
140
|
-
@"x": @1
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
],
|
|
144
|
-
|
|
145
|
-
// longPress with negative duration
|
|
146
|
-
@[@{
|
|
147
|
-
@"action": @"longPress",
|
|
148
|
-
@"options": @{
|
|
149
|
-
@"x": @1,
|
|
150
|
-
@"y": @1,
|
|
151
|
-
@"duration": @-0.01
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
|
-
],
|
|
155
|
-
|
|
156
|
-
];
|
|
157
|
-
|
|
158
|
-
for (NSArray<NSDictionary<NSString *, id> *> *invalidGesture in invalidGestures) {
|
|
159
|
-
NSError *error;
|
|
160
|
-
XCTAssertFalse([self.testedApplication fb_performAppiumTouchActions:invalidGesture elementCache:nil error:&error]);
|
|
161
|
-
XCTAssertNotNil(error);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
- (void)testTap
|
|
166
|
-
{
|
|
167
|
-
NSArray<NSDictionary<NSString *, id> *> *gesture =
|
|
168
|
-
@[@{
|
|
169
|
-
@"action": @"tap",
|
|
170
|
-
@"options": @{
|
|
171
|
-
@"ELEMENT": self.testedApplication.buttons[FBShowAlertButtonName]
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
];
|
|
175
|
-
[self verifyGesture:gesture orientation:UIDeviceOrientationPortrait];
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
- (void)testTapByCoordinates
|
|
179
|
-
{
|
|
180
|
-
CGRect elementRect = self.testedApplication.buttons[FBShowAlertButtonName].frame;
|
|
181
|
-
CGFloat x = elementRect.origin.x + elementRect.size.width / 2;
|
|
182
|
-
CGFloat y = elementRect.origin.y + elementRect.size.height / 2;
|
|
183
|
-
NSArray<NSDictionary<NSString *, id> *> *gesture =
|
|
184
|
-
@[@{
|
|
185
|
-
@"action": @"tap",
|
|
186
|
-
@"options": @{
|
|
187
|
-
@"x": @(x),
|
|
188
|
-
@"y": @(y)
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
];
|
|
192
|
-
[self verifyGesture:gesture orientation:UIDeviceOrientationPortrait];
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
- (void)testDoubleTap
|
|
196
|
-
{
|
|
197
|
-
NSArray<NSDictionary<NSString *, id> *> *gesture =
|
|
198
|
-
@[@{
|
|
199
|
-
@"action": @"tap",
|
|
200
|
-
@"options": @{
|
|
201
|
-
@"ELEMENT": self.testedApplication.buttons[FBShowAlertButtonName],
|
|
202
|
-
@"count": @2
|
|
203
|
-
}
|
|
204
|
-
},
|
|
205
|
-
];
|
|
206
|
-
[self verifyGesture:gesture orientation:UIDeviceOrientationLandscapeLeft];
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
- (void)testPress
|
|
210
|
-
{
|
|
211
|
-
NSArray<NSDictionary<NSString *, id> *> *gesture =
|
|
212
|
-
@[@{
|
|
213
|
-
@"action": @"press",
|
|
214
|
-
@"options": @{
|
|
215
|
-
@"ELEMENT": self.testedApplication.buttons[FBShowAlertButtonName],
|
|
216
|
-
@"x": @1,
|
|
217
|
-
@"y": @1
|
|
218
|
-
}
|
|
219
|
-
},
|
|
220
|
-
@{
|
|
221
|
-
@"action": @"wait",
|
|
222
|
-
@"options": @{
|
|
223
|
-
@"ms": @300
|
|
224
|
-
}
|
|
225
|
-
},
|
|
226
|
-
@{
|
|
227
|
-
@"action": @"wait",
|
|
228
|
-
@"options": @{
|
|
229
|
-
@"ms": @300
|
|
230
|
-
}
|
|
231
|
-
},
|
|
232
|
-
@{
|
|
233
|
-
@"action": @"wait",
|
|
234
|
-
@"options": @{
|
|
235
|
-
@"ms": @300
|
|
236
|
-
}
|
|
237
|
-
},
|
|
238
|
-
@{
|
|
239
|
-
@"action": @"release"
|
|
240
|
-
}
|
|
241
|
-
];
|
|
242
|
-
[self verifyGesture:gesture orientation:UIDeviceOrientationLandscapeRight];
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
- (void)testLongPress
|
|
246
|
-
{
|
|
247
|
-
if (UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad) {
|
|
248
|
-
XCTSkip(@"Failed on Azure Pipeline. Local run succeeded.");
|
|
249
|
-
}
|
|
250
|
-
UIDeviceOrientation orientation = UIDeviceOrientationLandscapeLeft;
|
|
251
|
-
[[XCUIDevice sharedDevice] fb_setDeviceInterfaceOrientation:orientation];
|
|
252
|
-
CGRect elementFrame = self.testedApplication.buttons[FBShowAlertButtonName].frame;
|
|
253
|
-
NSArray<NSDictionary<NSString *, id> *> *gesture =
|
|
254
|
-
@[@{
|
|
255
|
-
@"action": @"longPress",
|
|
256
|
-
@"options": @{
|
|
257
|
-
@"x": @(elementFrame.origin.x + 1),
|
|
258
|
-
@"y": @(elementFrame.origin.y + 1),
|
|
259
|
-
@"duration": @5
|
|
260
|
-
}
|
|
261
|
-
},
|
|
262
|
-
@{
|
|
263
|
-
@"action": @"wait",
|
|
264
|
-
@"options": @{
|
|
265
|
-
@"ms": @500
|
|
266
|
-
}
|
|
267
|
-
},
|
|
268
|
-
@{
|
|
269
|
-
@"action": @"release"
|
|
270
|
-
}
|
|
271
|
-
];
|
|
272
|
-
[self verifyGesture:gesture orientation:orientation];
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
@end
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
@implementation FBAppiumTouchActionsIntegrationTestsPart2
|
|
279
|
-
|
|
280
|
-
- (void)setUp
|
|
281
|
-
{
|
|
282
|
-
[super setUp];
|
|
283
|
-
static dispatch_once_t onceToken;
|
|
284
|
-
dispatch_once(&onceToken, ^{
|
|
285
|
-
[self launchApplication];
|
|
286
|
-
[self goToAttributesPage];
|
|
287
|
-
});
|
|
288
|
-
self.pickerWheel = self.testedApplication.pickerWheels.allElementsBoundByIndex.firstObject;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
- (void)tearDown
|
|
292
|
-
{
|
|
293
|
-
[self resetOrientation];
|
|
294
|
-
[super tearDown];
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
- (void)verifyPickerWheelPositionChangeWithGesture:(NSArray<NSDictionary<NSString *, id> *> *)gesture
|
|
298
|
-
{
|
|
299
|
-
NSString *previousValue = self.pickerWheel.value;
|
|
300
|
-
NSError *error;
|
|
301
|
-
XCTAssertTrue([self.testedApplication fb_performAppiumTouchActions:gesture elementCache:nil error:&error]);
|
|
302
|
-
XCTAssertNil(error);
|
|
303
|
-
XCTAssertTrue([[[[FBRunLoopSpinner new]
|
|
304
|
-
timeout:2.0]
|
|
305
|
-
timeoutErrorMessage:@"Picker wheel value has not been changed after 2 seconds timeout"]
|
|
306
|
-
spinUntilTrue:^BOOL{
|
|
307
|
-
return ![self.pickerWheel.fb_takeSnapshot.value isEqualToString:previousValue];
|
|
308
|
-
}
|
|
309
|
-
error:&error]);
|
|
310
|
-
XCTAssertNil(error);
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
- (void)testSwipePickerWheelWithElementCoordinates
|
|
314
|
-
{
|
|
315
|
-
CGRect pickerFrame = self.pickerWheel.frame;
|
|
316
|
-
NSArray<NSDictionary<NSString *, id> *> *gesture =
|
|
317
|
-
@[@{
|
|
318
|
-
@"action": @"press",
|
|
319
|
-
@"options": @{
|
|
320
|
-
@"ELEMENT": self.pickerWheel,
|
|
321
|
-
@"x": @(pickerFrame.size.width / 2),
|
|
322
|
-
@"y": @(pickerFrame.size.height / 2),
|
|
323
|
-
}
|
|
324
|
-
},
|
|
325
|
-
@{
|
|
326
|
-
@"action": @"wait",
|
|
327
|
-
@"options": @{
|
|
328
|
-
@"ms": @500,
|
|
329
|
-
}
|
|
330
|
-
},
|
|
331
|
-
@{
|
|
332
|
-
@"action": @"moveTo",
|
|
333
|
-
@"options": @{
|
|
334
|
-
@"ELEMENT": self.pickerWheel,
|
|
335
|
-
@"x": @(pickerFrame.size.width / 2),
|
|
336
|
-
@"y": @(pickerFrame.size.height),
|
|
337
|
-
}
|
|
338
|
-
},
|
|
339
|
-
@{
|
|
340
|
-
@"action": @"release"
|
|
341
|
-
}
|
|
342
|
-
];
|
|
343
|
-
[self verifyPickerWheelPositionChangeWithGesture:gesture];
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
- (void)testSwipePickerWheelWithRelativeCoordinates
|
|
347
|
-
{
|
|
348
|
-
CGRect pickerFrame = self.pickerWheel.frame;
|
|
349
|
-
NSArray<NSDictionary<NSString *, id> *> *gesture =
|
|
350
|
-
@[@{
|
|
351
|
-
@"action": @"press",
|
|
352
|
-
@"options": @{
|
|
353
|
-
@"ELEMENT": self.pickerWheel,
|
|
354
|
-
@"x": @(pickerFrame.size.width / 2),
|
|
355
|
-
@"y": @(pickerFrame.size.height / 2),
|
|
356
|
-
}
|
|
357
|
-
},
|
|
358
|
-
@{
|
|
359
|
-
@"action": @"wait",
|
|
360
|
-
@"options": @{
|
|
361
|
-
@"ms": @500,
|
|
362
|
-
}
|
|
363
|
-
},
|
|
364
|
-
@{
|
|
365
|
-
@"action": @"moveTo",
|
|
366
|
-
@"options": @{
|
|
367
|
-
@"x": @(pickerFrame.origin.x / 2),
|
|
368
|
-
@"y": @(pickerFrame.origin.y),
|
|
369
|
-
}
|
|
370
|
-
},
|
|
371
|
-
@{
|
|
372
|
-
@"action": @"release"
|
|
373
|
-
}
|
|
374
|
-
];
|
|
375
|
-
[self verifyPickerWheelPositionChangeWithGesture:gesture];
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
- (void)testSwipePickerWheelWithAbsoluteCoordinates
|
|
379
|
-
{
|
|
380
|
-
CGRect pickerFrame = self.pickerWheel.frame;
|
|
381
|
-
NSArray<NSDictionary<NSString *, id> *> *gesture =
|
|
382
|
-
@[@{
|
|
383
|
-
@"action": @"longPress",
|
|
384
|
-
@"options": @{
|
|
385
|
-
@"x": @(pickerFrame.origin.x + pickerFrame.size.width / 2),
|
|
386
|
-
@"y": @(pickerFrame.origin.y + pickerFrame.size.height / 2),
|
|
387
|
-
}
|
|
388
|
-
},
|
|
389
|
-
@{
|
|
390
|
-
@"action": @"moveTo",
|
|
391
|
-
@"options": @{
|
|
392
|
-
@"x": @(pickerFrame.origin.x + pickerFrame.size.width / 2),
|
|
393
|
-
@"y": @(pickerFrame.origin.y + pickerFrame.size.height),
|
|
394
|
-
}
|
|
395
|
-
},
|
|
396
|
-
@{
|
|
397
|
-
@"action": @"release"
|
|
398
|
-
}
|
|
399
|
-
];
|
|
400
|
-
[self verifyPickerWheelPositionChangeWithGesture:gesture];
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
@end
|
|
404
|
-
|