appium-mac2-driver 1.18.1 → 1.19.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 CHANGED
@@ -1,3 +1,17 @@
1
+ ## [1.19.0](https://github.com/appium/appium-mac2-driver/compare/v1.18.2...v1.19.0) (2024-08-01)
2
+
3
+
4
+ ### Features
5
+
6
+ * Add open-wda script ([#312](https://github.com/appium/appium-mac2-driver/issues/312)) ([f5cfa81](https://github.com/appium/appium-mac2-driver/commit/f5cfa8104b11d569a19122482543e90dfa2e4735))
7
+
8
+ ## [1.18.2](https://github.com/appium/appium-mac2-driver/compare/v1.18.1...v1.18.2) (2024-07-21)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * do nothing for an empty array in w3c actions ([#308](https://github.com/appium/appium-mac2-driver/issues/308)) ([a1aa636](https://github.com/appium/appium-mac2-driver/commit/a1aa636d8856c97b8edb1c091b3919a45a6d6716))
14
+
1
15
  ## [1.18.1](https://github.com/appium/appium-mac2-driver/compare/v1.18.0...v1.18.1) (2024-07-20)
2
16
 
3
17
 
package/README.md CHANGED
@@ -730,6 +730,15 @@ boundElementsByIndex | boolean | Whether to use elements binding by index (`true
730
730
  useDefaultUiInterruptionsHandling | boolean | Whether to use the default XCTest UI interruptions handling (`true`, the default setting) or to disable it for the [Application Under Test](#application-under-test-concept) (`false`). It makes sense to disable the default handler if it is necessary to validate the interrupting element's presence in your test or do some other actions on it rather than just closing the view implicitly. Check [this WWDC presentation](https://developer.apple.com/videos/play/wwdc2020/10220/) from Apple to get more details on the UI interruptions handling.
731
731
 
732
732
 
733
+ ## Scripts
734
+
735
+ The Mac2 driver supports the following scripts:
736
+
737
+ ### open-wda
738
+
739
+ Run `appium driver run mac2 open-wda` to open the bundled WebDriverAgentMac source in Xcode and to print the path to the main .xcodeproj file into the Terminal.
740
+
741
+
733
742
  ## Examples
734
743
 
735
744
  ```python
@@ -370,4 +370,25 @@
370
370
  XCTAssertEqualObjects(edit.value, @"NBA");
371
371
  }
372
372
 
373
+ - (void)testKeysWithEmptyActions
374
+ {
375
+ [self switchToEditsTab];
376
+ XCUIElement *edit = self.testedApplication.textFields.firstMatch;
377
+ [edit click];
378
+
379
+ NSArray<NSDictionary<NSString *, id> *> *gesture =
380
+ @[@{
381
+ @"type": @"key",
382
+ @"id": @"keyboard",
383
+ @"actions": @[],
384
+ },
385
+ ];
386
+ NSError *error;
387
+ XCTAssertTrue([self.testedApplication fb_performW3CActions:gesture
388
+ elementCache:nil
389
+ error:&error]);
390
+ XCTAssertNil(error);
391
+ XCTAssertEqualObjects(edit.value, @"");
392
+ }
393
+
373
394
  @end
@@ -260,7 +260,7 @@ static NSString *const FB_KEY_ACTIONS = @"actions";
260
260
  }
261
261
  return nil;
262
262
  }
263
-
263
+
264
264
  XCUIElement *element = isOriginAnElement ? (XCUIElement *)origin : nil;
265
265
  NSNumber *x = [self.actionItem objectForKey:FB_ACTION_ITEM_KEY_X];
266
266
  NSNumber *y = [self.actionItem objectForKey:FB_ACTION_ITEM_KEY_Y];
@@ -272,7 +272,7 @@ static NSString *const FB_KEY_ACTIONS = @"actions";
272
272
  }
273
273
  return nil;
274
274
  }
275
-
275
+
276
276
  if (nil != element) {
277
277
  if (nil == x && nil == y) {
278
278
  return [self hitpointWithElement:element
@@ -283,13 +283,13 @@ static NSString *const FB_KEY_ACTIONS = @"actions";
283
283
  positionOffset:[NSValue am_valueWithCGPoint:CGPointMake(x.floatValue, y.floatValue)]
284
284
  error:error];
285
285
  }
286
-
286
+
287
287
  if ([origin isKindOfClass:NSString.class] && [origin isEqualToString:FB_ORIGIN_TYPE_VIEWPORT]) {
288
288
  return [self hitpointWithElement:nil
289
289
  positionOffset:[NSValue am_valueWithCGPoint:CGPointMake(x.floatValue, y.floatValue)]
290
290
  error:error];
291
291
  }
292
-
292
+
293
293
  // origin == FB_ORIGIN_TYPE_POINTER
294
294
  if (nil == self.previousItem) {
295
295
  NSString *errorDescription = [NSString stringWithFormat:@"There is no previous item for '%@' action item, however %@ is set to '%@'", self.actionItem, FB_ACTION_ITEM_KEY_ORIGIN, FB_ORIGIN_TYPE_POINTER];
@@ -734,7 +734,7 @@ static NSString *const FB_KEY_ACTIONS = @"actions";
734
734
  shouldCancelNextItem = YES;
735
735
  continue;
736
736
  }
737
-
737
+
738
738
  if (nil == self.elementCache) {
739
739
  [result addObject:actionItem];
740
740
  continue;
@@ -874,7 +874,7 @@ static NSString *const FB_KEY_ACTIONS = @"actions";
874
874
 
875
875
  NSArray<NSDictionary<NSString *, id> *> *actionItems = [actionDescription objectForKey:FB_KEY_ACTIONS];
876
876
  if (nil == actionItems || 0 == actionItems.count) {
877
- NSString *description = [NSString stringWithFormat:@"It is mandatory to have at least one gesture item defined for each action. Action with id '%@' contains none", actionId];
877
+ NSString *description = [NSString stringWithFormat:@"It is mandatory to have at least one gesture item defined for each action. Action with id '%@' contains none", actionId];
878
878
  if (error) {
879
879
  *error = [[FBErrorBuilder.builder withDescription:description] build];
880
880
  }
@@ -959,6 +959,19 @@ static NSString *const FB_KEY_ACTIONS = @"actions";
959
959
  }
960
960
  return nil;
961
961
  }
962
+ NSArray<NSDictionary<NSString *, id> *> *actionItems = [action objectForKey:FB_KEY_ACTIONS];
963
+ if (nil == actionItems) {
964
+ NSString *description = [NSString stringWithFormat:@"It is mandatory to have at least one item defined for each action. Action with id '%@' contains none", actionId];
965
+ if (error) {
966
+ *error = [[FBErrorBuilder.builder withDescription:description] build];
967
+ }
968
+ return nil;
969
+ }
970
+ if (0 == actionItems.count) {
971
+ [FBLogger logFmt:@"Action items in the action id '%@' had an empty array. Skipping the action.", actionId];
972
+ continue;
973
+ }
974
+
962
975
  [actionIds addObject:actionId];
963
976
  [actionsMapping setObject:action forKey:actionId];
964
977
  }