appium-webdriveragent 4.5.0 → 4.5.1

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/README.md CHANGED
@@ -51,3 +51,4 @@ projects has been integrated directly in the WebDriverAgent source tree.
51
51
  You can find the source files and their licenses in the `WebDriverAgentLib/Vendor` directory.
52
52
 
53
53
  Have fun!
54
+
@@ -21,6 +21,7 @@
21
21
  #import "FBXCTestDaemonsProxy.h"
22
22
  #import "XCElementSnapshot+FBHelpers.h"
23
23
  #import "XCUIApplication+FBHelpers.h"
24
+ #import "XCUIDevice.h"
24
25
  #import "XCUIElement+FBCaching.h"
25
26
  #import "XCUIElement+FBIsVisible.h"
26
27
  #import "XCUIElement+FBUtilities.h"
@@ -218,12 +219,28 @@ static NSString *const FB_KEY_ACTIONS = @"actions";
218
219
  return @[];
219
220
  }
220
221
  }
221
- XCPointerEventPath *result = [[XCPointerEventPath alloc] initForTouchAtPoint:self.atPosition offset:FBMillisToSeconds(self.offset)];
222
- if (nil != self.pressure && nil != result.pointerEvents.lastObject) {
223
- XCPointerEvent *pointerEvent = (XCPointerEvent *)result.pointerEvents.lastObject;
224
- pointerEvent.pressure = self.pressure.doubleValue;
222
+ if (nil == self.pressure) {
223
+ XCPointerEventPath *result = [[XCPointerEventPath alloc] initForTouchAtPoint:self.atPosition
224
+ offset:FBMillisToSeconds(self.offset)];
225
+ return @[result];
225
226
  }
226
- return @[result];
227
+
228
+ if (nil == eventPath) {
229
+ NSString *description = [NSString stringWithFormat:@"'%@' action with pressure must be preceeded with at least one '%@' action without this option", self.class.actionName, self.class.actionName];
230
+ if (error) {
231
+ *error = [[FBErrorBuilder.builder withDescription:description] build];
232
+ }
233
+ return nil;
234
+ }
235
+ if (![XCUIDevice sharedDevice].supportsPressureInteraction) {
236
+ if (error) {
237
+ *error = [[FBErrorBuilder.builder withDescription:@"This device does not support force press interactions"] build];
238
+ }
239
+ return nil;
240
+ }
241
+ [eventPath pressDownWithPressure:self.pressure.doubleValue
242
+ atOffset:FBMillisToSeconds(self.offset)];
243
+ return @[];
227
244
  }
228
245
 
229
246
  @end
Binary file
@@ -12,6 +12,7 @@
12
12
  #import "FBIntegrationTestCase.h"
13
13
 
14
14
  #import "XCUIElement.h"
15
+ #import "XCUIDevice.h"
15
16
  #import "XCUIApplication+FBTouchAction.h"
16
17
  #import "FBTestMacros.h"
17
18
  #import "XCUIDevice+FBRotation.h"
@@ -309,13 +310,13 @@
309
310
  @"id": @"finger1",
310
311
  @"parameters": @{@"pointerType": @"touch"},
311
312
  @"actions": @[
312
- @{@"type": @"pointerMove", @"duration": @0, @"origin": self.testedApplication.buttons[FBShowAlertButtonName], @"x": @0, @"y": @0},
313
+ @{@"type": @"pointerMove", @"duration": @0, @"origin": self.testedApplication.buttons[FBShowAlertButtonName]},
313
314
  @{@"type": @"pointerDown"},
314
- @{@"type": @"pause", @"duration": @100},
315
+ @{@"type": @"pause", @"duration": @50},
315
316
  @{@"type": @"pointerUp"},
316
- @{@"type": @"pause", @"duration": @40},
317
+ @{@"type": @"pause", @"duration": @200},
317
318
  @{@"type": @"pointerDown"},
318
- @{@"type": @"pause", @"duration": @100},
319
+ @{@"type": @"pause", @"duration": @50},
319
320
  @{@"type": @"pointerUp"},
320
321
  ],
321
322
  },
@@ -371,6 +372,32 @@
371
372
  [self verifyGesture:gesture orientation:orientation];
372
373
  }
373
374
 
375
+ - (void)testForceTap
376
+ {
377
+ if (![XCUIDevice.sharedDevice supportsPressureInteraction]) {
378
+ return;
379
+ }
380
+
381
+ NSArray<NSDictionary<NSString *, id> *> *gesture =
382
+ @[@{
383
+ @"type": @"pointer",
384
+ @"id": @"finger1",
385
+ @"parameters": @{@"pointerType": @"touch"},
386
+ @"actions": @[
387
+ @{@"type": @"pointerMove", @"duration": @0, @"origin": self.testedApplication.buttons[FBShowAlertButtonName]},
388
+ @{@"type": @"pointerDown"},
389
+ @{@"type": @"pause", @"duration": @500},
390
+ @{@"type": @"pointerDown", @"pressure": @1.0},
391
+ @{@"type": @"pause", @"duration": @50},
392
+ @{@"type": @"pointerDown", @"pressure": @1.0},
393
+ @{@"type": @"pause", @"duration": @50},
394
+ @{@"type": @"pointerUp"},
395
+ ],
396
+ },
397
+ ];
398
+ [self verifyGesture:gesture orientation:UIDeviceOrientationLandscapeLeft];
399
+ }
400
+
374
401
  @end
375
402
 
376
403
 
@@ -23,18 +23,28 @@
23
23
 
24
24
  @implementation XCUIDeviceHelperTests
25
25
 
26
+ - (void)restorePortraitOrientation
27
+ {
28
+ if ([XCUIDevice sharedDevice].orientation != UIDeviceOrientationPortrait) {
29
+ [[XCUIDevice sharedDevice] fb_setDeviceInterfaceOrientation:UIDeviceOrientationPortrait];
30
+ }
31
+ }
32
+
26
33
  - (void)setUp
27
34
  {
28
35
  [super setUp];
29
- static dispatch_once_t onceToken;
30
- dispatch_once(&onceToken, ^{
31
- [self launchApplication];
32
- });
36
+ [self launchApplication];
37
+ [self restorePortraitOrientation];
38
+ }
39
+
40
+ - (void)tearDown
41
+ {
42
+ [self restorePortraitOrientation];
43
+ [super tearDown];
33
44
  }
34
45
 
35
46
  - (void)testScreenshot
36
47
  {
37
- [[XCUIDevice sharedDevice] fb_setDeviceInterfaceOrientation:UIDeviceOrientationPortrait];
38
48
  NSError *error = nil;
39
49
  NSData *screenshotData = [[XCUIDevice sharedDevice] fb_screenshotWithError:&error];
40
50
  XCTAssertNotNil(screenshotData);
@@ -56,7 +66,7 @@
56
66
 
57
67
  - (void)testLandscapeScreenshot
58
68
  {
59
- [[XCUIDevice sharedDevice] fb_setDeviceInterfaceOrientation:UIDeviceOrientationLandscapeLeft];
69
+ XCTAssertTrue([[XCUIDevice sharedDevice] fb_setDeviceInterfaceOrientation:UIDeviceOrientationLandscapeLeft]);
60
70
  NSError *error = nil;
61
71
  NSData *screenshotData = [[XCUIDevice sharedDevice] fb_screenshotWithError:&error];
62
72
  XCTAssertNotNil(screenshotData);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appium-webdriveragent",
3
- "version": "4.5.0",
3
+ "version": "4.5.1",
4
4
  "description": "Package bundling WebDriverAgent",
5
5
  "main": "build/index.js",
6
6
  "scripts": {