appium-webdriveragent 16.16.3 → 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 +15 -0
- package/WebDriverAgent.xcodeproj/project.pbxproj +16 -0
- package/WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m +40 -20
- package/WebDriverAgentLib/Categories/XCUIDevice+FBRotation.m +8 -3
- package/WebDriverAgentLib/Info.plist +2 -2
- package/WebDriverAgentLib/Utilities/FBHIDOperations.h +41 -0
- package/WebDriverAgentLib/Utilities/FBHIDOperations.m +244 -0
- package/WebDriverAgentTests/IntegrationApp/Classes/ViewController.m +11 -7
- package/WebDriverAgentTests/IntegrationTests/XCUIDeviceHelperTests.m +97 -0
- package/WebDriverAgentTests/IntegrationTests/XCUIDeviceRotationTests.m +53 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,21 @@
|
|
|
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
|
+
|
|
13
|
+
## [16.16.4](https://github.com/appium/appium-ios/compare/appium-webdriveragent@16.16.3...appium-webdriveragent@16.16.4) (2026-10-21)
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **webdriveragent:** dispatch Home button HID events on Duo simulators ([#78](https://github.com/appium/appium-ios/issues/78)) ([19ce62f](https://github.com/appium/appium-ios/commit/19ce62f69b657e5b0fe2f7f74545c56f9631beb6)), closes [#85](https://github.com/appium/appium-ios/issues/85)
|
|
18
|
+
* **webdriveragent:** fall back to vendor HID events for Duo rotation ([#81](https://github.com/appium/appium-ios/issues/81)) ([71d1ae0](https://github.com/appium/appium-ios/commit/71d1ae01dd1cea5b85063ed74c1b51f02134c6c5))
|
|
19
|
+
|
|
20
|
+
|
|
6
21
|
## [16.16.3](https://github.com/appium/appium-ios/compare/appium-webdriveragent@16.16.2...appium-webdriveragent@16.16.3) (2026-10-19)
|
|
7
22
|
|
|
8
23
|
### 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 */,
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
#include <notify.h>
|
|
14
14
|
#import <objc/runtime.h>
|
|
15
15
|
|
|
16
|
+
#import "FBHIDOperations.h"
|
|
16
17
|
#import "FBErrorBuilder.h"
|
|
17
18
|
#import "FBImageUtils.h"
|
|
18
19
|
#import "FBMacros.h"
|
|
@@ -199,23 +200,32 @@ static bool fb_isLocked;
|
|
|
199
200
|
if (fb_isLocked) {
|
|
200
201
|
return YES;
|
|
201
202
|
}
|
|
202
|
-
#if
|
|
203
|
-
[self
|
|
204
|
-
|
|
205
|
-
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"27.0")) {
|
|
206
|
-
// iOS 27: pressLockButton no longer locks; use a short IOHID Power press.
|
|
207
|
-
// A 0.5s hold can invoke Siri instead of locking the screen.
|
|
208
|
-
const NSTimeInterval duration = 0.2;
|
|
209
|
-
if (![self fb_performIOHIDEventWithPage:0x0C
|
|
210
|
-
usage:0x30
|
|
211
|
-
duration:duration
|
|
212
|
-
error:error]) {
|
|
203
|
+
#if !TARGET_OS_TV && !TARGET_OS_WATCH
|
|
204
|
+
if ([FBHIDOperations appliesToDevice:self]) {
|
|
205
|
+
if (![FBHIDOperations pressLockWithError:error]) {
|
|
213
206
|
return NO;
|
|
214
207
|
}
|
|
215
|
-
} else
|
|
208
|
+
} else
|
|
209
|
+
#endif
|
|
210
|
+
{
|
|
211
|
+
#if TARGET_OS_SIMULATOR
|
|
216
212
|
[self pressLockButton];
|
|
217
|
-
|
|
213
|
+
#else
|
|
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];
|
|
226
|
+
}
|
|
218
227
|
#endif
|
|
228
|
+
}
|
|
219
229
|
return [[[[FBRunLoopSpinner new]
|
|
220
230
|
timeout:FBScreenLockTimeout]
|
|
221
231
|
timeoutErrorMessage:@"Timed out while waiting until the screen gets locked"]
|
|
@@ -234,14 +244,19 @@ static bool fb_isLocked;
|
|
|
234
244
|
if (!fb_isLocked) {
|
|
235
245
|
return YES;
|
|
236
246
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
247
|
+
for (NSUInteger attempt = 0; attempt < 2; attempt++) {
|
|
248
|
+
#if !TARGET_OS_TV && !TARGET_OS_WATCH
|
|
249
|
+
if ([FBHIDOperations appliesToDevice:self]) {
|
|
250
|
+
if (![FBHIDOperations pressHomeWithError:error]) {
|
|
251
|
+
return NO;
|
|
252
|
+
}
|
|
253
|
+
} else
|
|
243
254
|
#endif
|
|
244
|
-
|
|
255
|
+
{
|
|
256
|
+
[self pressButton:XCUIDeviceButtonHome];
|
|
257
|
+
}
|
|
258
|
+
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:FBHomeButtonCoolOffTime]];
|
|
259
|
+
}
|
|
245
260
|
return [[[[FBRunLoopSpinner new]
|
|
246
261
|
timeout:FBScreenLockTimeout]
|
|
247
262
|
timeoutErrorMessage:@"Timed out while waiting until the screen gets unlocked"]
|
|
@@ -408,6 +423,11 @@ static bool fb_isLocked;
|
|
|
408
423
|
withDescriptionFormat:@"The button '%@' is not supported. The device under test only supports the following buttons: %@", buttonName, sortedKeys]
|
|
409
424
|
buildError:error];
|
|
410
425
|
}
|
|
426
|
+
#if !TARGET_OS_TV && !TARGET_OS_WATCH
|
|
427
|
+
if (buttonValue.unsignedIntegerValue == XCUIDeviceButtonHome && [FBHIDOperations appliesToDevice:self]) {
|
|
428
|
+
return [FBHIDOperations pressHomeWithError:error];
|
|
429
|
+
}
|
|
430
|
+
#endif
|
|
411
431
|
[self pressButton:(XCUIDeviceButton)[buttonValue unsignedIntegerValue]];
|
|
412
432
|
return YES;
|
|
413
433
|
}
|
|
@@ -9,16 +9,23 @@
|
|
|
9
9
|
#import "XCUIDevice+FBRotation.h"
|
|
10
10
|
|
|
11
11
|
#import "FBConfiguration.h"
|
|
12
|
+
#import "FBHIDOperations.h"
|
|
12
13
|
#import "XCUIApplication.h"
|
|
13
14
|
#import "XCUIApplication+FBHelpers.h"
|
|
14
15
|
#import "XCUIElement+FBUtilities.h"
|
|
15
16
|
|
|
16
17
|
# if !TARGET_OS_TV && !TARGET_OS_WATCH
|
|
17
18
|
|
|
19
|
+
static UIInterfaceOrientation FBInterfaceOrientationFromDeviceOrientation(UIDeviceOrientation orientation);
|
|
20
|
+
|
|
18
21
|
@implementation XCUIDevice (FBRotation)
|
|
19
22
|
|
|
20
23
|
- (BOOL)fb_setDeviceInterfaceOrientation:(UIDeviceOrientation)orientation
|
|
21
24
|
{
|
|
25
|
+
if ([FBHIDOperations appliesToDevice:self]) {
|
|
26
|
+
return [FBHIDOperations rotateToOrientation:orientation
|
|
27
|
+
interfaceOrientation:FBInterfaceOrientationFromDeviceOrientation(orientation)];
|
|
28
|
+
}
|
|
22
29
|
XCUIApplication *application = XCUIApplication.fb_activeApplication;
|
|
23
30
|
[XCUIDevice sharedDevice].orientation = orientation;
|
|
24
31
|
return [self waitUntilInterfaceIsAtOrientation:orientation application:application];
|
|
@@ -31,9 +38,7 @@
|
|
|
31
38
|
return NO;
|
|
32
39
|
}
|
|
33
40
|
UIDeviceOrientation orientation = (UIDeviceOrientation)keysForRotationObj.firstObject.integerValue;
|
|
34
|
-
|
|
35
|
-
[XCUIDevice sharedDevice].orientation = orientation;
|
|
36
|
-
return [self waitUntilInterfaceIsAtOrientation:orientation application:application];
|
|
41
|
+
return [self fb_setDeviceInterfaceOrientation:orientation];
|
|
37
42
|
}
|
|
38
43
|
|
|
39
44
|
static UIInterfaceOrientation FBInterfaceOrientationFromDeviceOrientation(UIDeviceOrientation orientation)
|
|
@@ -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
|
|
@@ -111,10 +111,20 @@
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
#if !TARGET_OS_TV
|
|
114
|
+
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
|
|
115
|
+
{
|
|
116
|
+
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
|
|
117
|
+
[coordinator animateAlongsideTransition:nil completion:^(id<UIViewControllerTransitionCoordinatorContext> context) {
|
|
118
|
+
// A 180-degree rotation can leave bounds unchanged. Read the scene after
|
|
119
|
+
// the transition as well as during layout.
|
|
120
|
+
[self updateOrentationLabel];
|
|
121
|
+
}];
|
|
122
|
+
}
|
|
123
|
+
|
|
114
124
|
- (void)updateOrentationLabel
|
|
115
125
|
{
|
|
116
126
|
NSString *orientation = nil;
|
|
117
|
-
switch (
|
|
127
|
+
switch (self.view.window.windowScene.interfaceOrientation) {
|
|
118
128
|
case UIInterfaceOrientationPortrait:
|
|
119
129
|
orientation = @"Portrait";
|
|
120
130
|
break;
|
|
@@ -127,12 +137,6 @@
|
|
|
127
137
|
case UIInterfaceOrientationLandscapeRight:
|
|
128
138
|
orientation = @"LandscapeRight";
|
|
129
139
|
break;
|
|
130
|
-
case UIDeviceOrientationFaceUp:
|
|
131
|
-
orientation = @"FaceUp";
|
|
132
|
-
break;
|
|
133
|
-
case UIDeviceOrientationFaceDown:
|
|
134
|
-
orientation = @"FaceDown";
|
|
135
|
-
break;
|
|
136
140
|
case UIInterfaceOrientationUnknown:
|
|
137
141
|
orientation = @"Unknown";
|
|
138
142
|
break;
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
#import <XCTest/XCTest.h>
|
|
10
|
+
#import <math.h>
|
|
10
11
|
|
|
11
12
|
#import "FBIntegrationTestCase.h"
|
|
12
13
|
#import "FBImageUtils.h"
|
|
@@ -15,6 +16,7 @@
|
|
|
15
16
|
#import "XCUIApplication.h"
|
|
16
17
|
#import "XCUIApplication+FBHelpers.h"
|
|
17
18
|
#import "XCUIDevice+FBHelpers.h"
|
|
19
|
+
#import "XCUIDevice+FBHinge.h"
|
|
18
20
|
#import "XCUIDevice+FBRotation.h"
|
|
19
21
|
#import "XCUIScreen.h"
|
|
20
22
|
|
|
@@ -104,6 +106,53 @@
|
|
|
104
106
|
FBAssertWaitTillBecomesTrue([XCUIApplication fb_activeApplication].icons[@"Safari"].exists);
|
|
105
107
|
}
|
|
106
108
|
|
|
109
|
+
- (void)testHomeButtonBackgroundsApplication
|
|
110
|
+
{
|
|
111
|
+
XCUIDevice *device = XCUIDevice.sharedDevice;
|
|
112
|
+
BOOL hasHinge = NO;
|
|
113
|
+
#if TARGET_OS_SIMULATOR
|
|
114
|
+
hasHinge = device.fb_canAttemptSimulatedHingeAngleInjection;
|
|
115
|
+
#endif
|
|
116
|
+
NSNumber *originalAngle = hasHinge ? [device fb_getSimulatedHingeAngle:nil] : nil;
|
|
117
|
+
if (hasHinge && nil == originalAngle) {
|
|
118
|
+
XCTFail(@"Cannot read the original hinge angle");
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
BOOL (^setAngleAndWait)(NSNumber *) = ^BOOL(NSNumber *angle) {
|
|
122
|
+
return [device fb_setSimulatedHingeAngle:angle.doubleValue error:nil]
|
|
123
|
+
&& [[[FBRunLoopSpinner new] timeout:5] spinUntilTrue:^BOOL{
|
|
124
|
+
NSNumber *reading = [device fb_getSimulatedHingeAngle:nil];
|
|
125
|
+
return nil != reading && fabs(reading.doubleValue - angle.doubleValue) < 1;
|
|
126
|
+
}];
|
|
127
|
+
};
|
|
128
|
+
@try {
|
|
129
|
+
for (NSNumber *angle in (hasHinge ? @[@0, @180] : @[@0])) {
|
|
130
|
+
if (hasHinge) {
|
|
131
|
+
if (!setAngleAndWait(angle)) {
|
|
132
|
+
XCTFail(@"Hinge angle did not reach %@", angle);
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
for (NSUInteger attempt = 0; attempt < 2; attempt++) {
|
|
137
|
+
[self.testedApplication activate];
|
|
138
|
+
XCTAssertEqual(self.testedApplication.state, XCUIApplicationStateRunningForeground);
|
|
139
|
+
NSError *error = nil;
|
|
140
|
+
XCTAssertTrue([device fb_pressButton:@"home" forDuration:nil error:&error]);
|
|
141
|
+
XCTAssertNil(error);
|
|
142
|
+
XCTAssertTrue([[[FBRunLoopSpinner new] timeout:5] spinUntilTrue:^BOOL{
|
|
143
|
+
return self.testedApplication.state == XCUIApplicationStateRunningBackground
|
|
144
|
+
|| self.testedApplication.state == XCUIApplicationStateRunningBackgroundSuspended;
|
|
145
|
+
}]);
|
|
146
|
+
XCTAssertTrue([XCUIApplication.fb_activeApplication.bundleID isEqualToString:@"com.apple.springboard"]);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
} @finally {
|
|
150
|
+
if (nil != originalAngle) {
|
|
151
|
+
XCTAssertTrue(setAngleAndWait(originalAngle));
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
107
156
|
- (void)testLockUnlockScreen
|
|
108
157
|
{
|
|
109
158
|
XCTAssertFalse([[XCUIDevice sharedDevice] fb_isScreenLocked]);
|
|
@@ -116,6 +165,54 @@
|
|
|
116
165
|
XCTAssertNil(error);
|
|
117
166
|
}
|
|
118
167
|
|
|
168
|
+
- (void)testRepeatedLockUnlockAcrossHingePoses
|
|
169
|
+
{
|
|
170
|
+
XCTSkipIf(self.class.isRunningInCI, @"Repeated lock/unlock is unreliable on slow CI hosts");
|
|
171
|
+
XCUIDevice *device = XCUIDevice.sharedDevice;
|
|
172
|
+
BOOL hasHinge = NO;
|
|
173
|
+
#if TARGET_OS_SIMULATOR
|
|
174
|
+
hasHinge = device.fb_canAttemptSimulatedHingeAngleInjection;
|
|
175
|
+
#endif
|
|
176
|
+
NSNumber *originalAngle = hasHinge ? [device fb_getSimulatedHingeAngle:nil] : nil;
|
|
177
|
+
if (hasHinge) {
|
|
178
|
+
XCTAssertNotNil(originalAngle);
|
|
179
|
+
}
|
|
180
|
+
BOOL (^setAngleAndWait)(NSNumber *) = ^BOOL(NSNumber *angle) {
|
|
181
|
+
return [device fb_setSimulatedHingeAngle:angle.doubleValue error:nil]
|
|
182
|
+
&& [[[FBRunLoopSpinner new] timeout:5] spinUntilTrue:^BOOL{
|
|
183
|
+
NSNumber *reading = [device fb_getSimulatedHingeAngle:nil];
|
|
184
|
+
return nil != reading && fabs(reading.doubleValue - angle.doubleValue) < 1;
|
|
185
|
+
}];
|
|
186
|
+
};
|
|
187
|
+
@try {
|
|
188
|
+
for (NSNumber *angle in (hasHinge ? @[@0, @90, @180] : @[@0])) {
|
|
189
|
+
if (hasHinge) {
|
|
190
|
+
XCTAssertTrue(setAngleAndWait(angle));
|
|
191
|
+
}
|
|
192
|
+
for (NSUInteger attempt = 0; attempt < 3; attempt++) {
|
|
193
|
+
XCTAssertFalse(device.fb_isScreenLocked);
|
|
194
|
+
NSError *error = nil;
|
|
195
|
+
XCTAssertTrue([device fb_lockScreen:&error]);
|
|
196
|
+
XCTAssertNil(error);
|
|
197
|
+
XCTAssertTrue(device.fb_isScreenLocked);
|
|
198
|
+
// Repeating lock must not toggle the screen back to unlocked.
|
|
199
|
+
XCTAssertTrue([device fb_lockScreen:&error]);
|
|
200
|
+
XCTAssertTrue(device.fb_isScreenLocked);
|
|
201
|
+
XCTAssertTrue([device fb_unlockScreen:&error]);
|
|
202
|
+
XCTAssertNil(error);
|
|
203
|
+
XCTAssertFalse(device.fb_isScreenLocked);
|
|
204
|
+
XCTAssertTrue([device fb_unlockScreen:&error]);
|
|
205
|
+
XCTAssertFalse(device.fb_isScreenLocked);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
} @finally {
|
|
209
|
+
[device fb_unlockScreen:nil];
|
|
210
|
+
if (nil != originalAngle) {
|
|
211
|
+
XCTAssertTrue(setAngleAndWait(originalAngle));
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
119
216
|
- (void)testUrlSchemeActivation
|
|
120
217
|
{
|
|
121
218
|
if (SYSTEM_VERSION_LESS_THAN(@"16.4")) {
|
|
@@ -10,8 +10,13 @@
|
|
|
10
10
|
#import <UIKit/UIKit.h>
|
|
11
11
|
#import "FBIntegrationTestCase.h"
|
|
12
12
|
#import "XCUIDevice+FBRotation.h"
|
|
13
|
+
#import "XCUIDevice+FBHinge.h"
|
|
14
|
+
#import "FBConfiguration.h"
|
|
15
|
+
#import "FBScreen.h"
|
|
16
|
+
#import "FBSession.h"
|
|
13
17
|
|
|
14
18
|
@interface XCUIDeviceRotationTests : FBIntegrationTestCase
|
|
19
|
+
@property (nonatomic, strong) FBSession *session;
|
|
15
20
|
|
|
16
21
|
@end
|
|
17
22
|
|
|
@@ -21,11 +26,13 @@
|
|
|
21
26
|
{
|
|
22
27
|
[super setUp];
|
|
23
28
|
[self launchApplication];
|
|
29
|
+
self.session = [FBSession initWithApplication:self.testedApplication];
|
|
24
30
|
}
|
|
25
31
|
|
|
26
32
|
- (void)tearDown
|
|
27
33
|
{
|
|
28
34
|
[self resetOrientation];
|
|
35
|
+
[self.session kill];
|
|
29
36
|
[super tearDown];
|
|
30
37
|
}
|
|
31
38
|
|
|
@@ -102,4 +109,50 @@
|
|
|
102
109
|
XCTAssertEqual(currentRotation, [XCUIDevice sharedDevice].orientation, @"Device doesnt support tilt, should be at previous orientation");
|
|
103
110
|
}
|
|
104
111
|
|
|
112
|
+
- (void)testRotationOnSelectedDuoDisplay
|
|
113
|
+
{
|
|
114
|
+
#if TARGET_OS_SIMULATOR
|
|
115
|
+
XCUIDevice *device = XCUIDevice.sharedDevice;
|
|
116
|
+
XCTSkipIf(!device.fb_supportsHingeAngleReading || !device.fb_canAttemptSimulatedHingeAngleInjection,
|
|
117
|
+
@"Requires hinge angle reading and injection support");
|
|
118
|
+
NSNumber *originalDisplay = FBConfiguration.sharedInstance.currentDisplayId;
|
|
119
|
+
NSNumber *originalAngle = [device fb_getSimulatedHingeAngle:nil];
|
|
120
|
+
XCTAssertNotNil(originalAngle);
|
|
121
|
+
@try {
|
|
122
|
+
for (NSNumber *angle in @[@0, @90, @180]) {
|
|
123
|
+
XCTAssertTrue([device fb_setSimulatedHingeAngle:angle.doubleValue error:nil]);
|
|
124
|
+
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:3]];
|
|
125
|
+
for (NSDictionary *screen in [FBScreen screensWithError:nil]) {
|
|
126
|
+
if ([screen[@"isMain"] boolValue] == (angle.intValue == 0)) {
|
|
127
|
+
FBConfiguration.sharedInstance.currentDisplayId = screen[@"displayId"];
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
[self.testedApplication activate];
|
|
131
|
+
NSArray *orientations = @[@(UIDeviceOrientationLandscapeLeft),
|
|
132
|
+
@(UIDeviceOrientationLandscapeRight),
|
|
133
|
+
@(UIDeviceOrientationPortrait)];
|
|
134
|
+
NSArray *labels = @[@"LandscapeRight", @"LandscapeLeft", @"Portrait"];
|
|
135
|
+
for (NSUInteger i = 0; i < orientations.count; i++) {
|
|
136
|
+
UIDeviceOrientation orientation = [orientations[i] integerValue];
|
|
137
|
+
XCTAssertTrue([device fb_setDeviceInterfaceOrientation:orientation]);
|
|
138
|
+
XCTAssertTrue([self.testedApplication.staticTexts[labels[i]] waitForExistenceWithTimeout:5]);
|
|
139
|
+
XCTAssertEqual(device.orientation, orientation);
|
|
140
|
+
}
|
|
141
|
+
BOOL rotated = [device fb_setDeviceRotation:@{@"x": @0, @"y": @0, @"z": @270}];
|
|
142
|
+
XCTAssertTrue(rotated);
|
|
143
|
+
XCTAssertTrue(self.testedApplication.staticTexts[@"LandscapeRight"].exists);
|
|
144
|
+
}
|
|
145
|
+
} @finally {
|
|
146
|
+
[device fb_setSimulatedHingeAngle:0 error:nil];
|
|
147
|
+
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:3]];
|
|
148
|
+
FBConfiguration.sharedInstance.currentDisplayId = nil;
|
|
149
|
+
[device fb_setDeviceInterfaceOrientation:UIDeviceOrientationPortrait];
|
|
150
|
+
if (nil != originalAngle) {
|
|
151
|
+
[device fb_setSimulatedHingeAngle:originalAngle.doubleValue error:nil];
|
|
152
|
+
}
|
|
153
|
+
FBConfiguration.sharedInstance.currentDisplayId = originalDisplay;
|
|
154
|
+
}
|
|
155
|
+
#endif
|
|
156
|
+
}
|
|
157
|
+
|
|
105
158
|
@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
|
}
|