appium-webdriveragent 11.2.0 → 11.3.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,9 @@
1
+ ## [11.3.0](https://github.com/appium/WebDriverAgent/compare/v11.2.0...v11.3.0) (2026-03-05)
2
+
3
+ ### Features
4
+
5
+ * add 6 tvOS button values for `mobile: pressButton` ([#1116](https://github.com/appium/WebDriverAgent/issues/1116)) ([efd64ed](https://github.com/appium/WebDriverAgent/commit/efd64ede7212b322f412cd6b25eab9c8097c286d))
6
+
1
7
  ## [11.2.0](https://github.com/appium/WebDriverAgent/compare/v11.1.7...v11.2.0) (2026-03-04)
2
8
 
3
9
  ### Features
@@ -26,40 +26,65 @@
26
26
  static const NSTimeInterval FBHomeButtonCoolOffTime = 1.;
27
27
  static const NSTimeInterval FBScreenLockTimeout = 5.;
28
28
 
29
- NSDictionary<NSString *, NSNumber *> *availableButtonNames(void) {
29
+ #if TARGET_OS_TV
30
+ NSDictionary<NSString *, NSNumber *> *fb_availableButtonNames(void) {
30
31
  static dispatch_once_t onceToken;
31
32
  static NSDictionary *result;
32
33
  dispatch_once(&onceToken, ^{
33
34
  NSMutableDictionary *buttons = [NSMutableDictionary dictionary];
34
-
35
- // Home button is always available
36
- buttons[@"home"] = @(XCUIDeviceButtonHome);
37
-
38
- #if !TARGET_OS_TV
35
+ // https://developer.apple.com/design/human-interface-guidelines/remotes
36
+ buttons[@"up"] = @(XCUIRemoteButtonUp); // 0
37
+ buttons[@"down"] = @(XCUIRemoteButtonDown); // 1
38
+ buttons[@"left"] = @(XCUIRemoteButtonLeft); // 2
39
+ buttons[@"right"] = @(XCUIRemoteButtonRight); // 3
40
+ buttons[@"select"] = @(XCUIRemoteButtonSelect); // 4
41
+ buttons[@"menu"] = @(XCUIRemoteButtonMenu); // 5
42
+ buttons[@"playpause"] = @(XCUIRemoteButtonPlayPause); // 6
43
+ buttons[@"home"] = @(XCUIRemoteButtonHome); // 7
44
+ #if __clang_major__ >= 15 // Xcode 15+
45
+ buttons[@"pageup"] = @(XCUIRemoteButtonPageUp); // 9
46
+ buttons[@"pagedown"] = @(XCUIRemoteButtonPageDown); // 10
47
+ buttons[@"guide"] = @(XCUIRemoteButtonGuide); // 11
48
+ #endif
49
+ #if __clang_major__ >= 17 // likely Xcode 16.3+
50
+ if (@available(tvOS 18.1, *)) {
51
+ buttons[@"fourcolors"] = @(XCUIRemoteButtonFourColors); // 12
52
+ buttons[@"onetwothree"] = @(XCUIRemoteButtonOneTwoThree); // 13
53
+ buttons[@"tvprovider"] = @(XCUIRemoteButtonTVProvider); // 14
54
+ }
55
+ #endif
56
+ result = [buttons copy];
57
+ });
58
+ return result;
59
+ }
60
+ #else
61
+ NSDictionary<NSString *, NSNumber *> *fb_availableButtonNames(void) {
62
+ static dispatch_once_t onceToken;
63
+ static NSDictionary *result;
64
+ dispatch_once(&onceToken, ^{
65
+ NSMutableDictionary *buttons = [NSMutableDictionary dictionary];
66
+ buttons[@"home"] = @(XCUIDeviceButtonHome); // 1
39
67
  #if !TARGET_OS_SIMULATOR
40
- buttons[@"volumeup"] = @(XCUIDeviceButtonVolumeUp);
41
- buttons[@"volumedown"] = @(XCUIDeviceButtonVolumeDown);
68
+ buttons[@"volumeup"] = @(XCUIDeviceButtonVolumeUp); // 2
69
+ buttons[@"volumedown"] = @(XCUIDeviceButtonVolumeDown); // 3
42
70
  #endif
43
-
44
71
  if (@available(iOS 16.0, *)) {
45
- #if defined(XCUIDeviceButtonAction)
72
+ #if __clang_major__ >= 15 // likely Xcode 15+
46
73
  if ([XCUIDevice.sharedDevice hasHardwareButton:XCUIDeviceButtonAction]) {
47
- buttons[@"action"] = @(XCUIDeviceButtonAction);
74
+ buttons[@"action"] = @(XCUIDeviceButtonAction); // 4
48
75
  }
49
76
  #endif
50
- #if defined(XCUIDeviceButtonCamera)
51
- #if !TARGET_OS_SIMULATOR
77
+ #if (!TARGET_OS_SIMULATOR && __clang_major__ >= 16) // likely Xcode 16+
52
78
  if ([XCUIDevice.sharedDevice hasHardwareButton:XCUIDeviceButtonCamera]) {
53
79
  buttons[@"camera"] = @(XCUIDeviceButtonCamera);
54
80
  }
55
- #endif
56
81
  #endif
57
82
  }
58
- #endif
59
83
  result = [buttons copy];
60
84
  });
61
85
  return result;
62
86
  }
87
+ #endif
63
88
 
64
89
  @implementation XCUIDevice (FBHelpers)
65
90
 
@@ -247,7 +272,7 @@ static bool fb_isLocked;
247
272
 
248
273
  - (BOOL)fb_hasButton:(NSString *)buttonName
249
274
  {
250
- return availableButtonNames()[buttonName.lowercaseString] != nil;
275
+ return fb_availableButtonNames()[buttonName.lowercaseString] != nil;
251
276
  }
252
277
 
253
278
  - (BOOL)fb_pressButton:(NSString *)buttonName
@@ -257,71 +282,23 @@ static bool fb_isLocked;
257
282
  #if !TARGET_OS_TV
258
283
  return [self fb_pressButton:buttonName error:error];
259
284
  #else
260
- NSMutableArray<NSString *> *supportedButtonNames = [NSMutableArray array];
261
- NSInteger remoteButton = -1; // no remote button
262
- if ([buttonName.lowercaseString isEqualToString:@"home"]) {
263
- // XCUIRemoteButtonHome = 7
264
- remoteButton = XCUIRemoteButtonHome;
265
- }
266
- [supportedButtonNames addObject:@"home"];
267
285
 
268
- // https://developer.apple.com/design/human-interface-guidelines/tvos/remote-and-controllers/remote/
269
- if ([buttonName.lowercaseString isEqualToString:@"up"]) {
270
- // XCUIRemoteButtonUp = 0,
271
- remoteButton = XCUIRemoteButtonUp;
272
- }
273
- [supportedButtonNames addObject:@"up"];
274
-
275
- if ([buttonName.lowercaseString isEqualToString:@"down"]) {
276
- // XCUIRemoteButtonDown = 1,
277
- remoteButton = XCUIRemoteButtonDown;
278
- }
279
- [supportedButtonNames addObject:@"down"];
280
-
281
- if ([buttonName.lowercaseString isEqualToString:@"left"]) {
282
- // XCUIRemoteButtonLeft = 2,
283
- remoteButton = XCUIRemoteButtonLeft;
284
- }
285
- [supportedButtonNames addObject:@"left"];
286
-
287
- if ([buttonName.lowercaseString isEqualToString:@"right"]) {
288
- // XCUIRemoteButtonRight = 3,
289
- remoteButton = XCUIRemoteButtonRight;
290
- }
291
- [supportedButtonNames addObject:@"right"];
292
-
293
- if ([buttonName.lowercaseString isEqualToString:@"menu"]) {
294
- // XCUIRemoteButtonMenu = 5,
295
- remoteButton = XCUIRemoteButtonMenu;
296
- }
297
- [supportedButtonNames addObject:@"menu"];
298
-
299
- if ([buttonName.lowercaseString isEqualToString:@"playpause"]) {
300
- // XCUIRemoteButtonPlayPause = 6,
301
- remoteButton = XCUIRemoteButtonPlayPause;
302
- }
303
- [supportedButtonNames addObject:@"playpause"];
304
-
305
- if ([buttonName.lowercaseString isEqualToString:@"select"]) {
306
- // XCUIRemoteButtonSelect = 4,
307
- remoteButton = XCUIRemoteButtonSelect;
308
- }
309
- [supportedButtonNames addObject:@"select"];
310
-
311
- if (remoteButton == -1) {
286
+ NSDictionary<NSString *, NSNumber *> *availableButtons = fb_availableButtonNames();
287
+ NSNumber *buttonValue = availableButtons[buttonName.lowercaseString];
288
+
289
+ if (!buttonValue) {
290
+ NSArray *sortedKeys = [availableButtons.allKeys sortedArrayUsingSelector:@selector(compare:)];
312
291
  return [[[FBErrorBuilder builder]
313
- withDescriptionFormat:@"The button '%@' is not supported. The device under test only supports the following buttons: %@", buttonName, supportedButtonNames]
292
+ withDescriptionFormat:@"The button '%@' is not supported. The device under test only supports the following buttons: %@", buttonName, sortedKeys]
314
293
  buildError:error];
315
294
  }
316
-
317
295
  if (duration) {
318
- // https://developer.apple.com/documentation/xctest/xcuiremote/1627475-pressbutton
319
- [[XCUIRemote sharedRemote] pressButton:remoteButton forDuration:duration.doubleValue];
296
+ // https://developer.apple.com/documentation/xcuiautomation/xcuiremote/press(_:forduration:)
297
+ [[XCUIRemote sharedRemote] pressButton:(XCUIRemoteButton)[buttonValue unsignedIntegerValue] forDuration:duration.doubleValue];
320
298
  } else {
321
- // https://developer.apple.com/documentation/xctest/xcuiremote/1627476-pressbutton
322
- [[XCUIRemote sharedRemote] pressButton:remoteButton];
299
+ // https://developer.apple.com/documentation/xcuiautomation/xcuiremote/press(_:)
300
+ [[XCUIRemote sharedRemote] pressButton:(XCUIRemoteButton)[buttonValue unsignedIntegerValue]];
323
301
  }
324
-
325
302
  return YES;
326
303
  #endif
327
304
  }
@@ -330,12 +307,13 @@ static bool fb_isLocked;
330
307
  - (BOOL)fb_pressButton:(NSString *)buttonName
331
308
  error:(NSError **)error
332
309
  {
333
- NSDictionary<NSString *, NSNumber *> *availableButtons = availableButtonNames();
310
+ NSDictionary<NSString *, NSNumber *> *availableButtons = fb_availableButtonNames();
334
311
  NSNumber *buttonValue = availableButtons[buttonName.lowercaseString];
335
312
 
336
313
  if (!buttonValue) {
314
+ NSArray *sortedKeys = [availableButtons.allKeys sortedArrayUsingSelector:@selector(compare:)];
337
315
  return [[[FBErrorBuilder builder]
338
- withDescriptionFormat:@"The button '%@' is not supported. The device under test only supports the following buttons: %@", buttonName, availableButtons.allKeys]
316
+ withDescriptionFormat:@"The button '%@' is not supported. The device under test only supports the following buttons: %@", buttonName, sortedKeys]
339
317
  buildError:error];
340
318
  }
341
319
  [self pressButton:(XCUIDeviceButton)[buttonValue unsignedIntegerValue]];
@@ -15,11 +15,11 @@
15
15
  <key>CFBundlePackageType</key>
16
16
  <string>FMWK</string>
17
17
  <key>CFBundleShortVersionString</key>
18
- <string>11.2.0</string>
18
+ <string>11.3.0</string>
19
19
  <key>CFBundleSignature</key>
20
20
  <string>????</string>
21
21
  <key>CFBundleVersion</key>
22
- <string>11.2.0</string>
22
+ <string>11.3.0</string>
23
23
  <key>NSPrincipalClass</key>
24
24
  <string/>
25
25
  </dict>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appium-webdriveragent",
3
- "version": "11.2.0",
3
+ "version": "11.3.0",
4
4
  "description": "Package bundling WebDriverAgent",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",