appium-webdriveragent 5.1.3 → 5.1.5

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 CHANGED
@@ -1,3 +1,17 @@
1
+ ## [5.1.5](https://github.com/appium/WebDriverAgent/compare/v5.1.4...v5.1.5) (2023-05-18)
2
+
3
+
4
+ ### Miscellaneous Chores
5
+
6
+ * Drop obsolete workarounds for coordinates calculation ([#701](https://github.com/appium/WebDriverAgent/issues/701)) ([259f731](https://github.com/appium/WebDriverAgent/commit/259f7319305b15a3f541957d3ccaa3cb12c9e1a3))
7
+
8
+ ## [5.1.4](https://github.com/appium/WebDriverAgent/compare/v5.1.3...v5.1.4) (2023-05-16)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * Prevent freeze on launch/activate of a missing app ([#706](https://github.com/appium/WebDriverAgent/issues/706)) ([c4976e3](https://github.com/appium/WebDriverAgent/commit/c4976e3e99afa4d471bd39c3dccfc7d9f58d8bfc))
14
+
1
15
  ## [5.1.3](https://github.com/appium/WebDriverAgent/compare/v5.1.2...v5.1.3) (2023-05-16)
2
16
 
3
17
 
@@ -80,4 +80,11 @@
80
80
  @property(readonly) _Bool supportsLocationSimulation;
81
81
  #endif
82
82
 
83
+ // Since Xcode 10.2
84
+ - (void)launchApplicationWithPath:(NSString *)arg1
85
+ bundleID:(NSString *)arg2
86
+ arguments:(NSArray *)arg3
87
+ environment:(NSDictionary *)arg4
88
+ completion:(void (^)(_Bool, NSError *))arg5;
89
+
83
90
  @end
@@ -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 fb_tapWithError:nil];
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] fb_tapWithError:nil];
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
- CGSize size = self.frame.size;
39
- CGVector offset = CGVectorMake(size.width > 0 ? relativeCoordinate.CGPointValue.x / size.width : 0,
40
- size.height > 0 ? relativeCoordinate.CGPointValue.y / size.height : 0);
41
- XCUICoordinate *hitPoint = [self coordinateWithNormalizedOffset:offset];
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 fb_tapWithError:nil];
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
- if (![element fb_tapWithError:&error]) {
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
- CGPoint doubleTapPoint = CGPointMake((CGFloat)[request.arguments[@"x"] doubleValue], (CGFloat)[request.arguments[@"y"] doubleValue]);
300
- XCUICoordinate *doubleTapCoordinate = [self.class gestureCoordinateWithCoordinate:doubleTapPoint
301
- application:request.session.activeApplication];
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
- CGPoint touchPoint = CGPointMake((CGFloat)[request.arguments[@"x"] doubleValue], (CGFloat)[request.arguments[@"y"] doubleValue]);
338
- XCUICoordinate *pressCoordinate = [self.class gestureCoordinateWithCoordinate:touchPoint
339
- application:request.session.activeApplication];
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
- CGPoint startPoint = CGPointMake((CGFloat)[request.arguments[@"fromX"] doubleValue],
363
- (CGFloat)[request.arguments[@"fromY"] doubleValue]);
364
- CGPoint endPoint = CGPointMake((CGFloat)[request.arguments[@"toX"] doubleValue],
365
- (CGFloat)[request.arguments[@"toY"] doubleValue]);
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
- CGPoint startPoint = CGPointMake((CGFloat)[request.arguments[@"fromX"] doubleValue], (CGFloat)[request.arguments[@"fromY"] doubleValue]);
448
- CGPoint endPoint = CGPointMake((CGFloat)[request.arguments[@"toX"] doubleValue], (CGFloat)[request.arguments[@"toY"] doubleValue]);
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
- CGRect frame = [(id<FBXCElementSnapshot>)element.lastSnapshot frame];
464
- CGPoint startPoint = CGPointMake((CGFloat)(frame.origin.x + [request.arguments[@"fromX"] doubleValue]), (CGFloat)(frame.origin.y + [request.arguments[@"fromY"] doubleValue]));
465
- CGPoint endPoint = CGPointMake((CGFloat)(frame.origin.x + [request.arguments[@"toX"] doubleValue]), (CGFloat)(frame.origin.y + [request.arguments[@"toY"] doubleValue]));
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
- CGPoint tapPoint = CGPointMake((CGFloat)[request.arguments[@"x"] doubleValue], (CGFloat)[request.arguments[@"y"] doubleValue]);
497
- if ([elementCache hasElementWithUUID:request.parameters[@"uuid"]]) {
498
- XCUIElement *element = [elementCache elementForUUID:(NSString *)request.parameters[@"uuid"]];
499
- NSError *error;
500
- if (![element fb_tapCoordinate:tapPoint error:&error]) {
501
- return FBResponseWithStatus([FBCommandStatus invalidElementStateErrorWithMessage:error.description
502
- traceback:nil]);
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 application based on absolute coordinate
671
+ Returns gesture coordinate for the element based on absolute coordinate
676
672
 
677
- @param coordinate absolute screen coordinates
678
- @param application the instance of current application under test
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 *)gestureCoordinateWithCoordinate:(CGPoint)coordinate
682
- application:(XCUIApplication *)application
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
- XCUICoordinate *appCoordinate = [[XCUICoordinate alloc] initWithElement:element
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
- return nil == acceptButton
194
- ? [[[FBErrorBuilder builder]
192
+ if (nil == acceptButton) {
193
+ return [[[FBErrorBuilder builder]
195
194
  withDescriptionFormat:@"Failed to find accept button for alert: %@", self.alertElement]
196
- buildError:error]
197
- : [acceptButton fb_tapWithError:error];
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
- return nil == dismissButton
234
- ? [[[FBErrorBuilder builder]
234
+ if (nil == dismissButton) {
235
+ return [[[FBErrorBuilder builder]
235
236
  withDescriptionFormat:@"Failed to find dismiss button for alert: %@", self.alertElement]
236
- buildError:error]
237
- : [dismissButton fb_tapWithError:error];
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
- return [requestedButton fb_tapWithError:error];
257
+ [requestedButton tap];
258
+ return YES;
255
259
  }
256
260
 
257
261
  - (XCUIElement *)alertElement
@@ -24,7 +24,8 @@
24
24
  commandStatus = [FBCommandStatus noSuchDriverErrorWithMessage:exception.reason
25
25
  traceback:traceback];
26
26
  } else if ([exception.name isEqualToString:FBInvalidArgumentException]
27
- || [exception.name isEqualToString:FBElementAttributeUnknownException]) {
27
+ || [exception.name isEqualToString:FBElementAttributeUnknownException]
28
+ || [exception.name isEqualToString:FBApplicationMissingException]) {
28
29
  commandStatus = [FBCommandStatus invalidArgumentErrorWithMessage:exception.reason
29
30
  traceback:traceback];
30
31
  } else if ([exception.name isEqualToString:FBApplicationCrashedException]
@@ -49,4 +49,7 @@ extern NSString *const FBClassChainQueryParseException;
49
49
  /*! Exception used to notify about application crash */
50
50
  extern NSString *const FBApplicationCrashedException;
51
51
 
52
+ /*! Exception used to notify about the application is not installed */
53
+ extern NSString *const FBApplicationMissingException;
54
+
52
55
  NS_ASSUME_NONNULL_END
@@ -20,3 +20,4 @@ NSString *const FBInvalidXPathException = @"FBInvalidXPathException";
20
20
  NSString *const FBXPathQueryEvaluationException = @"FBXPathQueryEvaluationException";
21
21
  NSString *const FBClassChainQueryParseException = @"FBClassChainQueryParseException";
22
22
  NSString *const FBApplicationCrashedException = @"FBApplicationCrashedException";
23
+ NSString *const FBApplicationMissingException = @"FBApplicationMissingException";
@@ -13,6 +13,7 @@
13
13
 
14
14
  #import "FBConfiguration.h"
15
15
  #import "FBErrorBuilder.h"
16
+ #import "FBExceptions.h"
16
17
  #import "FBLogger.h"
17
18
  #import "FBRunLoopSpinner.h"
18
19
  #import "XCTestDriver.h"
@@ -20,23 +21,61 @@
20
21
  #import "XCUIApplication.h"
21
22
  #import "XCUIDevice.h"
22
23
 
23
- @implementation FBXCTestDaemonsProxy
24
+ #define LAUNCH_APP_TIMEOUT_SEC 300
25
+
26
+ static void (*originalLaunchAppMethod)(id, SEL, NSString*, NSString*, NSArray*, NSDictionary*, void (^)(_Bool, NSError *));
24
27
 
25
- static Class FBXCTRunnerDaemonSessionClass = nil;
26
- static dispatch_once_t onceTestRunnerDaemonClass;
28
+ static void swizzledLaunchApp(id self, SEL _cmd, NSString *path, NSString *bundleID,
29
+ NSArray *arguments, NSDictionary *environment,
30
+ void (^reply)(_Bool, NSError *))
31
+ {
32
+ __block BOOL isSuccessful;
33
+ __block NSError *error;
34
+ dispatch_semaphore_t sem = dispatch_semaphore_create(0);
35
+ originalLaunchAppMethod(self, _cmd, path, bundleID, arguments, environment, ^(BOOL passed, NSError *innerError) {
36
+ isSuccessful = passed;
37
+ error = innerError;
38
+ dispatch_semaphore_signal(sem);
39
+ });
40
+ int64_t timeoutNs = (int64_t)(LAUNCH_APP_TIMEOUT_SEC * NSEC_PER_SEC);
41
+ if (0 != dispatch_semaphore_wait(sem, dispatch_time(DISPATCH_TIME_NOW, timeoutNs))) {
42
+ NSString *message = [NSString stringWithFormat:@"The application '%@' cannot be launched within %d seconds timeout",
43
+ bundleID ?: path, LAUNCH_APP_TIMEOUT_SEC];
44
+ @throw [NSException exceptionWithName:FBTimeoutException reason:message userInfo:nil];
45
+ }
46
+ if (!isSuccessful || nil != error) {
47
+ [FBLogger logFmt:@"%@", error.description];
48
+ NSString *message = error.description ?: [NSString stringWithFormat:@"The application '%@' is not installed on the device under test",
49
+ bundleID ?: path];
50
+ @throw [NSException exceptionWithName:FBApplicationMissingException reason:message userInfo:nil];
51
+ }
52
+ reply(isSuccessful, error);
53
+ }
54
+
55
+ @implementation FBXCTestDaemonsProxy
27
56
 
28
57
  #pragma clang diagnostic push
29
58
  #pragma clang diagnostic ignored "-Wobjc-load-method"
30
59
 
31
60
  + (void)load
32
61
  {
33
- dispatch_once(&onceTestRunnerDaemonClass, ^{
34
- FBXCTRunnerDaemonSessionClass = objc_lookUpClass("XCTRunnerDaemonSession");
35
- });
62
+ [self.class swizzleLaunchApp];
36
63
  }
37
64
 
38
65
  #pragma clang diagnostic pop
39
66
 
67
+ + (void)swizzleLaunchApp {
68
+ Method original = class_getInstanceMethod([XCTRunnerDaemonSession class],
69
+ @selector(launchApplicationWithPath:bundleID:arguments:environment:completion:));
70
+ if (original == nil) {
71
+ [FBLogger log:@"Could not find method -[XCTRunnerDaemonSession launchApplicationWithPath:]"];
72
+ return;
73
+ }
74
+ // Workaround for https://github.com/appium/WebDriverAgent/issues/702
75
+ originalLaunchAppMethod = (void(*)(id, SEL, NSString*, NSString*, NSArray*, NSDictionary*, void (^)(_Bool, NSError *))) method_getImplementation(original);
76
+ method_setImplementation(original, (IMP)swizzledLaunchApp);
77
+ }
78
+
40
79
  + (id<XCTestManager_ManagerInterface>)testRunnerProxy
41
80
  {
42
81
  static id<XCTestManager_ManagerInterface> proxy = nil;
@@ -56,7 +95,7 @@ static dispatch_once_t onceTestRunnerDaemonClass;
56
95
 
57
96
  + (id<XCTestManager_ManagerInterface>)retrieveTestRunnerProxy
58
97
  {
59
- return ((XCTRunnerDaemonSession *)[FBXCTRunnerDaemonSessionClass sharedSession]).daemonProxy;
98
+ return ((XCTRunnerDaemonSession *)[XCTRunnerDaemonSession sharedSession]).daemonProxy;
60
99
  }
61
100
 
62
101
  + (BOOL)synthesizeEventWithRecord:(XCSynthesizedEventRecord *)record error:(NSError *__autoreleasing*)error
@@ -70,24 +109,20 @@ static dispatch_once_t onceTestRunnerDaemonClass;
70
109
  didSucceed = (invokeError == nil);
71
110
  completion();
72
111
  };
73
-
74
- if (nil == FBXCTRunnerDaemonSessionClass) {
75
- [[self testRunnerProxy] _XCT_synthesizeEvent:record completion:errorHandler];
76
- } else {
77
- XCEventGeneratorHandler handlerBlock = ^(XCSynthesizedEventRecord *innerRecord, NSError *invokeError) {
78
- errorHandler(invokeError);
79
- };
80
- [[XCUIDevice.sharedDevice eventSynthesizer] synthesizeEvent:record completion:(id)^(BOOL result, NSError *invokeError) {
81
- handlerBlock(record, invokeError);
82
- }];
83
- }
112
+
113
+ XCEventGeneratorHandler handlerBlock = ^(XCSynthesizedEventRecord *innerRecord, NSError *invokeError) {
114
+ errorHandler(invokeError);
115
+ };
116
+ [[XCUIDevice.sharedDevice eventSynthesizer] synthesizeEvent:record completion:(id)^(BOOL result, NSError *invokeError) {
117
+ handlerBlock(record, invokeError);
118
+ }];
84
119
  }];
85
120
  return didSucceed;
86
121
  }
87
122
 
88
123
  + (BOOL)openURL:(NSURL *)url usingApplication:(NSString *)bundleId error:(NSError *__autoreleasing*)error
89
124
  {
90
- XCTRunnerDaemonSession *session = [FBXCTRunnerDaemonSessionClass sharedSession];
125
+ XCTRunnerDaemonSession *session = [XCTRunnerDaemonSession sharedSession];
91
126
  if (![session respondsToSelector:@selector(openURL:usingApplication:completion:)]) {
92
127
  if (error) {
93
128
  [[[FBErrorBuilder builder]
@@ -112,7 +147,7 @@ static dispatch_once_t onceTestRunnerDaemonClass;
112
147
 
113
148
  + (BOOL)openDefaultApplicationForURL:(NSURL *)url error:(NSError *__autoreleasing*)error
114
149
  {
115
- XCTRunnerDaemonSession *session = [FBXCTRunnerDaemonSessionClass sharedSession];
150
+ XCTRunnerDaemonSession *session = [XCTRunnerDaemonSession sharedSession];
116
151
  if (![session respondsToSelector:@selector(openDefaultApplicationForURL:completion:)]) {
117
152
  if (error) {
118
153
  [[[FBErrorBuilder builder]
@@ -138,7 +173,7 @@ static dispatch_once_t onceTestRunnerDaemonClass;
138
173
  #if !TARGET_OS_TV
139
174
  + (BOOL)setSimulatedLocation:(CLLocation *)location error:(NSError *__autoreleasing*)error
140
175
  {
141
- XCTRunnerDaemonSession *session = [FBXCTRunnerDaemonSessionClass sharedSession];
176
+ XCTRunnerDaemonSession *session = [XCTRunnerDaemonSession sharedSession];
142
177
  if (![session respondsToSelector:@selector(setSimulatedLocation:completion:)]) {
143
178
  if (error) {
144
179
  [[[FBErrorBuilder builder]
@@ -171,7 +206,7 @@ static dispatch_once_t onceTestRunnerDaemonClass;
171
206
 
172
207
  + (nullable CLLocation *)getSimulatedLocation:(NSError *__autoreleasing*)error;
173
208
  {
174
- XCTRunnerDaemonSession *session = [FBXCTRunnerDaemonSessionClass sharedSession];
209
+ XCTRunnerDaemonSession *session = [XCTRunnerDaemonSession sharedSession];
175
210
  if (![session respondsToSelector:@selector(getSimulatedLocationWithReply:)]) {
176
211
  if (error) {
177
212
  [[[FBErrorBuilder builder]
@@ -206,7 +241,7 @@ static dispatch_once_t onceTestRunnerDaemonClass;
206
241
 
207
242
  + (BOOL)clearSimulatedLocation:(NSError *__autoreleasing*)error
208
243
  {
209
- XCTRunnerDaemonSession *session = [FBXCTRunnerDaemonSessionClass sharedSession];
244
+ XCTRunnerDaemonSession *session = [XCTRunnerDaemonSession sharedSession];
210
245
  if (![session respondsToSelector:@selector(clearSimulatedLocationWithReply:)]) {
211
246
  if (error) {
212
247
  [[[FBErrorBuilder builder]
@@ -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] fb_tapWithError:nil];
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] fb_tapWithError:nil];
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] fb_tapWithError:nil];
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] fb_tapWithError:nil];
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
- XCTAssertTrue([element fb_tapWithError:nil]);
163
+ [element tap];
164
164
  XCTAssertEqualObjects(element.wdValue, @"0");
165
165
  XCTAssertFalse(element.wdSelected);
166
166
  }
@@ -11,6 +11,7 @@
11
11
 
12
12
  #import "FBIntegrationTestCase.h"
13
13
  #import "FBApplication.h"
14
+ #import "FBExceptions.h"
14
15
  #import "FBMacros.h"
15
16
  #import "FBSession.h"
16
17
  #import "FBXCodeCompatibility.h"
@@ -107,4 +108,26 @@ static NSString *const SETTINGS_BUNDLE_ID = @"com.apple.Preferences";
107
108
  XCTAssertEqualObjects(SETTINGS_BUNDLE_ID, FBApplication.fb_activeApplication.bundleID);
108
109
  }
109
110
 
111
+ - (void)testAppWithInvalidBundleIDCannotBeStarted
112
+ {
113
+ FBApplication *testedApp = [[FBApplication alloc] initWithBundleIdentifier:@"yolo"];
114
+ @try {
115
+ [testedApp launch];
116
+ XCTFail(@"An exception is expected to be thrown");
117
+ } @catch (NSException *exception) {
118
+ XCTAssertEqualObjects(FBApplicationMissingException, exception.name);
119
+ }
120
+ }
121
+
122
+ - (void)testAppWithInvalidBundleIDCannotBeActivated
123
+ {
124
+ FBApplication *testedApp = [[FBApplication alloc] initWithBundleIdentifier:@"yolo"];
125
+ @try {
126
+ [testedApp activate];
127
+ XCTFail(@"An exception is expected to be thrown");
128
+ } @catch (NSException *exception) {
129
+ XCTAssertEqualObjects(FBApplicationMissingException, exception.name);
130
+ }
131
+ }
132
+
110
133
  @end
@@ -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
- NSError *error;
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
- // Visibility detection for upside-down orientation is broken
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 fb_tapCoordinate:CGPointMake(dstButton.frame.size.width / 2, dstButton.frame.size.height / 2) error:&error];
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
- // Visibility detection for upside-down orientation is broken
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",
3
+ "version": "5.1.5",
4
4
  "description": "Package bundling WebDriverAgent",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {
@@ -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