appium-webdriveragent 5.1.4 → 5.1.6
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 +14 -0
- package/WebDriverAgent.xcodeproj/project.pbxproj +0 -12
- package/WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m +2 -2
- package/WebDriverAgentLib/Categories/XCUIElement+FBForceTouch.m +4 -4
- package/WebDriverAgentLib/Categories/XCUIElement+FBTyping.m +1 -2
- package/WebDriverAgentLib/Commands/FBElementCommands.m +47 -88
- package/WebDriverAgentLib/FBAlert.m +14 -10
- package/WebDriverAgentLib/WebDriverAgentLib.h +0 -1
- package/WebDriverAgentTests/IntegrationTests/FBAlertTests.m +2 -3
- package/WebDriverAgentTests/IntegrationTests/FBAutoAlertsHandlerTests.m +2 -2
- package/WebDriverAgentTests/IntegrationTests/FBElementAttributeTests.m +1 -1
- package/WebDriverAgentTests/IntegrationTests/FBTapTest.m +4 -13
- package/package.json +2 -2
- package/WebDriverAgentLib/Categories/XCUIElement+FBTap.h +0 -35
- package/WebDriverAgentLib/Categories/XCUIElement+FBTap.m +0 -32
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [5.1.6](https://github.com/appium/WebDriverAgent/compare/v5.1.5...v5.1.6) (2023-05-18)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Miscellaneous Chores
|
|
5
|
+
|
|
6
|
+
* **deps:** bump @appium/support from 3.1.11 to 4.0.0 ([#710](https://github.com/appium/WebDriverAgent/issues/710)) ([3e49523](https://github.com/appium/WebDriverAgent/commit/3e495230674a46db29ecea3b36c2ed0ea1bf2842))
|
|
7
|
+
|
|
8
|
+
## [5.1.5](https://github.com/appium/WebDriverAgent/compare/v5.1.4...v5.1.5) (2023-05-18)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Miscellaneous Chores
|
|
12
|
+
|
|
13
|
+
* Drop obsolete workarounds for coordinates calculation ([#701](https://github.com/appium/WebDriverAgent/issues/701)) ([259f731](https://github.com/appium/WebDriverAgent/commit/259f7319305b15a3f541957d3ccaa3cb12c9e1a3))
|
|
14
|
+
|
|
1
15
|
## [5.1.4](https://github.com/appium/WebDriverAgent/compare/v5.1.3...v5.1.4) (2023-05-16)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -112,7 +112,6 @@
|
|
|
112
112
|
641EE6222240C5CA00173FCB /* FBApplication.m in Sources */ = {isa = PBXBuildFile; fileRef = EE9AB7671CAEDF0C008C271F /* FBApplication.m */; };
|
|
113
113
|
641EE6232240C5CA00173FCB /* FBScreen.m in Sources */ = {isa = PBXBuildFile; fileRef = 715AFAC01FFA29180053896D /* FBScreen.m */; };
|
|
114
114
|
641EE6242240C5CA00173FCB /* FBXCTestDaemonsProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = EE35AD7A1E3B80C000A02D78 /* FBXCTestDaemonsProxy.m */; };
|
|
115
|
-
641EE6252240C5CA00173FCB /* XCUIElement+FBTap.m in Sources */ = {isa = PBXBuildFile; fileRef = EE9AB74C1CAEDF0C008C271F /* XCUIElement+FBTap.m */; };
|
|
116
115
|
641EE6262240C5CA00173FCB /* FBMathUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = EE1888391DA661C400307AA8 /* FBMathUtils.m */; };
|
|
117
116
|
641EE6272240C5CA00173FCB /* FBXCAXClientProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 7157B290221DADD2001C348C /* FBXCAXClientProxy.m */; };
|
|
118
117
|
641EE6312240C5CA00173FCB /* XCUIElement+FBWebDriverAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = EEE376471D59FAE900ED88DD /* XCUIElement+FBWebDriverAttributes.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
|
@@ -161,7 +160,6 @@
|
|
|
161
160
|
641EE65D2240C5CA00173FCB /* XCTRunnerAutomationSession.h in Headers */ = {isa = PBXBuildFile; fileRef = EE35ACEE1E3B77D600A02D78 /* XCTRunnerAutomationSession.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
|
162
161
|
641EE65F2240C5CA00173FCB /* XCSourceCodeTreeNodeEnumerator.h in Headers */ = {isa = PBXBuildFile; fileRef = EE35ACC61E3B77D600A02D78 /* XCSourceCodeTreeNodeEnumerator.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
|
163
162
|
641EE6602240C5CA00173FCB /* XCUIElement+FBIsVisible.h in Headers */ = {isa = PBXBuildFile; fileRef = EE9AB7471CAEDF0C008C271F /* XCUIElement+FBIsVisible.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
|
164
|
-
641EE6612240C5CA00173FCB /* XCUIElement+FBTap.h in Headers */ = {isa = PBXBuildFile; fileRef = EE9AB74B1CAEDF0C008C271F /* XCUIElement+FBTap.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
|
165
163
|
641EE6622240C5CA00173FCB /* FBResponsePayload.h in Headers */ = {isa = PBXBuildFile; fileRef = EE9AB7821CAEDF0C008C271F /* FBResponsePayload.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
|
166
164
|
641EE6632240C5CA00173FCB /* FBUnknownCommands.h in Headers */ = {isa = PBXBuildFile; fileRef = EE9AB7641CAEDF0C008C271F /* FBUnknownCommands.h */; };
|
|
167
165
|
641EE6642240C5CA00173FCB /* NSPredicate+FBFormat.h in Headers */ = {isa = PBXBuildFile; fileRef = 71A224E31DE2F56600844D55 /* NSPredicate+FBFormat.h */; };
|
|
@@ -571,8 +569,6 @@
|
|
|
571
569
|
EE158AB11CBD456F00A3E3F0 /* XCUIElement+FBIsVisible.m in Sources */ = {isa = PBXBuildFile; fileRef = EE9AB7481CAEDF0C008C271F /* XCUIElement+FBIsVisible.m */; };
|
|
572
570
|
EE158AB21CBD456F00A3E3F0 /* XCUIElement+FBScrolling.h in Headers */ = {isa = PBXBuildFile; fileRef = EE9AB7491CAEDF0C008C271F /* XCUIElement+FBScrolling.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
|
573
571
|
EE158AB31CBD456F00A3E3F0 /* XCUIElement+FBScrolling.m in Sources */ = {isa = PBXBuildFile; fileRef = EE9AB74A1CAEDF0C008C271F /* XCUIElement+FBScrolling.m */; };
|
|
574
|
-
EE158AB41CBD456F00A3E3F0 /* XCUIElement+FBTap.h in Headers */ = {isa = PBXBuildFile; fileRef = EE9AB74B1CAEDF0C008C271F /* XCUIElement+FBTap.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
|
575
|
-
EE158AB51CBD456F00A3E3F0 /* XCUIElement+FBTap.m in Sources */ = {isa = PBXBuildFile; fileRef = EE9AB74C1CAEDF0C008C271F /* XCUIElement+FBTap.m */; };
|
|
576
572
|
EE158AB81CBD456F00A3E3F0 /* FBAlertViewCommands.h in Headers */ = {isa = PBXBuildFile; fileRef = EE9AB7501CAEDF0C008C271F /* FBAlertViewCommands.h */; };
|
|
577
573
|
EE158AB91CBD456F00A3E3F0 /* FBAlertViewCommands.m in Sources */ = {isa = PBXBuildFile; fileRef = EE9AB7511CAEDF0C008C271F /* FBAlertViewCommands.m */; };
|
|
578
574
|
EE158ABA1CBD456F00A3E3F0 /* FBCustomCommands.h in Headers */ = {isa = PBXBuildFile; fileRef = EE9AB7521CAEDF0C008C271F /* FBCustomCommands.h */; };
|
|
@@ -1272,8 +1268,6 @@
|
|
|
1272
1268
|
EE9AB7481CAEDF0C008C271F /* XCUIElement+FBIsVisible.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "XCUIElement+FBIsVisible.m"; sourceTree = "<group>"; };
|
|
1273
1269
|
EE9AB7491CAEDF0C008C271F /* XCUIElement+FBScrolling.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "XCUIElement+FBScrolling.h"; sourceTree = "<group>"; };
|
|
1274
1270
|
EE9AB74A1CAEDF0C008C271F /* XCUIElement+FBScrolling.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "XCUIElement+FBScrolling.m"; sourceTree = "<group>"; };
|
|
1275
|
-
EE9AB74B1CAEDF0C008C271F /* XCUIElement+FBTap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "XCUIElement+FBTap.h"; sourceTree = "<group>"; };
|
|
1276
|
-
EE9AB74C1CAEDF0C008C271F /* XCUIElement+FBTap.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "XCUIElement+FBTap.m"; sourceTree = "<group>"; };
|
|
1277
1271
|
EE9AB7501CAEDF0C008C271F /* FBAlertViewCommands.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBAlertViewCommands.h; sourceTree = "<group>"; };
|
|
1278
1272
|
EE9AB7511CAEDF0C008C271F /* FBAlertViewCommands.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBAlertViewCommands.m; sourceTree = "<group>"; };
|
|
1279
1273
|
EE9AB7521CAEDF0C008C271F /* FBCustomCommands.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBCustomCommands.h; sourceTree = "<group>"; };
|
|
@@ -1757,8 +1751,6 @@
|
|
|
1757
1751
|
EE9AB74A1CAEDF0C008C271F /* XCUIElement+FBScrolling.m */,
|
|
1758
1752
|
71F5BE21252E576C00EE9EBA /* XCUIElement+FBSwiping.h */,
|
|
1759
1753
|
71F5BE22252E576C00EE9EBA /* XCUIElement+FBSwiping.m */,
|
|
1760
|
-
EE9AB74B1CAEDF0C008C271F /* XCUIElement+FBTap.h */,
|
|
1761
|
-
EE9AB74C1CAEDF0C008C271F /* XCUIElement+FBTap.m */,
|
|
1762
1754
|
AD76723B1D6B7CC000610457 /* XCUIElement+FBTyping.h */,
|
|
1763
1755
|
AD76723C1D6B7CC000610457 /* XCUIElement+FBTyping.m */,
|
|
1764
1756
|
71B49EC51ED1A58100D51AD6 /* XCUIElement+FBUID.h */,
|
|
@@ -2299,7 +2291,6 @@
|
|
|
2299
2291
|
641EE65D2240C5CA00173FCB /* XCTRunnerAutomationSession.h in Headers */,
|
|
2300
2292
|
641EE65F2240C5CA00173FCB /* XCSourceCodeTreeNodeEnumerator.h in Headers */,
|
|
2301
2293
|
641EE6602240C5CA00173FCB /* XCUIElement+FBIsVisible.h in Headers */,
|
|
2302
|
-
641EE6612240C5CA00173FCB /* XCUIElement+FBTap.h in Headers */,
|
|
2303
2294
|
641EE6622240C5CA00173FCB /* FBResponsePayload.h in Headers */,
|
|
2304
2295
|
641EE6632240C5CA00173FCB /* FBUnknownCommands.h in Headers */,
|
|
2305
2296
|
641EE7062240CDCF00173FCB /* XCUIElement+FBTVFocuse.h in Headers */,
|
|
@@ -2536,7 +2527,6 @@
|
|
|
2536
2527
|
EE35AD371E3B77D600A02D78 /* XCSourceCodeTreeNodeEnumerator.h in Headers */,
|
|
2537
2528
|
EE158AB01CBD456F00A3E3F0 /* XCUIElement+FBIsVisible.h in Headers */,
|
|
2538
2529
|
71414ED42670A1EE003A8C5D /* LRUCache.h in Headers */,
|
|
2539
|
-
EE158AB41CBD456F00A3E3F0 /* XCUIElement+FBTap.h in Headers */,
|
|
2540
2530
|
EE158ADC1CBD456F00A3E3F0 /* FBResponsePayload.h in Headers */,
|
|
2541
2531
|
13815F6F2328D20400CDAB61 /* FBActiveAppDetectionPoint.h in Headers */,
|
|
2542
2532
|
EE158ACC1CBD456F00A3E3F0 /* FBUnknownCommands.h in Headers */,
|
|
@@ -3159,7 +3149,6 @@
|
|
|
3159
3149
|
641EE6232240C5CA00173FCB /* FBScreen.m in Sources */,
|
|
3160
3150
|
71D04DCB25356C43008A052C /* XCUIElement+FBCaching.m in Sources */,
|
|
3161
3151
|
641EE6242240C5CA00173FCB /* FBXCTestDaemonsProxy.m in Sources */,
|
|
3162
|
-
641EE6252240C5CA00173FCB /* XCUIElement+FBTap.m in Sources */,
|
|
3163
3152
|
13DE7A58287CA1EC003243C6 /* FBXCElementSnapshotWrapper.m in Sources */,
|
|
3164
3153
|
641EE6262240C5CA00173FCB /* FBMathUtils.m in Sources */,
|
|
3165
3154
|
641EE6272240C5CA00173FCB /* FBXCAXClientProxy.m in Sources */,
|
|
@@ -3292,7 +3281,6 @@
|
|
|
3292
3281
|
715AFAC21FFA29180053896D /* FBScreen.m in Sources */,
|
|
3293
3282
|
71B155DC230711E900646AFB /* FBCommandStatus.m in Sources */,
|
|
3294
3283
|
EE35AD7C1E3B80C000A02D78 /* FBXCTestDaemonsProxy.m in Sources */,
|
|
3295
|
-
EE158AB51CBD456F00A3E3F0 /* XCUIElement+FBTap.m in Sources */,
|
|
3296
3284
|
EE18883B1DA661C400307AA8 /* FBMathUtils.m in Sources */,
|
|
3297
3285
|
7157B292221DADD2001C348C /* FBXCAXClientProxy.m in Sources */,
|
|
3298
3286
|
);
|
|
@@ -256,7 +256,7 @@ static NSString* const FBUnknownBundleId = @"unknown";
|
|
|
256
256
|
continue;
|
|
257
257
|
}
|
|
258
258
|
|
|
259
|
-
[matchedKey
|
|
259
|
+
[matchedKey tap];
|
|
260
260
|
if (isKeyboardInvisible()) {
|
|
261
261
|
return YES;
|
|
262
262
|
}
|
|
@@ -269,7 +269,7 @@ static NSString* const FBUnknownBundleId = @"unknown";
|
|
|
269
269
|
@[@(XCUIElementTypeKey), @(XCUIElementTypeButton)]];
|
|
270
270
|
NSArray *matchedKeys = findMatchingKeys(searchPredicate);
|
|
271
271
|
if (matchedKeys.count > 0) {
|
|
272
|
-
[matchedKeys[matchedKeys.count - 1]
|
|
272
|
+
[matchedKeys[matchedKeys.count - 1] tap];
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
275
|
#endif
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
[self pressWithPressure:[pressure doubleValue] duration:[duration doubleValue]];
|
|
36
36
|
}
|
|
37
37
|
} else {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
CGVector offset = CGVectorMake(relativeCoordinate.CGPointValue.x,
|
|
39
|
+
relativeCoordinate.CGPointValue.y);
|
|
40
|
+
XCUICoordinate *hitPoint = [[self coordinateWithNormalizedOffset:CGVectorMake(0, 0)]
|
|
41
|
+
coordinateWithOffset:offset];
|
|
42
42
|
if (nil == pressure || nil == duration) {
|
|
43
43
|
[hitPoint forcePress];
|
|
44
44
|
} else {
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
#import "FBXCElementSnapshotWrapper.h"
|
|
17
17
|
#import "FBXCElementSnapshotWrapper+Helpers.h"
|
|
18
18
|
#import "XCUIElement+FBCaching.h"
|
|
19
|
-
#import "XCUIElement+FBTap.h"
|
|
20
19
|
#import "XCUIElement+FBUtilities.h"
|
|
21
20
|
#import "FBXCodeCompatibility.h"
|
|
22
21
|
|
|
@@ -72,7 +71,7 @@
|
|
|
72
71
|
// There is no possibility to open the keyboard by tapping a field in TvOS
|
|
73
72
|
#if !TARGET_OS_TV
|
|
74
73
|
[FBLogger logFmt:@"Trying to tap the \"%@\" element to have it focused", snapshot.fb_description];
|
|
75
|
-
[self
|
|
74
|
+
[self tap];
|
|
76
75
|
// It might take some time to update the UI
|
|
77
76
|
[self fb_takeSnapshot];
|
|
78
77
|
#endif
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
#import "XCUIElement+FBIsVisible.h"
|
|
31
31
|
#import "XCUIElement+FBPickerWheel.h"
|
|
32
32
|
#import "XCUIElement+FBScrolling.h"
|
|
33
|
-
#import "XCUIElement+FBTap.h"
|
|
34
33
|
#import "XCUIElement+FBForceTouch.h"
|
|
35
34
|
#import "XCUIElement+FBSwiping.h"
|
|
36
35
|
#import "XCUIElement+FBTyping.h"
|
|
@@ -233,14 +232,14 @@
|
|
|
233
232
|
{
|
|
234
233
|
FBElementCache *elementCache = request.session.elementCache;
|
|
235
234
|
XCUIElement *element = [elementCache elementForUUID:(NSString *)request.parameters[@"uuid"]];
|
|
236
|
-
NSError *error = nil;
|
|
237
235
|
#if TARGET_OS_IOS
|
|
238
|
-
|
|
236
|
+
[element tap];
|
|
239
237
|
#elif TARGET_OS_TV
|
|
238
|
+
NSError *error = nil;
|
|
240
239
|
if (![element fb_selectWithError:&error]) {
|
|
241
|
-
#endif
|
|
242
240
|
return FBResponseWithStatus([FBCommandStatus invalidElementStateErrorWithMessage:error.description traceback:nil]);
|
|
243
241
|
}
|
|
242
|
+
#endif
|
|
244
243
|
return FBResponseWithOK();
|
|
245
244
|
}
|
|
246
245
|
|
|
@@ -296,9 +295,10 @@
|
|
|
296
295
|
|
|
297
296
|
+ (id<FBResponsePayload>)handleDoubleTapCoordinate:(FBRouteRequest *)request
|
|
298
297
|
{
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
298
|
+
CGVector offset = CGVectorMake([request.arguments[@"x"] doubleValue],
|
|
299
|
+
[request.arguments[@"y"] doubleValue]);
|
|
300
|
+
XCUICoordinate *doubleTapCoordinate = [self.class gestureCoordinateWithOffset:offset
|
|
301
|
+
element:request.session.activeApplication];
|
|
302
302
|
[doubleTapCoordinate doubleTap];
|
|
303
303
|
return FBResponseWithOK();
|
|
304
304
|
}
|
|
@@ -334,9 +334,10 @@
|
|
|
334
334
|
|
|
335
335
|
+ (id<FBResponsePayload>)handleTouchAndHoldCoordinate:(FBRouteRequest *)request
|
|
336
336
|
{
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
337
|
+
CGVector offset = CGVectorMake([request.arguments[@"x"] doubleValue],
|
|
338
|
+
[request.arguments[@"y"] doubleValue]);
|
|
339
|
+
XCUICoordinate *pressCoordinate = [self.class gestureCoordinateWithOffset:offset
|
|
340
|
+
element:request.session.activeApplication];
|
|
340
341
|
[pressCoordinate pressForDuration:[request.arguments[@"duration"] doubleValue]];
|
|
341
342
|
return FBResponseWithOK();
|
|
342
343
|
}
|
|
@@ -359,18 +360,18 @@
|
|
|
359
360
|
+ (id<FBResponsePayload>)handlePressAndDragCoordinateWithVelocity:(FBRouteRequest *)request
|
|
360
361
|
{
|
|
361
362
|
FBSession *session = request.session;
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
XCUICoordinate *endCoordinate = [self.class gestureCoordinateWithCoordinate:endPoint
|
|
367
|
-
application:session.activeApplication];
|
|
368
|
-
XCUICoordinate *startCoordinate = [self.class gestureCoordinateWithCoordinate:startPoint
|
|
369
|
-
application:session.activeApplication];
|
|
363
|
+
CGVector startOffset = CGVectorMake((CGFloat)[request.arguments[@"fromX"] doubleValue],
|
|
364
|
+
(CGFloat)[request.arguments[@"fromY"] doubleValue]);
|
|
365
|
+
XCUICoordinate *startCoordinate = [self.class gestureCoordinateWithOffset:startOffset
|
|
366
|
+
element:session.activeApplication];
|
|
370
367
|
if (![startCoordinate respondsToSelector:@selector(pressForDuration:thenDragToCoordinate:withVelocity:thenHoldForDuration:)]) {
|
|
371
368
|
return FBResponseWithStatus([FBCommandStatus unsupportedOperationErrorWithMessage:@"This method is only supported in Xcode 12 and above"
|
|
372
369
|
traceback:nil]);
|
|
373
370
|
}
|
|
371
|
+
CGVector endOffset = CGVectorMake((CGFloat)[request.arguments[@"toX"] doubleValue],
|
|
372
|
+
(CGFloat)[request.arguments[@"toY"] doubleValue]);
|
|
373
|
+
XCUICoordinate *endCoordinate = [self.class gestureCoordinateWithOffset:endOffset
|
|
374
|
+
element:session.activeApplication];
|
|
374
375
|
[startCoordinate pressForDuration:[request.arguments[@"pressDuration"] doubleValue]
|
|
375
376
|
thenDragToCoordinate:endCoordinate
|
|
376
377
|
withVelocity:[request.arguments[@"velocity"] doubleValue]
|
|
@@ -444,13 +445,15 @@
|
|
|
444
445
|
+ (id<FBResponsePayload>)handleDragCoordinate:(FBRouteRequest *)request
|
|
445
446
|
{
|
|
446
447
|
FBSession *session = request.session;
|
|
447
|
-
|
|
448
|
-
|
|
448
|
+
CGVector startOffset = CGVectorMake([request.arguments[@"fromX"] doubleValue],
|
|
449
|
+
[request.arguments[@"fromY"] doubleValue]);
|
|
450
|
+
XCUICoordinate *startCoordinate = [self.class gestureCoordinateWithOffset:startOffset
|
|
451
|
+
element:session.activeApplication];
|
|
452
|
+
CGVector endOffset = CGVectorMake([request.arguments[@"toX"] doubleValue],
|
|
453
|
+
[request.arguments[@"toY"] doubleValue]);
|
|
454
|
+
XCUICoordinate *endCoordinate = [self.class gestureCoordinateWithOffset:endOffset
|
|
455
|
+
element:session.activeApplication];
|
|
449
456
|
NSTimeInterval duration = [request.arguments[@"duration"] doubleValue];
|
|
450
|
-
XCUICoordinate *endCoordinate = [self.class gestureCoordinateWithCoordinate:endPoint
|
|
451
|
-
application:session.activeApplication];
|
|
452
|
-
XCUICoordinate *startCoordinate = [self.class gestureCoordinateWithCoordinate:startPoint
|
|
453
|
-
application:session.activeApplication];
|
|
454
457
|
[startCoordinate pressForDuration:duration thenDragToCoordinate:endCoordinate];
|
|
455
458
|
return FBResponseWithOK();
|
|
456
459
|
}
|
|
@@ -460,14 +463,13 @@
|
|
|
460
463
|
FBSession *session = request.session;
|
|
461
464
|
FBElementCache *elementCache = session.elementCache;
|
|
462
465
|
XCUIElement *element = [elementCache elementForUUID:(NSString *)request.parameters[@"uuid"]];
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
+
CGVector startOffset = CGVectorMake([request.arguments[@"fromX"] doubleValue],
|
|
467
|
+
[request.arguments[@"fromY"] doubleValue]);
|
|
468
|
+
XCUICoordinate *startCoordinate = [self.class gestureCoordinateWithOffset:startOffset element:element];
|
|
469
|
+
CGVector endOffset = CGVectorMake([request.arguments[@"toX"] doubleValue],
|
|
470
|
+
[request.arguments[@"toY"] doubleValue]);
|
|
471
|
+
XCUICoordinate *endCoordinate = [self.class gestureCoordinateWithOffset:endOffset element:element];
|
|
466
472
|
NSTimeInterval duration = [request.arguments[@"duration"] doubleValue];
|
|
467
|
-
XCUICoordinate *endCoordinate = [self.class gestureCoordinateWithCoordinate:endPoint
|
|
468
|
-
application:session.activeApplication];
|
|
469
|
-
XCUICoordinate *startCoordinate = [self.class gestureCoordinateWithCoordinate:startPoint
|
|
470
|
-
application:session.activeApplication];
|
|
471
473
|
[startCoordinate pressForDuration:duration thenDragToCoordinate:endCoordinate];
|
|
472
474
|
return FBResponseWithOK();
|
|
473
475
|
}
|
|
@@ -493,19 +495,13 @@
|
|
|
493
495
|
+ (id<FBResponsePayload>)handleTap:(FBRouteRequest *)request
|
|
494
496
|
{
|
|
495
497
|
FBElementCache *elementCache = request.session.elementCache;
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
}
|
|
504
|
-
} else {
|
|
505
|
-
XCUICoordinate *tapCoordinate = [self.class gestureCoordinateWithCoordinate:tapPoint
|
|
506
|
-
application:request.session.activeApplication];
|
|
507
|
-
[tapCoordinate tap];
|
|
508
|
-
}
|
|
498
|
+
CGVector offset = CGVectorMake([request.arguments[@"x"] doubleValue],
|
|
499
|
+
[request.arguments[@"y"] doubleValue]);
|
|
500
|
+
XCUIElement *element = [elementCache hasElementWithUUID:request.parameters[@"uuid"]]
|
|
501
|
+
? [elementCache elementForUUID:(NSString *)request.parameters[@"uuid"]]
|
|
502
|
+
: request.session.activeApplication;
|
|
503
|
+
XCUICoordinate *tapCoordinate = [self.class gestureCoordinateWithOffset:offset element:element];
|
|
504
|
+
[tapCoordinate tap];
|
|
509
505
|
return FBResponseWithOK();
|
|
510
506
|
}
|
|
511
507
|
|
|
@@ -672,55 +668,18 @@ static const NSInteger DEFAULT_MAX_PICKER_ATTEMPTS = 25;
|
|
|
672
668
|
}
|
|
673
669
|
|
|
674
670
|
/**
|
|
675
|
-
Returns gesture coordinate for the
|
|
671
|
+
Returns gesture coordinate for the element based on absolute coordinate
|
|
676
672
|
|
|
677
|
-
@param
|
|
678
|
-
@param
|
|
673
|
+
@param offset absolute screen offset for the given application
|
|
674
|
+
@param element the element instance to perform the gesture on
|
|
679
675
|
@return translated gesture coordinates ready to be passed to XCUICoordinate methods
|
|
680
676
|
*/
|
|
681
|
-
+ (XCUICoordinate *)
|
|
682
|
-
|
|
683
|
-
{
|
|
684
|
-
CGPoint point = coordinate;
|
|
685
|
-
/**
|
|
686
|
-
If SDK >= 11, the tap coordinate based on application is not correct when
|
|
687
|
-
the application orientation is landscape and
|
|
688
|
-
tapX > application portrait width or tapY > application portrait height.
|
|
689
|
-
Pass the window element to the method [FBElementCommands gestureCoordinateWithCoordinate:element:]
|
|
690
|
-
will resolve the problem.
|
|
691
|
-
More details about the bug, please see the following issues:
|
|
692
|
-
#705: https://github.com/facebook/WebDriverAgent/issues/705
|
|
693
|
-
#798: https://github.com/facebook/WebDriverAgent/issues/798
|
|
694
|
-
#856: https://github.com/facebook/WebDriverAgent/issues/856
|
|
695
|
-
Notice: On iOS 10, if the application is not launched by wda, no elements will be found.
|
|
696
|
-
See issue #732: https://github.com/facebook/WebDriverAgent/issues/732
|
|
697
|
-
*/
|
|
698
|
-
XCUIElement *element = application;
|
|
699
|
-
XCUIElement *window = application.windows.allElementsBoundByIndex.firstObject;
|
|
700
|
-
if (window) {
|
|
701
|
-
element = window;
|
|
702
|
-
id<FBXCElementSnapshot> snapshot = element.fb_cachedSnapshot ?: element.fb_takeSnapshot;
|
|
703
|
-
point.x -= snapshot.frame.origin.x;
|
|
704
|
-
point.y -= snapshot.frame.origin.y;
|
|
705
|
-
}
|
|
706
|
-
return [self gestureCoordinateWithCoordinate:point element:element];
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
/**
|
|
710
|
-
Returns gesture coordinate based on the specified element.
|
|
711
|
-
|
|
712
|
-
@param coordinate absolute coordinates based on the element
|
|
713
|
-
@param element the element in the current application under test
|
|
714
|
-
@return translated gesture coordinates ready to be passed to XCUICoordinate methods
|
|
715
|
-
*/
|
|
716
|
-
+ (XCUICoordinate *)gestureCoordinateWithCoordinate:(CGPoint)coordinate
|
|
717
|
-
element:(XCUIElement *)element
|
|
677
|
+
+ (XCUICoordinate *)gestureCoordinateWithOffset:(CGVector)offset
|
|
678
|
+
element:(XCUIElement *)element
|
|
718
679
|
{
|
|
719
|
-
|
|
720
|
-
normalizedOffset:CGVectorMake(0, 0)];
|
|
721
|
-
return [[XCUICoordinate alloc] initWithCoordinate:appCoordinate
|
|
722
|
-
pointsOffset:CGVectorMake(coordinate.x, coordinate.y)];
|
|
680
|
+
return [[element coordinateWithNormalizedOffset:CGVectorMake(0, 0)] coordinateWithOffset:offset];
|
|
723
681
|
}
|
|
682
|
+
|
|
724
683
|
#endif
|
|
725
684
|
|
|
726
685
|
@end
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
#import "FBXCodeCompatibility.h"
|
|
18
18
|
#import "XCUIApplication+FBAlert.h"
|
|
19
19
|
#import "XCUIElement+FBClassChain.h"
|
|
20
|
-
#import "XCUIElement+FBTap.h"
|
|
21
20
|
#import "XCUIElement+FBTyping.h"
|
|
22
21
|
#import "XCUIElement+FBUtilities.h"
|
|
23
22
|
#import "XCUIElement+FBWebDriverAttributes.h"
|
|
@@ -190,11 +189,13 @@
|
|
|
190
189
|
? buttons.lastObject
|
|
191
190
|
: buttons.firstObject;
|
|
192
191
|
}
|
|
193
|
-
|
|
194
|
-
|
|
192
|
+
if (nil == acceptButton) {
|
|
193
|
+
return [[[FBErrorBuilder builder]
|
|
195
194
|
withDescriptionFormat:@"Failed to find accept button for alert: %@", self.alertElement]
|
|
196
|
-
|
|
197
|
-
|
|
195
|
+
buildError:error];
|
|
196
|
+
}
|
|
197
|
+
[acceptButton tap];
|
|
198
|
+
return YES;
|
|
198
199
|
}
|
|
199
200
|
|
|
200
201
|
- (BOOL)dismissWithError:(NSError **)error
|
|
@@ -230,11 +231,13 @@
|
|
|
230
231
|
: buttons.lastObject;
|
|
231
232
|
}
|
|
232
233
|
|
|
233
|
-
|
|
234
|
-
|
|
234
|
+
if (nil == dismissButton) {
|
|
235
|
+
return [[[FBErrorBuilder builder]
|
|
235
236
|
withDescriptionFormat:@"Failed to find dismiss button for alert: %@", self.alertElement]
|
|
236
|
-
|
|
237
|
-
|
|
237
|
+
buildError:error];
|
|
238
|
+
}
|
|
239
|
+
[dismissButton tap];
|
|
240
|
+
return YES;
|
|
238
241
|
}
|
|
239
242
|
|
|
240
243
|
- (BOOL)clickAlertButton:(NSString *)label error:(NSError **)error
|
|
@@ -251,7 +254,8 @@
|
|
|
251
254
|
withDescriptionFormat:@"Failed to find button with label '%@' for alert: %@", label, self.alertElement]
|
|
252
255
|
buildError:error];
|
|
253
256
|
}
|
|
254
|
-
|
|
257
|
+
[requestedButton tap];
|
|
258
|
+
return YES;
|
|
255
259
|
}
|
|
256
260
|
|
|
257
261
|
- (XCUIElement *)alertElement
|
|
@@ -46,7 +46,6 @@ FOUNDATION_EXPORT const unsigned char WebDriverAgentLib_VersionString[];
|
|
|
46
46
|
#import <WebDriverAgentLib/XCUIElement+FBFind.h>
|
|
47
47
|
#import <WebDriverAgentLib/XCUIElement+FBIsVisible.h>
|
|
48
48
|
#import <WebDriverAgentLib/XCUIElement+FBScrolling.h>
|
|
49
|
-
#import <WebDriverAgentLib/XCUIElement+FBTap.h>
|
|
50
49
|
#import <WebDriverAgentLib/XCUIElement+FBForceTouch.h>
|
|
51
50
|
#import <WebDriverAgentLib/XCUIElement+FBUtilities.h>
|
|
52
51
|
#import <WebDriverAgentLib/XCUIElement+FBWebDriverAttributes.h>
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
#import "FBIntegrationTestCase.h"
|
|
16
16
|
#import "FBTestMacros.h"
|
|
17
17
|
#import "FBMacros.h"
|
|
18
|
-
#import "XCUIElement+FBTap.h"
|
|
19
18
|
|
|
20
19
|
@interface FBAlertTests : FBIntegrationTestCase
|
|
21
20
|
@end
|
|
@@ -42,13 +41,13 @@
|
|
|
42
41
|
|
|
43
42
|
- (void)showApplicationAlert
|
|
44
43
|
{
|
|
45
|
-
[self.testedApplication.buttons[FBShowAlertButtonName]
|
|
44
|
+
[self.testedApplication.buttons[FBShowAlertButtonName] tap];
|
|
46
45
|
FBAssertWaitTillBecomesTrue(self.testedApplication.alerts.count != 0);
|
|
47
46
|
}
|
|
48
47
|
|
|
49
48
|
- (void)showApplicationSheet
|
|
50
49
|
{
|
|
51
|
-
[self.testedApplication.buttons[FBShowSheetAlertButtonName]
|
|
50
|
+
[self.testedApplication.buttons[FBShowSheetAlertButtonName] tap];
|
|
52
51
|
FBAssertWaitTillBecomesTrue(self.testedApplication.sheets.count != 0);
|
|
53
52
|
}
|
|
54
53
|
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
initWithApplication:FBApplication.fb_activeApplication
|
|
54
54
|
defaultAlertAction:@"accept"];
|
|
55
55
|
for (int i = 0; i < 2; i++) {
|
|
56
|
-
[self.testedApplication.buttons[FBShowAlertButtonName]
|
|
56
|
+
[self.testedApplication.buttons[FBShowAlertButtonName] tap];
|
|
57
57
|
[self.testedApplication fb_waitUntilStable];
|
|
58
58
|
FBAssertWaitTillBecomesTrue(self.testedApplication.alerts.count == 0);
|
|
59
59
|
}
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
initWithApplication:FBApplication.fb_activeApplication
|
|
67
67
|
defaultAlertAction:@"dismiss"];
|
|
68
68
|
for (int i = 0; i < 2; i++) {
|
|
69
|
-
[self.testedApplication.buttons[FBShowAlertButtonName]
|
|
69
|
+
[self.testedApplication.buttons[FBShowAlertButtonName] tap];
|
|
70
70
|
[self.testedApplication fb_waitUntilStable];
|
|
71
71
|
FBAssertWaitTillBecomesTrue(self.testedApplication.alerts.count == 0);
|
|
72
72
|
}
|
|
@@ -160,7 +160,7 @@
|
|
|
160
160
|
XCTAssertNil(element.wdLabel);
|
|
161
161
|
XCTAssertEqualObjects(element.wdValue, @"1");
|
|
162
162
|
XCTAssertFalse(element.wdSelected);
|
|
163
|
-
|
|
163
|
+
[element tap];
|
|
164
164
|
XCTAssertEqualObjects(element.wdValue, @"0");
|
|
165
165
|
XCTAssertFalse(element.wdSelected);
|
|
166
166
|
}
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
#import "FBElementCache.h"
|
|
16
16
|
#import "FBTestMacros.h"
|
|
17
17
|
#import "XCUIDevice+FBRotation.h"
|
|
18
|
-
#import "XCUIElement+FBTap.h"
|
|
19
18
|
#import "XCUIElement+FBIsVisible.h"
|
|
20
19
|
|
|
21
20
|
@interface FBTapTest : FBIntegrationTestCase
|
|
@@ -28,8 +27,7 @@
|
|
|
28
27
|
- (void)verifyTapWithOrientation:(UIDeviceOrientation)orientation
|
|
29
28
|
{
|
|
30
29
|
[[XCUIDevice sharedDevice] fb_setDeviceInterfaceOrientation:orientation];
|
|
31
|
-
|
|
32
|
-
[self.testedApplication.buttons[FBShowAlertButtonName] fb_tapWithError:&error];
|
|
30
|
+
[self.testedApplication.buttons[FBShowAlertButtonName] tap];
|
|
33
31
|
FBAssertWaitTillBecomesTrue(self.testedApplication.alerts.count > 0);
|
|
34
32
|
}
|
|
35
33
|
|
|
@@ -66,10 +64,7 @@
|
|
|
66
64
|
[self verifyTapWithOrientation:UIDeviceOrientationLandscapeRight];
|
|
67
65
|
}
|
|
68
66
|
|
|
69
|
-
|
|
70
|
-
// and cannot be workarounded properly, but this is not very important for Appium, since
|
|
71
|
-
// We don't support such orientation anyway
|
|
72
|
-
- (void)disabled_testTapInPortraitUpsideDown
|
|
67
|
+
- (void)testTapInPortraitUpsideDown
|
|
73
68
|
{
|
|
74
69
|
[self verifyTapWithOrientation:UIDeviceOrientationPortraitUpsideDown];
|
|
75
70
|
}
|
|
@@ -77,9 +72,8 @@
|
|
|
77
72
|
- (void)verifyTapByCoordinatesWithOrientation:(UIDeviceOrientation)orientation
|
|
78
73
|
{
|
|
79
74
|
[[XCUIDevice sharedDevice] fb_setDeviceInterfaceOrientation:orientation];
|
|
80
|
-
NSError *error;
|
|
81
75
|
XCUIElement *dstButton = self.testedApplication.buttons[FBShowAlertButtonName];
|
|
82
|
-
[dstButton
|
|
76
|
+
[[dstButton coordinateWithNormalizedOffset:CGVectorMake(0.5, 0.5)] tap];
|
|
83
77
|
FBAssertWaitTillBecomesTrue(self.testedApplication.alerts.count > 0);
|
|
84
78
|
}
|
|
85
79
|
|
|
@@ -98,10 +92,7 @@
|
|
|
98
92
|
[self verifyTapByCoordinatesWithOrientation:UIDeviceOrientationLandscapeRight];
|
|
99
93
|
}
|
|
100
94
|
|
|
101
|
-
|
|
102
|
-
// and cannot be workarounded properly, but this is not very important for Appium, since
|
|
103
|
-
// We don't support such orientation anyway
|
|
104
|
-
- (void)disabled_testTapCoordinatesInPortraitUpsideDown
|
|
95
|
+
- (void)testTapCoordinatesInPortraitUpsideDown
|
|
105
96
|
{
|
|
106
97
|
[self verifyTapByCoordinatesWithOrientation:UIDeviceOrientationPortraitUpsideDown];
|
|
107
98
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appium-webdriveragent",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.6",
|
|
4
4
|
"description": "Package bundling WebDriverAgent",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
},
|
|
85
85
|
"dependencies": {
|
|
86
86
|
"@appium/base-driver": "^9.0.0",
|
|
87
|
-
"@appium/support": "^
|
|
87
|
+
"@appium/support": "^4.0.0",
|
|
88
88
|
"@babel/runtime": "^7.0.0",
|
|
89
89
|
"appium-ios-device": "^2.5.0",
|
|
90
90
|
"appium-ios-simulator": "^5.0.1",
|
|
@@ -1,35 +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 <WebDriverAgentLib/XCUIElement.h>
|
|
11
|
-
|
|
12
|
-
NS_ASSUME_NONNULL_BEGIN
|
|
13
|
-
|
|
14
|
-
@interface XCUIElement (FBTap)
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
Waits for element to become stable (not move) and performs sync tap on element
|
|
18
|
-
|
|
19
|
-
@param error If there is an error, upon return contains an NSError object that describes the problem.
|
|
20
|
-
@return YES if the operation succeeds, otherwise NO.
|
|
21
|
-
*/
|
|
22
|
-
- (BOOL)fb_tapWithError:(NSError **)error;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
Waits for element to become stable (not move) and performs sync tap on element
|
|
26
|
-
|
|
27
|
-
@param relativeCoordinate hit point coordinate relative to the current element position
|
|
28
|
-
@param error If there is an error, upon return contains an NSError object that describes the problem.
|
|
29
|
-
@return YES if the operation succeeds, otherwise NO.
|
|
30
|
-
*/
|
|
31
|
-
- (BOOL)fb_tapCoordinate:(CGPoint)relativeCoordinate error:(NSError **)error;
|
|
32
|
-
|
|
33
|
-
@end
|
|
34
|
-
|
|
35
|
-
NS_ASSUME_NONNULL_END
|
|
@@ -1,32 +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 "XCUIElement+FBTap.h"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
#if !TARGET_OS_TV
|
|
14
|
-
@implementation XCUIElement (FBTap)
|
|
15
|
-
|
|
16
|
-
- (BOOL)fb_tapWithError:(NSError **)error
|
|
17
|
-
{
|
|
18
|
-
[self tap];
|
|
19
|
-
return YES;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
- (BOOL)fb_tapCoordinate:(CGPoint)relativeCoordinate error:(NSError **)error
|
|
23
|
-
{
|
|
24
|
-
XCUICoordinate *startCoordinate = [self coordinateWithNormalizedOffset:CGVectorMake(0, 0)];
|
|
25
|
-
CGVector offset = CGVectorMake(relativeCoordinate.x, relativeCoordinate.y);
|
|
26
|
-
XCUICoordinate *dstCoordinate = [startCoordinate coordinateWithOffset:offset];
|
|
27
|
-
[dstCoordinate tap];
|
|
28
|
-
return YES;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
@end
|
|
32
|
-
#endif
|