appium-webdriveragent 16.16.4 → 16.16.5
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 +7 -0
- package/WebDriverAgent.xcodeproj/project.pbxproj +16 -0
- package/WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m +22 -77
- package/WebDriverAgentLib/Categories/XCUIDevice+FBRotation.m +6 -122
- package/WebDriverAgentLib/Info.plist +2 -2
- package/WebDriverAgentLib/Utilities/FBHIDOperations.h +41 -0
- package/WebDriverAgentLib/Utilities/FBHIDOperations.m +244 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [16.16.5](https://github.com/appium/appium-ios/compare/appium-webdriveragent@16.16.4...appium-webdriveragent@16.16.5) (2026-10-21)
|
|
7
|
+
|
|
8
|
+
### Code Refactoring
|
|
9
|
+
|
|
10
|
+
* move HID related implementation in a separate module ([#103](https://github.com/appium/appium-ios/issues/103)) ([701eb60](https://github.com/appium/appium-ios/commit/701eb601455c7ab04c283dbc8a0da055eb7e3199))
|
|
11
|
+
|
|
12
|
+
|
|
6
13
|
## [16.16.4](https://github.com/appium/appium-ios/compare/appium-webdriveragent@16.16.3...appium-webdriveragent@16.16.4) (2026-10-21)
|
|
7
14
|
|
|
8
15
|
### Bug Fixes
|
|
@@ -350,6 +350,7 @@
|
|
|
350
350
|
641EE6232240C5CA00173FCB /* FBScreen.m in Sources */ = {isa = PBXBuildFile; fileRef = 715AFAC01FFA29180053896D /* FBScreen.m */; };
|
|
351
351
|
641EE6242240C5CA00173FCB /* FBXCTestDaemonsProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = EE35AD7A1E3B80C000A02D78 /* FBXCTestDaemonsProxy.m */; };
|
|
352
352
|
641EE6262240C5CA00173FCB /* FBMathUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = EE1888391DA661C400307AA8 /* FBMathUtils.m */; };
|
|
353
|
+
A8FC9D445C9947988C80AFC9 /* FBHIDOperations.m in Sources */ = {isa = PBXBuildFile; fileRef = 3975477AB6C14ABDBBDE3EAD /* FBHIDOperations.m */; };
|
|
353
354
|
641EE6272240C5CA00173FCB /* FBXCAXClientProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 7157B290221DADD2001C348C /* FBXCAXClientProxy.m */; };
|
|
354
355
|
641EE6312240C5CA00173FCB /* XCUIElement+FBWebDriverAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = EEE376471D59FAE900ED88DD /* XCUIElement+FBWebDriverAttributes.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
|
355
356
|
641EE6322240C5CA00173FCB /* FBScreen.h in Headers */ = {isa = PBXBuildFile; fileRef = 715AFABF1FFA29180053896D /* FBScreen.h */; };
|
|
@@ -389,6 +390,7 @@
|
|
|
389
390
|
641EE66A2240C5CA00173FCB /* NSExpression+FBFormat.h in Headers */ = {isa = PBXBuildFile; fileRef = 71555A3B1DEC460A007D4A8B /* NSExpression+FBFormat.h */; };
|
|
390
391
|
641EE66E2240C5CA00173FCB /* XCUIApplication+FBAlert.h in Headers */ = {isa = PBXBuildFile; fileRef = 719CD8FA2126C88B00C7D0C2 /* XCUIApplication+FBAlert.h */; };
|
|
391
392
|
641EE6702240C5CA00173FCB /* FBMathUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = EE1888381DA661C400307AA8 /* FBMathUtils.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
|
393
|
+
EB4835874F7A441B92844DDC /* FBHIDOperations.h in Headers */ = {isa = PBXBuildFile; fileRef = AF9468F16B934D6DB950E4BF /* FBHIDOperations.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
|
392
394
|
641EE6722240C5CA00173FCB /* FBElementUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 713C6DCD1DDC772A00285B92 /* FBElementUtils.h */; };
|
|
393
395
|
641EE6732240C5CA00173FCB /* FBDebugCommands.h in Headers */ = {isa = PBXBuildFile; fileRef = EE9AB7541CAEDF0C008C271F /* FBDebugCommands.h */; };
|
|
394
396
|
641EE6752240C5CA00173FCB /* XCUICoordinate.h in Headers */ = {isa = PBXBuildFile; fileRef = EE35ACFC1E3B77D600A02D78 /* XCUICoordinate.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
|
@@ -956,6 +958,7 @@
|
|
|
956
958
|
C47007FD2047EBF580060870 /* XCTMessagingChannel_RunnerToDaemon-Protocol.h in Headers */ = {isa = PBXBuildFile; fileRef = A2793FE9DE63C687BB6E2D37 /* XCTMessagingChannel_RunnerToDaemon-Protocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
|
957
959
|
C4AECD675B9F43748D8091A3 /* XCTMessagingRole_SignpostRequesting-Protocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E2F683D8A6C6EAAEC8B080A /* XCTMessagingRole_SignpostRequesting-Protocol.h */; };
|
|
958
960
|
C4E500AC8CD81B4FE3A75EAE /* FBMathUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = EE1888391DA661C400307AA8 /* FBMathUtils.m */; };
|
|
961
|
+
193C31F37F354FF490DC9A85 /* FBHIDOperations.m in Sources */ = {isa = PBXBuildFile; fileRef = 3975477AB6C14ABDBBDE3EAD /* FBHIDOperations.m */; };
|
|
959
962
|
C4FA6AE56892A53972967885 /* XCUIElementTypeQueryProvider_Private-Protocol.h in Headers */ = {isa = PBXBuildFile; fileRef = AF208CBAC82CDFF8B6F88867 /* XCUIElementTypeQueryProvider_Private-Protocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
|
960
963
|
C5C5311BCBCCE031B27BA46D /* XCUIInterruptionMonitoring-Protocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 44019CB45CF491B5FDAB8213 /* XCUIInterruptionMonitoring-Protocol.h */; };
|
|
961
964
|
C6ADE8E69FBFD7A0B63ECA06 /* FBCommandStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = 71B155DB230711E900646AFB /* FBCommandStatus.m */; };
|
|
@@ -1049,6 +1052,7 @@
|
|
|
1049
1052
|
E62AED48CAE64088C1E7498B /* XCUIElement+FBPickerWheel.h in Headers */ = {isa = PBXBuildFile; fileRef = 7136A4771E8918E60024FC3D /* XCUIElement+FBPickerWheel.h */; };
|
|
1050
1053
|
E66195839119DC5A8BB7A5D9 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD1ABD1093739852B52C472B /* Foundation.framework */; };
|
|
1051
1054
|
E6B214145FE46BBFD824FAE7 /* FBMathUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = EE1888381DA661C400307AA8 /* FBMathUtils.h */; };
|
|
1055
|
+
97DFB93D8EDD45E9BC475564 /* FBHIDOperations.h in Headers */ = {isa = PBXBuildFile; fileRef = AF9468F16B934D6DB950E4BF /* FBHIDOperations.h */; };
|
|
1052
1056
|
E78F581F8E7530B24AC31A8B /* XCTMessagingRole_UIAutomation-Protocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 92182E4007B37665AB8CD88E /* XCTMessagingRole_UIAutomation-Protocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
|
1053
1057
|
E82332D32C4E06280CBE3F4C /* FBResponseJSONPayloadTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3F5C37472190A686297D3534 /* FBResponseJSONPayloadTests.m */; };
|
|
1054
1058
|
E8E894CD81C41AC4467A4F4C /* XCTCapabilities.h in Headers */ = {isa = PBXBuildFile; fileRef = DB5400B170F08C71779CCD0E /* XCTCapabilities.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
|
@@ -1127,7 +1131,9 @@
|
|
|
1127
1131
|
EE158B5A1CBD462100A3E3F0 /* WebDriverAgentLib.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EE158A991CBD452B00A3E3F0 /* WebDriverAgentLib.framework */; };
|
|
1128
1132
|
EE158B5F1CBD47A000A3E3F0 /* WebDriverAgentLib.h in Headers */ = {isa = PBXBuildFile; fileRef = EE158B5E1CBD47A000A3E3F0 /* WebDriverAgentLib.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
|
1129
1133
|
EE18883A1DA661C400307AA8 /* FBMathUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = EE1888381DA661C400307AA8 /* FBMathUtils.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
|
1134
|
+
BD3FD3FCF7D74D3DAC313415 /* FBHIDOperations.h in Headers */ = {isa = PBXBuildFile; fileRef = AF9468F16B934D6DB950E4BF /* FBHIDOperations.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
|
1130
1135
|
EE18883B1DA661C400307AA8 /* FBMathUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = EE1888391DA661C400307AA8 /* FBMathUtils.m */; };
|
|
1136
|
+
9279EE2CB3EA412A8850B615 /* FBHIDOperations.m in Sources */ = {isa = PBXBuildFile; fileRef = 3975477AB6C14ABDBBDE3EAD /* FBHIDOperations.m */; };
|
|
1131
1137
|
EE18883D1DA663EB00307AA8 /* FBMathUtilsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = EE18883C1DA663EB00307AA8 /* FBMathUtilsTests.m */; };
|
|
1132
1138
|
EE1E06DA1D1808C2007CF043 /* FBIntegrationTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = EE1E06D91D1808C2007CF043 /* FBIntegrationTestCase.m */; };
|
|
1133
1139
|
EE1E06E71D182E95007CF043 /* FBAlertViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = EE1E06E61D182E95007CF043 /* FBAlertViewController.m */; };
|
|
@@ -1832,7 +1838,9 @@
|
|
|
1832
1838
|
EE158B5D1CBD479000A3E3F0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = WebDriverAgentLib/Info.plist; sourceTree = SOURCE_ROOT; };
|
|
1833
1839
|
EE158B5E1CBD47A000A3E3F0 /* WebDriverAgentLib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebDriverAgentLib.h; path = WebDriverAgentLib/WebDriverAgentLib.h; sourceTree = SOURCE_ROOT; };
|
|
1834
1840
|
EE1888381DA661C400307AA8 /* FBMathUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBMathUtils.h; sourceTree = "<group>"; };
|
|
1841
|
+
AF9468F16B934D6DB950E4BF /* FBHIDOperations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBHIDOperations.h; sourceTree = "<group>"; };
|
|
1835
1842
|
EE1888391DA661C400307AA8 /* FBMathUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBMathUtils.m; sourceTree = "<group>"; };
|
|
1843
|
+
3975477AB6C14ABDBBDE3EAD /* FBHIDOperations.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBHIDOperations.m; sourceTree = "<group>"; };
|
|
1836
1844
|
EE18883C1DA663EB00307AA8 /* FBMathUtilsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBMathUtilsTests.m; sourceTree = "<group>"; };
|
|
1837
1845
|
EE1E06D91D1808C2007CF043 /* FBIntegrationTestCase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBIntegrationTestCase.m; sourceTree = "<group>"; };
|
|
1838
1846
|
EE1E06DB1D18090F007CF043 /* FBIntegrationTestCase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBIntegrationTestCase.h; sourceTree = "<group>"; };
|
|
@@ -2609,7 +2617,9 @@
|
|
|
2609
2617
|
EE9B76A41CF7A43900275851 /* FBLogger.m */,
|
|
2610
2618
|
EE9B76A51CF7A43900275851 /* FBMacros.h */,
|
|
2611
2619
|
EE1888381DA661C400307AA8 /* FBMathUtils.h */,
|
|
2620
|
+
AF9468F16B934D6DB950E4BF /* FBHIDOperations.h */,
|
|
2612
2621
|
EE1888391DA661C400307AA8 /* FBMathUtils.m */,
|
|
2622
|
+
3975477AB6C14ABDBBDE3EAD /* FBHIDOperations.m */,
|
|
2613
2623
|
7155D701211DCEF400166C20 /* FBMjpegServer.h */,
|
|
2614
2624
|
7155D702211DCEF400166C20 /* FBMjpegServer.m */,
|
|
2615
2625
|
719DCF132601EAFB000E765F /* FBNotificationsHelper.h */,
|
|
@@ -3127,6 +3137,7 @@
|
|
|
3127
3137
|
641EE66E2240C5CA00173FCB /* XCUIApplication+FBAlert.h in Headers */,
|
|
3128
3138
|
716C9E0127315EFF005AD475 /* XCUIApplication+FBUIInterruptions.h in Headers */,
|
|
3129
3139
|
641EE6702240C5CA00173FCB /* FBMathUtils.h in Headers */,
|
|
3140
|
+
EB4835874F7A441B92844DDC /* FBHIDOperations.h in Headers */,
|
|
3130
3141
|
641EE6722240C5CA00173FCB /* FBElementUtils.h in Headers */,
|
|
3131
3142
|
641EE6732240C5CA00173FCB /* FBDebugCommands.h in Headers */,
|
|
3132
3143
|
641EE6752240C5CA00173FCB /* XCUICoordinate.h in Headers */,
|
|
@@ -3439,6 +3450,7 @@
|
|
|
3439
3450
|
95A597B8CC694006DDE49999 /* XCUIApplication+FBAlert.h in Headers */,
|
|
3440
3451
|
ED342D194B20A206864675B2 /* XCUIApplication+FBUIInterruptions.h in Headers */,
|
|
3441
3452
|
E6B214145FE46BBFD824FAE7 /* FBMathUtils.h in Headers */,
|
|
3453
|
+
97DFB93D8EDD45E9BC475564 /* FBHIDOperations.h in Headers */,
|
|
3442
3454
|
6786D4B257269918E591AC66 /* FBElementUtils.h in Headers */,
|
|
3443
3455
|
51FFE79AF3A5FADFFAB287BC /* FBDebugCommands.h in Headers */,
|
|
3444
3456
|
6D311C0CB39981D7211B5576 /* XCUICoordinate.h in Headers */,
|
|
@@ -3707,6 +3719,7 @@
|
|
|
3707
3719
|
71D3B3D5267FC7260076473D /* XCUIElement+FBResolve.h in Headers */,
|
|
3708
3720
|
719CD8FC2126C88B00C7D0C2 /* XCUIApplication+FBAlert.h in Headers */,
|
|
3709
3721
|
EE18883A1DA661C400307AA8 /* FBMathUtils.h in Headers */,
|
|
3722
|
+
BD3FD3FCF7D74D3DAC313415 /* FBHIDOperations.h in Headers */,
|
|
3710
3723
|
13DE7A49287C4005003243C6 /* FBXCDeviceEvent.h in Headers */,
|
|
3711
3724
|
71B155DA23070ECF00646AFB /* FBHTTPStatusCodes.h in Headers */,
|
|
3712
3725
|
713C6DCF1DDC772A00285B92 /* FBElementUtils.h in Headers */,
|
|
@@ -4565,6 +4578,7 @@
|
|
|
4565
4578
|
641EE6242240C5CA00173FCB /* FBXCTestDaemonsProxy.m in Sources */,
|
|
4566
4579
|
13DE7A58287CA1EC003243C6 /* FBXCElementSnapshotWrapper.m in Sources */,
|
|
4567
4580
|
641EE6262240C5CA00173FCB /* FBMathUtils.m in Sources */,
|
|
4581
|
+
A8FC9D445C9947988C80AFC9 /* FBHIDOperations.m in Sources */,
|
|
4568
4582
|
641EE6272240C5CA00173FCB /* FBXCAXClientProxy.m in Sources */,
|
|
4569
4583
|
43DE58587952717F4DEE228E /* FBHTTPServer.m in Sources */,
|
|
4570
4584
|
667705A8195BF7B0D48180B3 /* RouteRequest.m in Sources */,
|
|
@@ -4721,6 +4735,7 @@
|
|
|
4721
4735
|
92DC81D2F6E58386AC592482 /* FBXCTestDaemonsProxy.m in Sources */,
|
|
4722
4736
|
4819BEAC415E02570C0FA074 /* FBXCElementSnapshotWrapper.m in Sources */,
|
|
4723
4737
|
C4E500AC8CD81B4FE3A75EAE /* FBMathUtils.m in Sources */,
|
|
4738
|
+
193C31F37F354FF490DC9A85 /* FBHIDOperations.m in Sources */,
|
|
4724
4739
|
D062CA5914608761FE002799 /* FBXCAXClientProxy.m in Sources */,
|
|
4725
4740
|
46C54343FB83AD3AFC6CFCD4 /* FBTCPSocket.m in Sources */,
|
|
4726
4741
|
AA11BB22CC33DD44EE55FF02 /* FBMjpegServer.m in Sources */,
|
|
@@ -4845,6 +4860,7 @@
|
|
|
4845
4860
|
71B155DC230711E900646AFB /* FBCommandStatus.m in Sources */,
|
|
4846
4861
|
EE35AD7C1E3B80C000A02D78 /* FBXCTestDaemonsProxy.m in Sources */,
|
|
4847
4862
|
EE18883B1DA661C400307AA8 /* FBMathUtils.m in Sources */,
|
|
4863
|
+
9279EE2CB3EA412A8850B615 /* FBHIDOperations.m in Sources */,
|
|
4848
4864
|
7157B292221DADD2001C348C /* FBXCAXClientProxy.m in Sources */,
|
|
4849
4865
|
35924251B4B5D0A486A6A0BB /* FBHTTPServer.m in Sources */,
|
|
4850
4866
|
7072174F17BA109C6AB2859F /* RouteRequest.m in Sources */,
|
|
@@ -9,12 +9,11 @@
|
|
|
9
9
|
#import "XCUIDevice+FBHelpers.h"
|
|
10
10
|
|
|
11
11
|
#import <arpa/inet.h>
|
|
12
|
-
#import <dlfcn.h>
|
|
13
12
|
#import <ifaddrs.h>
|
|
14
|
-
#import <mach/mach_time.h>
|
|
15
13
|
#include <notify.h>
|
|
16
14
|
#import <objc/runtime.h>
|
|
17
15
|
|
|
16
|
+
#import "FBHIDOperations.h"
|
|
18
17
|
#import "FBErrorBuilder.h"
|
|
19
18
|
#import "FBImageUtils.h"
|
|
20
19
|
#import "FBMacros.h"
|
|
@@ -24,63 +23,11 @@
|
|
|
24
23
|
#import "FBXCodeCompatibility.h"
|
|
25
24
|
#import "FBXCTestDaemonsProxy.h"
|
|
26
25
|
#import "XCUIDevice.h"
|
|
27
|
-
#import "XCUIDevice+FBHinge.h"
|
|
28
26
|
#import "XCUIApplication.h"
|
|
29
27
|
|
|
30
28
|
static const NSTimeInterval FBHomeButtonCoolOffTime = 1.;
|
|
31
29
|
static const NSTimeInterval FBScreenLockTimeout = 5.;
|
|
32
30
|
|
|
33
|
-
#if !TARGET_OS_TV && !TARGET_OS_WATCH
|
|
34
|
-
// Workaround tracked in https://github.com/appium/appium/issues/22857.
|
|
35
|
-
// Reproduced on the iOS 27.1 Duo simulator with Xcode 27.1: XCTest's Home
|
|
36
|
-
// request returns without backgrounding the app. This direct HID path is also
|
|
37
|
-
// enabled on physical hinged devices, but Home behavior there is unverified.
|
|
38
|
-
// The affected Xcode/runtime version range has not been established. Remove
|
|
39
|
-
// the Home workaround when XCTest-only presses pass testHomeButtonBackgroundsApplication
|
|
40
|
-
// on supported Duo environments, including physical devices and both panels.
|
|
41
|
-
static BOOL FBPressDuoButton(uint32_t usage, NSError **error)
|
|
42
|
-
{
|
|
43
|
-
static CFTypeRef (*createEvent)(CFAllocatorRef, uint64_t, uint32_t, uint32_t, Boolean, uint32_t);
|
|
44
|
-
static CFTypeRef (*createClient)(CFAllocatorRef);
|
|
45
|
-
static void (*dispatchEvent)(CFTypeRef, CFTypeRef);
|
|
46
|
-
static void (*setTimestamp)(CFTypeRef, uint64_t);
|
|
47
|
-
static dispatch_once_t onceToken;
|
|
48
|
-
dispatch_once(&onceToken, ^{
|
|
49
|
-
void *handle = dlopen("/System/Library/Frameworks/IOKit.framework/IOKit", RTLD_LAZY);
|
|
50
|
-
if (NULL != handle) {
|
|
51
|
-
createEvent = dlsym(handle, "IOHIDEventCreateKeyboardEvent");
|
|
52
|
-
createClient = dlsym(handle, "IOHIDEventSystemClientCreate");
|
|
53
|
-
dispatchEvent = dlsym(handle, "IOHIDEventSystemClientDispatchEvent");
|
|
54
|
-
setTimestamp = dlsym(handle, "IOHIDEventSetTimeStamp");
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
if (NULL == createEvent || NULL == createClient || NULL == dispatchEvent || NULL == setTimestamp) {
|
|
58
|
-
return [[FBErrorBuilder.builder withDescription:@"The button HID APIs are unavailable"] buildError:error];
|
|
59
|
-
}
|
|
60
|
-
CFTypeRef client = createClient(kCFAllocatorDefault);
|
|
61
|
-
CFTypeRef down = createEvent(kCFAllocatorDefault, mach_absolute_time(), 0x0C, usage, YES, 0);
|
|
62
|
-
CFTypeRef up = createEvent(kCFAllocatorDefault, mach_absolute_time(), 0x0C, usage, NO, 0);
|
|
63
|
-
BOOL ready = NULL != client && NULL != down && NULL != up;
|
|
64
|
-
if (ready) {
|
|
65
|
-
// Dispatch a short paired press. Holding Power for 0.5s invokes Siri on Duo.
|
|
66
|
-
dispatchEvent(client, down);
|
|
67
|
-
[NSThread sleepForTimeInterval:0.03];
|
|
68
|
-
setTimestamp(up, mach_absolute_time());
|
|
69
|
-
dispatchEvent(client, up);
|
|
70
|
-
}
|
|
71
|
-
if (NULL != down) {
|
|
72
|
-
CFRelease(down);
|
|
73
|
-
}
|
|
74
|
-
if (NULL != up) {
|
|
75
|
-
CFRelease(up);
|
|
76
|
-
}
|
|
77
|
-
if (NULL != client) {
|
|
78
|
-
CFRelease(client);
|
|
79
|
-
}
|
|
80
|
-
return ready || [[FBErrorBuilder.builder withDescription:@"Cannot create the button HID event or client"] buildError:error];
|
|
81
|
-
}
|
|
82
|
-
#endif
|
|
83
|
-
|
|
84
31
|
#if TARGET_OS_WATCH
|
|
85
32
|
static NSString *const FBClockFaceBundleId = @"com.apple.clockface";
|
|
86
33
|
#endif
|
|
@@ -253,34 +200,32 @@ static bool fb_isLocked;
|
|
|
253
200
|
if (fb_isLocked) {
|
|
254
201
|
return YES;
|
|
255
202
|
}
|
|
256
|
-
#if TARGET_OS_SIMULATOR
|
|
257
203
|
#if !TARGET_OS_TV && !TARGET_OS_WATCH
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
if (self.fb_supportsHingeAngleReading) {
|
|
261
|
-
if (!FBPressDuoButton(0x30, error)) {
|
|
204
|
+
if ([FBHIDOperations appliesToDevice:self]) {
|
|
205
|
+
if (![FBHIDOperations pressLockWithError:error]) {
|
|
262
206
|
return NO;
|
|
263
207
|
}
|
|
264
208
|
} else
|
|
265
209
|
#endif
|
|
266
210
|
{
|
|
211
|
+
#if TARGET_OS_SIMULATOR
|
|
267
212
|
[self pressLockButton];
|
|
268
|
-
}
|
|
269
213
|
#else
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
214
|
+
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"27.0")) {
|
|
215
|
+
// iOS 27: pressLockButton no longer locks; use a short IOHID Power press.
|
|
216
|
+
// A 0.5s hold can invoke Siri instead of locking the screen.
|
|
217
|
+
const NSTimeInterval duration = 0.2;
|
|
218
|
+
if (![self fb_performIOHIDEventWithPage:0x0C
|
|
219
|
+
usage:0x30
|
|
220
|
+
duration:duration
|
|
221
|
+
error:error]) {
|
|
222
|
+
return NO;
|
|
223
|
+
}
|
|
224
|
+
} else {
|
|
225
|
+
[self pressLockButton];
|
|
279
226
|
}
|
|
280
|
-
} else {
|
|
281
|
-
[self pressLockButton];
|
|
282
|
-
}
|
|
283
227
|
#endif
|
|
228
|
+
}
|
|
284
229
|
return [[[[FBRunLoopSpinner new]
|
|
285
230
|
timeout:FBScreenLockTimeout]
|
|
286
231
|
timeoutErrorMessage:@"Timed out while waiting until the screen gets locked"]
|
|
@@ -300,9 +245,9 @@ static bool fb_isLocked;
|
|
|
300
245
|
return YES;
|
|
301
246
|
}
|
|
302
247
|
for (NSUInteger attempt = 0; attempt < 2; attempt++) {
|
|
303
|
-
#if
|
|
304
|
-
if (self
|
|
305
|
-
if (!
|
|
248
|
+
#if !TARGET_OS_TV && !TARGET_OS_WATCH
|
|
249
|
+
if ([FBHIDOperations appliesToDevice:self]) {
|
|
250
|
+
if (![FBHIDOperations pressHomeWithError:error]) {
|
|
306
251
|
return NO;
|
|
307
252
|
}
|
|
308
253
|
} else
|
|
@@ -479,8 +424,8 @@ static bool fb_isLocked;
|
|
|
479
424
|
buildError:error];
|
|
480
425
|
}
|
|
481
426
|
#if !TARGET_OS_TV && !TARGET_OS_WATCH
|
|
482
|
-
if (buttonValue.unsignedIntegerValue == XCUIDeviceButtonHome && self
|
|
483
|
-
return
|
|
427
|
+
if (buttonValue.unsignedIntegerValue == XCUIDeviceButtonHome && [FBHIDOperations appliesToDevice:self]) {
|
|
428
|
+
return [FBHIDOperations pressHomeWithError:error];
|
|
484
429
|
}
|
|
485
430
|
#endif
|
|
486
431
|
[self pressButton:(XCUIDeviceButton)[buttonValue unsignedIntegerValue]];
|
|
@@ -8,143 +8,27 @@
|
|
|
8
8
|
|
|
9
9
|
#import "XCUIDevice+FBRotation.h"
|
|
10
10
|
|
|
11
|
-
#import <dlfcn.h>
|
|
12
|
-
#import <mach/mach_time.h>
|
|
13
|
-
|
|
14
11
|
#import "FBConfiguration.h"
|
|
15
|
-
#import "
|
|
16
|
-
#import "FBRunLoopSpinner.h"
|
|
17
|
-
#import "FBScreen.h"
|
|
18
|
-
#import "FBSession.h"
|
|
19
|
-
#import "XCUIScreen.h"
|
|
20
|
-
#import "XCUIDevice+FBHinge.h"
|
|
12
|
+
#import "FBHIDOperations.h"
|
|
21
13
|
#import "XCUIApplication.h"
|
|
22
14
|
#import "XCUIApplication+FBHelpers.h"
|
|
23
15
|
#import "XCUIElement+FBUtilities.h"
|
|
24
16
|
|
|
25
17
|
# if !TARGET_OS_TV && !TARGET_OS_WATCH
|
|
26
18
|
|
|
27
|
-
// Work around XCTest updating Duo device orientation without rotating the app.
|
|
28
|
-
// Reproduction details and checks required before removing this workaround:
|
|
29
|
-
// https://github.com/appium/appium-ios/pull/81
|
|
30
|
-
static BOOL FBDispatchDuoOrientation(UIDeviceOrientation orientation)
|
|
31
|
-
{
|
|
32
|
-
XCUIScreen *screen = [FBScreen currentScreenWithError:nil];
|
|
33
|
-
if (nil == screen) {
|
|
34
|
-
return NO;
|
|
35
|
-
}
|
|
36
|
-
// The inner panel's native orientation is a quarter turn from the cover.
|
|
37
|
-
// Values match DeviceKit's orientation-picker-control (Xcode 27.1).
|
|
38
|
-
NSString *value;
|
|
39
|
-
switch (orientation) {
|
|
40
|
-
case UIDeviceOrientationPortrait:
|
|
41
|
-
value = screen.isMainScreen ? @"portrait" : @"landscape-left";
|
|
42
|
-
break;
|
|
43
|
-
case UIDeviceOrientationLandscapeLeft:
|
|
44
|
-
value = screen.isMainScreen ? @"landscape-left" : @"pud";
|
|
45
|
-
break;
|
|
46
|
-
case UIDeviceOrientationLandscapeRight:
|
|
47
|
-
value = screen.isMainScreen ? @"landscape-right" : @"portrait";
|
|
48
|
-
break;
|
|
49
|
-
case UIDeviceOrientationPortraitUpsideDown:
|
|
50
|
-
value = screen.isMainScreen ? @"pud" : @"landscape-right";
|
|
51
|
-
break;
|
|
52
|
-
case UIDeviceOrientationUnknown:
|
|
53
|
-
case UIDeviceOrientationFaceUp:
|
|
54
|
-
case UIDeviceOrientationFaceDown:
|
|
55
|
-
default:
|
|
56
|
-
return NO;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
static CFDataRef (*serialize)(CFTypeRef, CFOptionFlags);
|
|
60
|
-
static CFTypeRef (*createEvent)(CFAllocatorRef, uint64_t, uint32_t, uint32_t,
|
|
61
|
-
uint32_t, uint8_t *, CFIndex, uint32_t);
|
|
62
|
-
static CFTypeRef (*createClient)(CFAllocatorRef);
|
|
63
|
-
static void (*dispatchEvent)(CFTypeRef, CFTypeRef);
|
|
64
|
-
static dispatch_once_t onceToken;
|
|
65
|
-
dispatch_once(&onceToken, ^{
|
|
66
|
-
void *handle = dlopen("/System/Library/Frameworks/IOKit.framework/IOKit", RTLD_LAZY);
|
|
67
|
-
if (NULL != handle) {
|
|
68
|
-
serialize = (CFDataRef (*)(CFTypeRef, CFOptionFlags))dlsym(handle, "IOCFSerialize");
|
|
69
|
-
createEvent = (CFTypeRef (*)(CFAllocatorRef, uint64_t, uint32_t, uint32_t,
|
|
70
|
-
uint32_t, uint8_t *, CFIndex, uint32_t))dlsym(handle, "IOHIDEventCreateVendorDefinedEvent");
|
|
71
|
-
createClient = (CFTypeRef (*)(CFAllocatorRef))dlsym(handle, "IOHIDEventSystemClientCreate");
|
|
72
|
-
dispatchEvent = (void (*)(CFTypeRef, CFTypeRef))dlsym(handle, "IOHIDEventSystemClientDispatchEvent");
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
if (NULL == serialize || NULL == createEvent || NULL == createClient || NULL == dispatchEvent) {
|
|
76
|
-
return NO;
|
|
77
|
-
}
|
|
78
|
-
NSDictionary *payload = @{
|
|
79
|
-
@"provider": @"com.apple.Virtualization.VirtualMachines",
|
|
80
|
-
@"source": @"orientation-picker-control",
|
|
81
|
-
@"type": @"enum",
|
|
82
|
-
@"value": value,
|
|
83
|
-
};
|
|
84
|
-
// The receiver expects IOCF binary serialization, not a binary plist.
|
|
85
|
-
CFDataRef data = serialize((__bridge CFTypeRef)payload, 1);
|
|
86
|
-
if (NULL == data) {
|
|
87
|
-
return NO;
|
|
88
|
-
}
|
|
89
|
-
CFTypeRef event = createEvent(kCFAllocatorDefault, mach_absolute_time(), 0xff61, 0x5b, 0,
|
|
90
|
-
(uint8_t *)CFDataGetBytePtr(data), CFDataGetLength(data), 0);
|
|
91
|
-
CFRelease(data);
|
|
92
|
-
CFTypeRef client = createClient(kCFAllocatorDefault);
|
|
93
|
-
BOOL canDispatch = NULL != event && NULL != client;
|
|
94
|
-
if (canDispatch) {
|
|
95
|
-
dispatchEvent(client, event);
|
|
96
|
-
}
|
|
97
|
-
if (NULL != event) {
|
|
98
|
-
CFRelease(event);
|
|
99
|
-
}
|
|
100
|
-
if (NULL != client) {
|
|
101
|
-
CFRelease(client);
|
|
102
|
-
}
|
|
103
|
-
return canDispatch;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
19
|
static UIInterfaceOrientation FBInterfaceOrientationFromDeviceOrientation(UIDeviceOrientation orientation);
|
|
107
20
|
|
|
108
21
|
@implementation XCUIDevice (FBRotation)
|
|
109
22
|
|
|
110
23
|
- (BOOL)fb_setDeviceInterfaceOrientation:(UIDeviceOrientation)orientation
|
|
111
24
|
{
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
// Point-based detection can select the cover SpringBoard while the app
|
|
116
|
-
// is on the inner panel. Prefer the session's active application.
|
|
117
|
-
application = FBSession.activeSession.activeApplication ?: application;
|
|
25
|
+
if ([FBHIDOperations appliesToDevice:self]) {
|
|
26
|
+
return [FBHIDOperations rotateToOrientation:orientation
|
|
27
|
+
interfaceOrientation:FBInterfaceOrientationFromDeviceOrientation(orientation)];
|
|
118
28
|
}
|
|
119
|
-
|
|
29
|
+
XCUIApplication *application = XCUIApplication.fb_activeApplication;
|
|
120
30
|
[XCUIDevice sharedDevice].orientation = orientation;
|
|
121
|
-
|
|
122
|
-
if (!supportsHinge) {
|
|
123
|
-
return [self waitUntilInterfaceIsAtOrientation:orientation application:application];
|
|
124
|
-
}
|
|
125
|
-
// On Duo simulators XCTest can update its value without rotating the app.
|
|
126
|
-
// Dispatch directly instead of waiting for the XCTest path to fail.
|
|
127
|
-
#else
|
|
128
|
-
if ([self waitUntilInterfaceIsAtOrientation:orientation application:application]) {
|
|
129
|
-
return YES;
|
|
130
|
-
}
|
|
131
|
-
if (!supportsHinge) {
|
|
132
|
-
return NO;
|
|
133
|
-
}
|
|
134
|
-
[FBLogger logFmt:@"XCTest did not rotate the app to device orientation %ld on a physical Duo device. "
|
|
135
|
-
@"Falling back to the vendor HID orientation event; physical-device support is unverified.",
|
|
136
|
-
(long)orientation];
|
|
137
|
-
#endif
|
|
138
|
-
if (!FBDispatchDuoOrientation(orientation)) {
|
|
139
|
-
return NO;
|
|
140
|
-
}
|
|
141
|
-
// Event dispatch is asynchronous. Keep checking the app, not just XCTest's
|
|
142
|
-
// device-orientation value, which can change without rotating the scene.
|
|
143
|
-
BOOL reachedOrientation = [[[FBRunLoopSpinner new] timeout:5.0] spinUntilTrue:^BOOL{
|
|
144
|
-
return application.interfaceOrientation == FBInterfaceOrientationFromDeviceOrientation(orientation);
|
|
145
|
-
}];
|
|
146
|
-
return reachedOrientation
|
|
147
|
-
&& [self waitUntilInterfaceIsAtOrientation:orientation application:application];
|
|
31
|
+
return [self waitUntilInterfaceIsAtOrientation:orientation application:application];
|
|
148
32
|
}
|
|
149
33
|
|
|
150
34
|
- (BOOL)fb_setDeviceRotation:(NSDictionary *)rotationObj
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
<key>CFBundlePackageType</key>
|
|
16
16
|
<string>FMWK</string>
|
|
17
17
|
<key>CFBundleShortVersionString</key>
|
|
18
|
-
<string>16.16.
|
|
18
|
+
<string>16.16.5</string>
|
|
19
19
|
<key>CFBundleSignature</key>
|
|
20
20
|
<string>????</string>
|
|
21
21
|
<key>CFBundleVersion</key>
|
|
22
|
-
<string>16.16.
|
|
22
|
+
<string>16.16.5</string>
|
|
23
23
|
<key>NSPrincipalClass</key>
|
|
24
24
|
<string/>
|
|
25
25
|
</dict>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2015-present, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the BSD-style license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
#import <XCTest/XCTest.h>
|
|
10
|
+
#import <UIKit/UIKit.h>
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
HID paths for Home, lock/unlock, and rotation on hinged iOS devices.
|
|
14
|
+
|
|
15
|
+
Remove each workaround once its XCTest-only path passes the corresponding regression
|
|
16
|
+
test on supported runtimes and both panels: testHomeButtonBackgroundsApplication,
|
|
17
|
+
testRepeatedLockUnlockAcrossHingePoses, and testRotationOnSelectedDuoDisplay.
|
|
18
|
+
Physical-device Home, lock/unlock, and rotation behavior require verification.
|
|
19
|
+
|
|
20
|
+
Once all paths are obsolete, remove the FBHIDOperations branches and imports from
|
|
21
|
+
XCUIDevice+FBHelpers.m and XCUIDevice+FBRotation.m, then delete this module and its
|
|
22
|
+
Xcode project entries. Hinge control in XCUIDevice+FBHinge is independent.
|
|
23
|
+
|
|
24
|
+
Tracking: https://github.com/appium/appium/issues/22857
|
|
25
|
+
Rotation: https://github.com/appium/appium-ios/pull/81
|
|
26
|
+
*/
|
|
27
|
+
@interface FBHIDOperations : NSObject
|
|
28
|
+
|
|
29
|
+
// All operations apply to hinged iOS devices, including physical devices.
|
|
30
|
+
+ (BOOL)appliesToDevice:(XCUIDevice *)device;
|
|
31
|
+
|
|
32
|
+
#if !TARGET_OS_TV && !TARGET_OS_WATCH
|
|
33
|
+
// Call only after the corresponding applicability check succeeds.
|
|
34
|
+
+ (BOOL)pressHomeWithError:(NSError **)error;
|
|
35
|
+
+ (BOOL)pressLockWithError:(NSError **)error;
|
|
36
|
+
// interfaceOrientation is the UIKit equivalent of the requested device orientation.
|
|
37
|
+
+ (BOOL)rotateToOrientation:(UIDeviceOrientation)orientation
|
|
38
|
+
interfaceOrientation:(UIInterfaceOrientation)interfaceOrientation;
|
|
39
|
+
#endif
|
|
40
|
+
|
|
41
|
+
@end
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2015-present, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the BSD-style license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
#import "FBHIDOperations.h"
|
|
10
|
+
|
|
11
|
+
#import <dlfcn.h>
|
|
12
|
+
#import <mach/mach_time.h>
|
|
13
|
+
|
|
14
|
+
#import "FBConfiguration.h"
|
|
15
|
+
#import "FBErrorBuilder.h"
|
|
16
|
+
#import "FBLogger.h"
|
|
17
|
+
#import "FBRunLoopSpinner.h"
|
|
18
|
+
#import "FBScreen.h"
|
|
19
|
+
#import "FBSession.h"
|
|
20
|
+
#import "XCUIScreen.h"
|
|
21
|
+
#import "XCUIDevice+FBHinge.h"
|
|
22
|
+
#import "XCUIApplication.h"
|
|
23
|
+
#import "XCUIApplication+FBHelpers.h"
|
|
24
|
+
#import "XCUIElement+FBUtilities.h"
|
|
25
|
+
|
|
26
|
+
#if !TARGET_OS_TV && !TARGET_OS_WATCH
|
|
27
|
+
|
|
28
|
+
static const uint32_t FBHIDConsumerUsagePage = 0x0C;
|
|
29
|
+
static const uint32_t FBHIDHomeUsage = 0x40;
|
|
30
|
+
static const uint32_t FBHIDPowerUsage = 0x30;
|
|
31
|
+
static const uint32_t FBHIDOrientationUsagePage = 0xff61;
|
|
32
|
+
static const uint32_t FBHIDOrientationUsage = 0x5b;
|
|
33
|
+
static const CFOptionFlags FBHIDBinarySerialization = 1;
|
|
34
|
+
static const NSTimeInterval FBHIDButtonPressDuration = 0.03;
|
|
35
|
+
static const NSTimeInterval FBHIDRotationTimeout = 5.0;
|
|
36
|
+
|
|
37
|
+
typedef struct {
|
|
38
|
+
CFTypeRef (*createKeyboardEvent)(CFAllocatorRef, uint64_t, uint32_t, uint32_t, Boolean, uint32_t);
|
|
39
|
+
CFTypeRef (*createVendorEvent)(CFAllocatorRef, uint64_t, uint32_t, uint32_t,
|
|
40
|
+
uint32_t, uint8_t *, CFIndex, uint32_t);
|
|
41
|
+
CFTypeRef (*createClient)(CFAllocatorRef);
|
|
42
|
+
void (*dispatchEvent)(CFTypeRef, CFTypeRef);
|
|
43
|
+
void (*setTimestamp)(CFTypeRef, uint64_t);
|
|
44
|
+
CFDataRef (*serialize)(CFTypeRef, CFOptionFlags);
|
|
45
|
+
} FBHIDAPI;
|
|
46
|
+
|
|
47
|
+
static const FBHIDAPI *FBGetHIDAPI(void)
|
|
48
|
+
{
|
|
49
|
+
static FBHIDAPI api;
|
|
50
|
+
static dispatch_once_t onceToken;
|
|
51
|
+
dispatch_once(&onceToken, ^{
|
|
52
|
+
// Keep the framework loaded for the lifetime of the cached function pointers.
|
|
53
|
+
void *handle = dlopen("/System/Library/Frameworks/IOKit.framework/IOKit", RTLD_LAZY);
|
|
54
|
+
if (NULL == handle) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
api.createKeyboardEvent = (CFTypeRef (*)(CFAllocatorRef, uint64_t, uint32_t, uint32_t, Boolean, uint32_t))
|
|
58
|
+
dlsym(handle, "IOHIDEventCreateKeyboardEvent");
|
|
59
|
+
api.createVendorEvent = (CFTypeRef (*)(CFAllocatorRef, uint64_t, uint32_t, uint32_t,
|
|
60
|
+
uint32_t, uint8_t *, CFIndex, uint32_t))
|
|
61
|
+
dlsym(handle, "IOHIDEventCreateVendorDefinedEvent");
|
|
62
|
+
api.createClient = (CFTypeRef (*)(CFAllocatorRef))dlsym(handle, "IOHIDEventSystemClientCreate");
|
|
63
|
+
api.dispatchEvent = (void (*)(CFTypeRef, CFTypeRef))dlsym(handle, "IOHIDEventSystemClientDispatchEvent");
|
|
64
|
+
api.setTimestamp = (void (*)(CFTypeRef, uint64_t))dlsym(handle, "IOHIDEventSetTimeStamp");
|
|
65
|
+
api.serialize = (CFDataRef (*)(CFTypeRef, CFOptionFlags))dlsym(handle, "IOCFSerialize");
|
|
66
|
+
});
|
|
67
|
+
// Each operation checks only the symbols it needs.
|
|
68
|
+
return &api;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
static void FBLogUnverifiedPhysicalHIDOperation(NSString *operation)
|
|
72
|
+
{
|
|
73
|
+
#if !TARGET_OS_SIMULATOR
|
|
74
|
+
[FBLogger logFmt:@"HID %@ on physical hinged devices: not verified yet.", operation];
|
|
75
|
+
#endif
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
static BOOL FBWaitForStableInterfaceOrientation(XCUIApplication *application,
|
|
79
|
+
UIInterfaceOrientation orientation)
|
|
80
|
+
{
|
|
81
|
+
[application fb_waitUntilStableWithTimeout:FBConfiguration.sharedInstance.animationCoolOffTimeout];
|
|
82
|
+
return application.interfaceOrientation == orientation;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Workaround tracked in https://github.com/appium/appium/issues/22857.
|
|
86
|
+
// Reproduced on the iOS 27.1 Duo simulator with Xcode 27.1: XCTest's Home
|
|
87
|
+
// request returns without backgrounding the app. This direct HID path is also
|
|
88
|
+
// enabled on physical hinged devices, but Home behavior there is unverified.
|
|
89
|
+
// The affected Xcode/runtime version range has not been established. Remove
|
|
90
|
+
// the Home workaround when XCTest-only presses pass testHomeButtonBackgroundsApplication
|
|
91
|
+
// on supported Duo environments, including physical devices and both panels.
|
|
92
|
+
static BOOL FBPressHIDButton(uint32_t usage, NSError **error)
|
|
93
|
+
{
|
|
94
|
+
const FBHIDAPI *api = FBGetHIDAPI();
|
|
95
|
+
if (NULL == api->createKeyboardEvent || NULL == api->createClient
|
|
96
|
+
|| NULL == api->dispatchEvent || NULL == api->setTimestamp) {
|
|
97
|
+
return [[FBErrorBuilder.builder withDescription:@"The button HID APIs are unavailable"] buildError:error];
|
|
98
|
+
}
|
|
99
|
+
CFTypeRef client = api->createClient(kCFAllocatorDefault);
|
|
100
|
+
CFTypeRef down = api->createKeyboardEvent(kCFAllocatorDefault, mach_absolute_time(),
|
|
101
|
+
FBHIDConsumerUsagePage, usage, YES, 0);
|
|
102
|
+
CFTypeRef up = api->createKeyboardEvent(kCFAllocatorDefault, mach_absolute_time(),
|
|
103
|
+
FBHIDConsumerUsagePage, usage, NO, 0);
|
|
104
|
+
BOOL ready = NULL != client && NULL != down && NULL != up;
|
|
105
|
+
if (ready) {
|
|
106
|
+
// Dispatch a short paired press. Holding Power for 0.5s invokes Siri on Duo.
|
|
107
|
+
api->dispatchEvent(client, down);
|
|
108
|
+
[NSThread sleepForTimeInterval:FBHIDButtonPressDuration];
|
|
109
|
+
api->setTimestamp(up, mach_absolute_time());
|
|
110
|
+
api->dispatchEvent(client, up);
|
|
111
|
+
}
|
|
112
|
+
if (NULL != down) {
|
|
113
|
+
CFRelease(down);
|
|
114
|
+
}
|
|
115
|
+
if (NULL != up) {
|
|
116
|
+
CFRelease(up);
|
|
117
|
+
}
|
|
118
|
+
if (NULL != client) {
|
|
119
|
+
CFRelease(client);
|
|
120
|
+
}
|
|
121
|
+
return ready || [[FBErrorBuilder.builder
|
|
122
|
+
withDescription:@"Cannot create the button HID event or client"] buildError:error];
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Work around XCTest updating Duo device orientation without rotating the app.
|
|
126
|
+
// Reproduction details and checks required before removing this workaround:
|
|
127
|
+
// https://github.com/appium/appium-ios/pull/81
|
|
128
|
+
static BOOL FBDispatchHIDOrientation(UIDeviceOrientation orientation)
|
|
129
|
+
{
|
|
130
|
+
XCUIScreen *screen = [FBScreen currentScreenWithError:nil];
|
|
131
|
+
if (nil == screen) {
|
|
132
|
+
return NO;
|
|
133
|
+
}
|
|
134
|
+
// The inner panel's native orientation is a quarter turn from the cover.
|
|
135
|
+
// Values match DeviceKit's orientation-picker-control (Xcode 27.1).
|
|
136
|
+
NSString *value;
|
|
137
|
+
switch (orientation) {
|
|
138
|
+
case UIDeviceOrientationPortrait:
|
|
139
|
+
value = screen.isMainScreen ? @"portrait" : @"landscape-left";
|
|
140
|
+
break;
|
|
141
|
+
case UIDeviceOrientationLandscapeLeft:
|
|
142
|
+
value = screen.isMainScreen ? @"landscape-left" : @"pud";
|
|
143
|
+
break;
|
|
144
|
+
case UIDeviceOrientationLandscapeRight:
|
|
145
|
+
value = screen.isMainScreen ? @"landscape-right" : @"portrait";
|
|
146
|
+
break;
|
|
147
|
+
case UIDeviceOrientationPortraitUpsideDown:
|
|
148
|
+
value = screen.isMainScreen ? @"pud" : @"landscape-right";
|
|
149
|
+
break;
|
|
150
|
+
case UIDeviceOrientationUnknown:
|
|
151
|
+
case UIDeviceOrientationFaceUp:
|
|
152
|
+
case UIDeviceOrientationFaceDown:
|
|
153
|
+
default:
|
|
154
|
+
return NO;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const FBHIDAPI *api = FBGetHIDAPI();
|
|
158
|
+
if (NULL == api->serialize || NULL == api->createVendorEvent
|
|
159
|
+
|| NULL == api->createClient || NULL == api->dispatchEvent) {
|
|
160
|
+
return NO;
|
|
161
|
+
}
|
|
162
|
+
NSDictionary *payload = @{
|
|
163
|
+
@"provider": @"com.apple.Virtualization.VirtualMachines",
|
|
164
|
+
@"source": @"orientation-picker-control",
|
|
165
|
+
@"type": @"enum",
|
|
166
|
+
@"value": value,
|
|
167
|
+
};
|
|
168
|
+
// The receiver expects IOCF binary serialization, not a binary plist.
|
|
169
|
+
CFDataRef data = api->serialize((__bridge CFTypeRef)payload, FBHIDBinarySerialization);
|
|
170
|
+
if (NULL == data) {
|
|
171
|
+
return NO;
|
|
172
|
+
}
|
|
173
|
+
CFTypeRef event = api->createVendorEvent(kCFAllocatorDefault, mach_absolute_time(),
|
|
174
|
+
FBHIDOrientationUsagePage, FBHIDOrientationUsage, 0,
|
|
175
|
+
(uint8_t *)CFDataGetBytePtr(data), CFDataGetLength(data), 0);
|
|
176
|
+
CFRelease(data);
|
|
177
|
+
CFTypeRef client = api->createClient(kCFAllocatorDefault);
|
|
178
|
+
BOOL canDispatch = NULL != event && NULL != client;
|
|
179
|
+
if (canDispatch) {
|
|
180
|
+
api->dispatchEvent(client, event);
|
|
181
|
+
}
|
|
182
|
+
if (NULL != event) {
|
|
183
|
+
CFRelease(event);
|
|
184
|
+
}
|
|
185
|
+
if (NULL != client) {
|
|
186
|
+
CFRelease(client);
|
|
187
|
+
}
|
|
188
|
+
return canDispatch;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
#endif
|
|
192
|
+
|
|
193
|
+
@implementation FBHIDOperations
|
|
194
|
+
|
|
195
|
+
+ (BOOL)appliesToDevice:(XCUIDevice *)device
|
|
196
|
+
{
|
|
197
|
+
#if !TARGET_OS_TV && !TARGET_OS_WATCH
|
|
198
|
+
return device.fb_supportsHingeAngleReading;
|
|
199
|
+
#else
|
|
200
|
+
return NO;
|
|
201
|
+
#endif
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
#if !TARGET_OS_TV && !TARGET_OS_WATCH
|
|
205
|
+
+ (BOOL)pressHomeWithError:(NSError **)error
|
|
206
|
+
{
|
|
207
|
+
FBLogUnverifiedPhysicalHIDOperation(@"Home");
|
|
208
|
+
return FBPressHIDButton(FBHIDHomeUsage, error);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
+ (BOOL)pressLockWithError:(NSError **)error
|
|
212
|
+
{
|
|
213
|
+
FBLogUnverifiedPhysicalHIDOperation(@"lock");
|
|
214
|
+
// XCTest locking times out on Duo / iOS 27.1 (Xcode 27.1). Remove this
|
|
215
|
+
// workaround once XCTest alone passes testRepeatedLockUnlockAcrossHingePoses.
|
|
216
|
+
return FBPressHIDButton(FBHIDPowerUsage, error);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
+ (BOOL)rotateToOrientation:(UIDeviceOrientation)orientation
|
|
220
|
+
interfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
|
|
221
|
+
{
|
|
222
|
+
FBLogUnverifiedPhysicalHIDOperation(@"rotation");
|
|
223
|
+
XCUIApplication *application = XCUIApplication.fb_activeApplication;
|
|
224
|
+
// Point-based detection can select the cover SpringBoard while the app
|
|
225
|
+
// is on the inner panel. Prefer the session's active application.
|
|
226
|
+
application = FBSession.activeSession.activeApplication ?: application;
|
|
227
|
+
// Keep XCTest's reported device orientation in sync on the simulator too.
|
|
228
|
+
[XCUIDevice sharedDevice].orientation = orientation;
|
|
229
|
+
// On Duo simulators XCTest can update its value without rotating the app.
|
|
230
|
+
// Use the same direct HID path on simulators and physical hinged devices.
|
|
231
|
+
if (!FBDispatchHIDOrientation(orientation)) {
|
|
232
|
+
return NO;
|
|
233
|
+
}
|
|
234
|
+
// Event dispatch is asynchronous. Check the app, not just XCTest's value.
|
|
235
|
+
if (![[[FBRunLoopSpinner new] timeout:FBHIDRotationTimeout] spinUntilTrue:^BOOL{
|
|
236
|
+
return application.interfaceOrientation == interfaceOrientation;
|
|
237
|
+
}]) {
|
|
238
|
+
return NO;
|
|
239
|
+
}
|
|
240
|
+
return FBWaitForStableInterfaceOrientation(application, interfaceOrientation);
|
|
241
|
+
}
|
|
242
|
+
#endif
|
|
243
|
+
|
|
244
|
+
@end
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appium-webdriveragent",
|
|
3
|
-
"version": "16.16.
|
|
3
|
+
"version": "16.16.5",
|
|
4
4
|
"description": "Package bundling WebDriverAgent",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Appium",
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"node": "^20.19.0 || ^22.12.0 || >=24.0.0",
|
|
86
86
|
"npm": ">=10"
|
|
87
87
|
},
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "7585a1f072ba795cf923708e91db890ef3a2dfb4"
|
|
89
89
|
}
|