appium-webdriveragent 11.1.7 → 11.2.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 +6 -0
- package/WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.h +10 -1
- package/WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m +47 -21
- package/WebDriverAgentLib/Info.plist +2 -2
- package/WebDriverAgentTests/IntegrationTests/XCUIDeviceHelperTests.m +16 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## [11.2.0](https://github.com/appium/WebDriverAgent/compare/v11.1.7...v11.2.0) (2026-03-04)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* add `action` and `camera` values for `mobile: pressButton` ([#1115](https://github.com/appium/WebDriverAgent/issues/1115)) ([3df0284](https://github.com/appium/WebDriverAgent/commit/3df0284d741f8b4a36a9e12e130ecf0711b60366))
|
|
6
|
+
|
|
1
7
|
## [11.1.7](https://github.com/appium/WebDriverAgent/compare/v11.1.6...v11.1.7) (2026-03-03)
|
|
2
8
|
|
|
3
9
|
### Miscellaneous Chores
|
|
@@ -95,10 +95,19 @@ typedef NS_ENUM(NSUInteger, FBUIInterfaceAppearance) {
|
|
|
95
95
|
*/
|
|
96
96
|
- (BOOL)fb_openUrl:(NSString *)url withApplication:(NSString *)bundleId error:(NSError **)error;
|
|
97
97
|
|
|
98
|
+
/**
|
|
99
|
+
Checks if the device has a specific hardware button available.
|
|
100
|
+
|
|
101
|
+
@param buttonName The name of the button to check (e.g., "home", "volumeUp", "volumeDown", "action", "camera")
|
|
102
|
+
@return YES if the button is available on the device, otherwise NO
|
|
103
|
+
*/
|
|
104
|
+
- (BOOL)fb_hasButton:(NSString *)buttonName;
|
|
105
|
+
|
|
98
106
|
/**
|
|
99
107
|
Presses the corresponding hardware button on the device with duration.
|
|
100
108
|
|
|
101
|
-
@param buttonName One of the supported button names: volumeUp (real devices only), volumeDown (real device only),
|
|
109
|
+
@param buttonName One of the supported button names: volumeUp (real devices only), volumeDown (real device only),
|
|
110
|
+
camera (supported iOS 16+ real devices only), action (supported iOS 16+ devices only), home
|
|
102
111
|
@param duration Duration in seconds or nil.
|
|
103
112
|
This argument works only on tvOS. When this argument is nil on tvOS,
|
|
104
113
|
https://developer.apple.com/documentation/xctest/xcuiremote/1627476-pressbutton will be called.
|
|
@@ -26,6 +26,41 @@
|
|
|
26
26
|
static const NSTimeInterval FBHomeButtonCoolOffTime = 1.;
|
|
27
27
|
static const NSTimeInterval FBScreenLockTimeout = 5.;
|
|
28
28
|
|
|
29
|
+
NSDictionary<NSString *, NSNumber *> *availableButtonNames(void) {
|
|
30
|
+
static dispatch_once_t onceToken;
|
|
31
|
+
static NSDictionary *result;
|
|
32
|
+
dispatch_once(&onceToken, ^{
|
|
33
|
+
NSMutableDictionary *buttons = [NSMutableDictionary dictionary];
|
|
34
|
+
|
|
35
|
+
// Home button is always available
|
|
36
|
+
buttons[@"home"] = @(XCUIDeviceButtonHome);
|
|
37
|
+
|
|
38
|
+
#if !TARGET_OS_TV
|
|
39
|
+
#if !TARGET_OS_SIMULATOR
|
|
40
|
+
buttons[@"volumeup"] = @(XCUIDeviceButtonVolumeUp);
|
|
41
|
+
buttons[@"volumedown"] = @(XCUIDeviceButtonVolumeDown);
|
|
42
|
+
#endif
|
|
43
|
+
|
|
44
|
+
if (@available(iOS 16.0, *)) {
|
|
45
|
+
#if defined(XCUIDeviceButtonAction)
|
|
46
|
+
if ([XCUIDevice.sharedDevice hasHardwareButton:XCUIDeviceButtonAction]) {
|
|
47
|
+
buttons[@"action"] = @(XCUIDeviceButtonAction);
|
|
48
|
+
}
|
|
49
|
+
#endif
|
|
50
|
+
#if defined(XCUIDeviceButtonCamera)
|
|
51
|
+
#if !TARGET_OS_SIMULATOR
|
|
52
|
+
if ([XCUIDevice.sharedDevice hasHardwareButton:XCUIDeviceButtonCamera]) {
|
|
53
|
+
buttons[@"camera"] = @(XCUIDeviceButtonCamera);
|
|
54
|
+
}
|
|
55
|
+
#endif
|
|
56
|
+
#endif
|
|
57
|
+
}
|
|
58
|
+
#endif
|
|
59
|
+
result = [buttons copy];
|
|
60
|
+
});
|
|
61
|
+
return result;
|
|
62
|
+
}
|
|
63
|
+
|
|
29
64
|
@implementation XCUIDevice (FBHelpers)
|
|
30
65
|
|
|
31
66
|
static bool fb_isLocked;
|
|
@@ -210,6 +245,11 @@ static bool fb_isLocked;
|
|
|
210
245
|
}
|
|
211
246
|
}
|
|
212
247
|
|
|
248
|
+
- (BOOL)fb_hasButton:(NSString *)buttonName
|
|
249
|
+
{
|
|
250
|
+
return availableButtonNames()[buttonName.lowercaseString] != nil;
|
|
251
|
+
}
|
|
252
|
+
|
|
213
253
|
- (BOOL)fb_pressButton:(NSString *)buttonName
|
|
214
254
|
forDuration:(nullable NSNumber *)duration
|
|
215
255
|
error:(NSError **)error
|
|
@@ -270,7 +310,7 @@ static bool fb_isLocked;
|
|
|
270
310
|
|
|
271
311
|
if (remoteButton == -1) {
|
|
272
312
|
return [[[FBErrorBuilder builder]
|
|
273
|
-
withDescriptionFormat:@"The button '%@' is
|
|
313
|
+
withDescriptionFormat:@"The button '%@' is not supported. The device under test only supports the following buttons: %@", buttonName, supportedButtonNames]
|
|
274
314
|
buildError:error];
|
|
275
315
|
}
|
|
276
316
|
|
|
@@ -290,29 +330,15 @@ static bool fb_isLocked;
|
|
|
290
330
|
- (BOOL)fb_pressButton:(NSString *)buttonName
|
|
291
331
|
error:(NSError **)error
|
|
292
332
|
{
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
}
|
|
298
|
-
[supportedButtonNames addObject:@"home"];
|
|
299
|
-
#if !TARGET_OS_SIMULATOR
|
|
300
|
-
if ([buttonName.lowercaseString isEqualToString:@"volumeup"]) {
|
|
301
|
-
dstButton = XCUIDeviceButtonVolumeUp;
|
|
302
|
-
}
|
|
303
|
-
if ([buttonName.lowercaseString isEqualToString:@"volumedown"]) {
|
|
304
|
-
dstButton = XCUIDeviceButtonVolumeDown;
|
|
305
|
-
}
|
|
306
|
-
[supportedButtonNames addObject:@"volumeUp"];
|
|
307
|
-
[supportedButtonNames addObject:@"volumeDown"];
|
|
308
|
-
#endif
|
|
309
|
-
|
|
310
|
-
if (dstButton == 0) {
|
|
333
|
+
NSDictionary<NSString *, NSNumber *> *availableButtons = availableButtonNames();
|
|
334
|
+
NSNumber *buttonValue = availableButtons[buttonName.lowercaseString];
|
|
335
|
+
|
|
336
|
+
if (!buttonValue) {
|
|
311
337
|
return [[[FBErrorBuilder builder]
|
|
312
|
-
withDescriptionFormat:@"The button '%@' is
|
|
338
|
+
withDescriptionFormat:@"The button '%@' is not supported. The device under test only supports the following buttons: %@", buttonName, availableButtons.allKeys]
|
|
313
339
|
buildError:error];
|
|
314
340
|
}
|
|
315
|
-
[self pressButton:
|
|
341
|
+
[self pressButton:(XCUIDeviceButton)[buttonValue unsignedIntegerValue]];
|
|
316
342
|
return YES;
|
|
317
343
|
}
|
|
318
344
|
#endif
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
<key>CFBundlePackageType</key>
|
|
16
16
|
<string>FMWK</string>
|
|
17
17
|
<key>CFBundleShortVersionString</key>
|
|
18
|
-
<string>11.
|
|
18
|
+
<string>11.2.0</string>
|
|
19
19
|
<key>CFBundleSignature</key>
|
|
20
20
|
<string>????</string>
|
|
21
21
|
<key>CFBundleVersion</key>
|
|
22
|
-
<string>11.
|
|
22
|
+
<string>11.2.0</string>
|
|
23
23
|
<key>NSPrincipalClass</key>
|
|
24
24
|
<string/>
|
|
25
25
|
</dict>
|
|
@@ -186,6 +186,22 @@
|
|
|
186
186
|
XCTAssertNil(error);
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
+
- (void)testPressingDeviceSpecificButton
|
|
190
|
+
{
|
|
191
|
+
NSError *error;
|
|
192
|
+
BOOL hasActionButton = [XCUIDevice.sharedDevice fb_hasButton:@"action"];
|
|
193
|
+
BOOL didPressButton = [XCUIDevice.sharedDevice fb_pressButton:@"action"
|
|
194
|
+
forDuration:nil
|
|
195
|
+
error:&error];
|
|
196
|
+
if (hasActionButton) {
|
|
197
|
+
XCTAssertTrue(didPressButton);
|
|
198
|
+
XCTAssertNil(error);
|
|
199
|
+
} else {
|
|
200
|
+
XCTAssertFalse(didPressButton);
|
|
201
|
+
XCTAssertNotNil(error);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
189
205
|
- (void)testPressingSupportedButtonNumber
|
|
190
206
|
{
|
|
191
207
|
NSError *error;
|