appium-webdriveragent 4.8.6 → 4.9.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.
@@ -34,5 +34,11 @@
34
34
  - (void)pressWithPressure:(double)arg1 duration:(double)arg2;
35
35
  - (void)forcePress;
36
36
 
37
+ // Since Xcode 12
38
+ - (void)pressForDuration:(double)duration
39
+ thenDragToCoordinate:(XCUICoordinate *)otherCoordinate
40
+ withVelocity:(CGFloat)velocity
41
+ thenHoldForDuration:(double)holdDuration;
42
+
37
43
  @end
38
44
  #endif
@@ -65,4 +65,10 @@
65
65
  - (void)swipeDownWithVelocity:(double)arg1;
66
66
  - (void)swipeUpWithVelocity:(double)arg1;
67
67
 
68
+ // Since Xcode 12
69
+ - (void)pressForDuration:(double)duration
70
+ thenDragToElement:(XCUIElement *)otherElement
71
+ withVelocity:(CGFloat)velocity
72
+ thenHoldForDuration:(double)holdDuration;
73
+
68
74
  @end
@@ -85,8 +85,10 @@
85
85
  [[FBRoute POST:@"/wda/element/:uuid/scroll"] respondWithTarget:self action:@selector(handleScroll:)],
86
86
  [[FBRoute POST:@"/wda/element/:uuid/scrollTo"] respondWithTarget:self action:@selector(handleScrollTo:)],
87
87
  [[FBRoute POST:@"/wda/element/:uuid/dragfromtoforduration"] respondWithTarget:self action:@selector(handleDrag:)],
88
+ [[FBRoute POST:@"/wda/element/:uuid/pressAndDragWithVelocity"] respondWithTarget:self action:@selector(handlePressAndDragWithVelocity:)],
88
89
  [[FBRoute POST:@"/wda/element/:uuid/forceTouch"] respondWithTarget:self action:@selector(handleForceTouch:)],
89
90
  [[FBRoute POST:@"/wda/dragfromtoforduration"] respondWithTarget:self action:@selector(handleDragCoordinate:)],
91
+ [[FBRoute POST:@"/wda/pressAndDragWithVelocity"] respondWithTarget:self action:@selector(handlePressAndDragCoordinateWithVelocity:)],
90
92
  [[FBRoute POST:@"/wda/tap/:uuid"] respondWithTarget:self action:@selector(handleTap:)],
91
93
  [[FBRoute POST:@"/wda/touchAndHold"] respondWithTarget:self action:@selector(handleTouchAndHoldCoordinate:)],
92
94
  [[FBRoute POST:@"/wda/doubleTap"] respondWithTarget:self action:@selector(handleDoubleTapCoordinate:)],
@@ -338,6 +340,43 @@
338
340
  return FBResponseWithOK();
339
341
  }
340
342
 
343
+ + (id<FBResponsePayload>)handlePressAndDragWithVelocity:(FBRouteRequest *)request
344
+ {
345
+ FBElementCache *elementCache = request.session.elementCache;
346
+ XCUIElement *element = [elementCache elementForUUID:(NSString *)request.parameters[@"uuid"]];
347
+ if (![element respondsToSelector:@selector(pressForDuration:thenDragToElement:withVelocity:thenHoldForDuration:)]) {
348
+ return FBResponseWithStatus([FBCommandStatus unsupportedOperationErrorWithMessage:@"This method is only supported in Xcode 12 and above"
349
+ traceback:nil]);
350
+ }
351
+ [element pressForDuration:[request.arguments[@"pressDuration"] doubleValue]
352
+ thenDragToElement:[elementCache elementForUUID:(NSString *)request.arguments[@"toElement"]]
353
+ withVelocity:[request.arguments[@"velocity"] doubleValue]
354
+ thenHoldForDuration:[request.arguments[@"holdDuration"] doubleValue]];
355
+ return FBResponseWithOK();
356
+ }
357
+
358
+ + (id<FBResponsePayload>)handlePressAndDragCoordinateWithVelocity:(FBRouteRequest *)request
359
+ {
360
+ FBSession *session = request.session;
361
+ CGPoint startPoint = CGPointMake((CGFloat)[request.arguments[@"fromX"] doubleValue],
362
+ (CGFloat)[request.arguments[@"fromY"] doubleValue]);
363
+ CGPoint endPoint = CGPointMake((CGFloat)[request.arguments[@"toX"] doubleValue],
364
+ (CGFloat)[request.arguments[@"toY"] doubleValue]);
365
+ XCUICoordinate *endCoordinate = [self.class gestureCoordinateWithCoordinate:endPoint
366
+ application:session.activeApplication];
367
+ XCUICoordinate *startCoordinate = [self.class gestureCoordinateWithCoordinate:startPoint
368
+ application:session.activeApplication];
369
+ if (![startCoordinate respondsToSelector:@selector(pressForDuration:thenDragToCoordinate:withVelocity:thenHoldForDuration:)]) {
370
+ return FBResponseWithStatus([FBCommandStatus unsupportedOperationErrorWithMessage:@"This method is only supported in Xcode 12 and above"
371
+ traceback:nil]);
372
+ }
373
+ [startCoordinate pressForDuration:[request.arguments[@"pressDuration"] doubleValue]
374
+ thenDragToCoordinate:endCoordinate
375
+ withVelocity:[request.arguments[@"velocity"] doubleValue]
376
+ thenHoldForDuration:[request.arguments[@"holdDuration"] doubleValue]];
377
+ return FBResponseWithOK();
378
+ }
379
+
341
380
  + (id<FBResponsePayload>)handleScroll:(FBRouteRequest *)request
342
381
  {
343
382
  FBElementCache *elementCache = request.session.elementCache;
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appium-webdriveragent",
3
- "version": "4.8.6",
3
+ "version": "4.9.0",
4
4
  "description": "Package bundling WebDriverAgent",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {