appium-webdriveragent 17.0.11 → 17.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -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
+ ## [17.0.12](https://github.com/appium/appium-ios/compare/appium-webdriveragent@17.0.11...appium-webdriveragent@17.0.12) (2026-11-18)
7
+
8
+ ### Bug Fixes
9
+
10
+ * **webdriveragent:** preserve Duo rotation mapping when the main panel changes ([#156](https://github.com/appium/appium-ios/issues/156)) ([e96e24b](https://github.com/appium/appium-ios/commit/e96e24bca38997b115acabcae30c32a69821be86))
11
+
12
+
6
13
  ## [17.0.11](https://github.com/appium/appium-ios/compare/appium-webdriveragent@17.0.10...appium-webdriveragent@17.0.11) (2026-11-16)
7
14
 
8
15
  **Note:** Version bump only for package appium-webdriveragent
@@ -10,6 +10,7 @@
10
10
  005B327C702EF47820887884 /* FBErrorBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = EE3A18601CDE618F00DE4205 /* FBErrorBuilder.h */; };
11
11
  00ABDDC324B060006EA182F7 /* FBScreen.m in Sources */ = {isa = PBXBuildFile; fileRef = 715AFAC01FFA29180053896D /* FBScreen.m */; };
12
12
  8DF7FE0E7A32499BAA86C4E2 /* FBGestureCoordinateContext.m in Sources */ = {isa = PBXBuildFile; fileRef = 9279D81EB4894A61B2DAB7C8 /* FBGestureCoordinateContext.m */; };
13
+ 8A8F853BBC2D439DB661C6B7 /* FBHIDOperations+DuoRotation.m in Sources */ = {isa = PBXBuildFile; fileRef = B515633A5B3548FAAD6A0377 /* FBHIDOperations+DuoRotation.m */; };
13
14
  0161F45997A981E47729DB25 /* RouteResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 01E7CFEBAD717FCF4BCDD383 /* RouteResponse.h */; };
14
15
  01A6F9758F11F6EF5B495D97 /* XCTPromise.h in Headers */ = {isa = PBXBuildFile; fileRef = 2CA02992F03AE1E134F2CAF5 /* XCTPromise.h */; };
15
16
  01AC2C121519821EC6D2ED6B /* XCTMacCatalystStatusProviding-Protocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 42D2B5A0C490D9698C2A87A9 /* XCTMacCatalystStatusProviding-Protocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -350,6 +351,7 @@
350
351
  641EE6212240C5CA00173FCB /* FBElementTypeTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = EE9AB7901CAEDF0C008C271F /* FBElementTypeTransformer.m */; };
351
352
  641EE6232240C5CA00173FCB /* FBScreen.m in Sources */ = {isa = PBXBuildFile; fileRef = 715AFAC01FFA29180053896D /* FBScreen.m */; };
352
353
  33B06077BE1041969B44A01A /* FBGestureCoordinateContext.m in Sources */ = {isa = PBXBuildFile; fileRef = 9279D81EB4894A61B2DAB7C8 /* FBGestureCoordinateContext.m */; };
354
+ 5DE77FE43A684122AF635C8D /* FBHIDOperations+DuoRotation.m in Sources */ = {isa = PBXBuildFile; fileRef = B515633A5B3548FAAD6A0377 /* FBHIDOperations+DuoRotation.m */; };
353
355
  641EE6242240C5CA00173FCB /* FBXCTestDaemonsProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = EE35AD7A1E3B80C000A02D78 /* FBXCTestDaemonsProxy.m */; };
354
356
  641EE6262240C5CA00173FCB /* FBMathUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = EE1888391DA661C400307AA8 /* FBMathUtils.m */; };
355
357
  A8FC9D445C9947988C80AFC9 /* FBHIDOperations.m in Sources */ = {isa = PBXBuildFile; fileRef = 3975477AB6C14ABDBBDE3EAD /* FBHIDOperations.m */; };
@@ -357,6 +359,7 @@
357
359
  641EE6312240C5CA00173FCB /* XCUIElement+FBWebDriverAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = EEE376471D59FAE900ED88DD /* XCUIElement+FBWebDriverAttributes.h */; settings = {ATTRIBUTES = (Public, ); }; };
358
360
  641EE6322240C5CA00173FCB /* FBScreen.h in Headers */ = {isa = PBXBuildFile; fileRef = 715AFABF1FFA29180053896D /* FBScreen.h */; };
359
361
  ACF532F31E714D8F89FC1F14 /* FBGestureCoordinateContext.h in Headers */ = {isa = PBXBuildFile; fileRef = F719A8616C5A4FBFB5D71020 /* FBGestureCoordinateContext.h */; };
362
+ 70FB525D1BCD496A80BF3172 /* FBHIDOperations+DuoRotation.h in Headers */ = {isa = PBXBuildFile; fileRef = 111A6DC1E6DD4BF89EC1F601 /* FBHIDOperations+DuoRotation.h */; };
360
363
  641EE6332240C5CA00173FCB /* XCTestPrivateSymbols.h in Headers */ = {isa = PBXBuildFile; fileRef = EE6B64FB1D0F86EF00E85F5D /* XCTestPrivateSymbols.h */; };
361
364
  641EE6342240C5CA00173FCB /* XCUIElement+FBTyping.h in Headers */ = {isa = PBXBuildFile; fileRef = AD76723B1D6B7CC000610457 /* XCUIElement+FBTyping.h */; settings = {ATTRIBUTES = (Public, ); }; };
362
365
  641EE6352240C5CA00173FCB /* XCUIElement+FBUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = EEE3763F1D59F81400ED88DD /* XCUIElement+FBUtilities.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -591,8 +594,10 @@
591
594
  715A84D22DD92AD3007134CC /* FBElementHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = 715A84CD2DD92AD3007134CC /* FBElementHelpers.h */; };
592
595
  715AFAC11FFA29180053896D /* FBScreen.h in Headers */ = {isa = PBXBuildFile; fileRef = 715AFABF1FFA29180053896D /* FBScreen.h */; };
593
596
  6D35951C8DB84801B157C5A4 /* FBGestureCoordinateContext.h in Headers */ = {isa = PBXBuildFile; fileRef = F719A8616C5A4FBFB5D71020 /* FBGestureCoordinateContext.h */; };
597
+ C121C4B46B1E4D75BADE9B4C /* FBHIDOperations+DuoRotation.h in Headers */ = {isa = PBXBuildFile; fileRef = 111A6DC1E6DD4BF89EC1F601 /* FBHIDOperations+DuoRotation.h */; };
594
598
  715AFAC21FFA29180053896D /* FBScreen.m in Sources */ = {isa = PBXBuildFile; fileRef = 715AFAC01FFA29180053896D /* FBScreen.m */; };
595
599
  3EC777E4AE2944C2998E2626 /* FBGestureCoordinateContext.m in Sources */ = {isa = PBXBuildFile; fileRef = 9279D81EB4894A61B2DAB7C8 /* FBGestureCoordinateContext.m */; };
600
+ B3268698DC4F44D38FB8B32F /* FBHIDOperations+DuoRotation.m in Sources */ = {isa = PBXBuildFile; fileRef = B515633A5B3548FAAD6A0377 /* FBHIDOperations+DuoRotation.m */; };
596
601
  715AFAC41FFA2AAF0053896D /* FBScreenTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 715AFAC31FFA2AAF0053896D /* FBScreenTests.m */; };
597
602
  8EB95DF348A9438BBEAB4501 /* FBDisplayGestureTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8EB95DF348A9438BBEAB4502 /* FBDisplayGestureTests.m */; };
598
603
  715D554B2229891B00524509 /* FBExceptionHandlerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 715D554A2229891B00524509 /* FBExceptionHandlerTests.m */; };
@@ -817,6 +822,7 @@
817
822
  932D338E506BD3EDDABBDEA9 /* XCTNSPredicateExpectationObject-Protocol.h in Headers */ = {isa = PBXBuildFile; fileRef = EE35ACEC1E3B77D600A02D78 /* XCTNSPredicateExpectationObject-Protocol.h */; };
818
823
  93D5C4C8442EFE91D70780CC /* FBScreen.h in Headers */ = {isa = PBXBuildFile; fileRef = 715AFABF1FFA29180053896D /* FBScreen.h */; };
819
824
  00E5348C6BD947E88C6B12A8 /* FBGestureCoordinateContext.h in Headers */ = {isa = PBXBuildFile; fileRef = F719A8616C5A4FBFB5D71020 /* FBGestureCoordinateContext.h */; };
825
+ F371783BD9E44E97B1920108 /* FBHIDOperations+DuoRotation.h in Headers */ = {isa = PBXBuildFile; fileRef = 111A6DC1E6DD4BF89EC1F601 /* FBHIDOperations+DuoRotation.h */; };
820
826
  9452D57FE97CB2ECED093B9F /* FBAccessibilityTraits.h in Headers */ = {isa = PBXBuildFile; fileRef = B316351E2DDF0D0B007D9317 /* FBAccessibilityTraits.h */; };
821
827
  9472D6847DFCF79A29E201A1 /* FBFailureProofTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = EE6A89391D0B38640083E92B /* FBFailureProofTestCase.m */; };
822
828
  94D6CDC7620D8C6E67BF2E61 /* XCTMessagingChannel_RunnerToIDE-Protocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 100F37231BF17CA9BB91DF16 /* XCTMessagingChannel_RunnerToIDE-Protocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -1641,8 +1647,10 @@
1641
1647
  715A84CE2DD92AD3007134CC /* FBElementHelpers.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FBElementHelpers.m; sourceTree = "<group>"; };
1642
1648
  715AFABF1FFA29180053896D /* FBScreen.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FBScreen.h; sourceTree = "<group>"; };
1643
1649
  F719A8616C5A4FBFB5D71020 /* FBGestureCoordinateContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FBGestureCoordinateContext.h; sourceTree = "<group>"; };
1650
+ 111A6DC1E6DD4BF89EC1F601 /* FBHIDOperations+DuoRotation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "FBHIDOperations+DuoRotation.h"; sourceTree = "<group>"; };
1644
1651
  715AFAC01FFA29180053896D /* FBScreen.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FBScreen.m; sourceTree = "<group>"; };
1645
1652
  9279D81EB4894A61B2DAB7C8 /* FBGestureCoordinateContext.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FBGestureCoordinateContext.m; sourceTree = "<group>"; };
1653
+ B515633A5B3548FAAD6A0377 /* FBHIDOperations+DuoRotation.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "FBHIDOperations+DuoRotation.m"; sourceTree = "<group>"; };
1646
1654
  715AFAC31FFA2AAF0053896D /* FBScreenTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FBScreenTests.m; sourceTree = "<group>"; };
1647
1655
  8EB95DF348A9438BBEAB4502 /* FBDisplayGestureTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FBDisplayGestureTests.m; sourceTree = "<group>"; };
1648
1656
  715D554A2229891B00524509 /* FBExceptionHandlerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FBExceptionHandlerTests.m; sourceTree = "<group>"; };
@@ -2652,8 +2660,10 @@
2652
2660
  71F3E7D725417FF400E0C22C /* FBSettingsHandler.m */,
2653
2661
  715AFABF1FFA29180053896D /* FBScreen.h */,
2654
2662
  F719A8616C5A4FBFB5D71020 /* FBGestureCoordinateContext.h */,
2663
+ 111A6DC1E6DD4BF89EC1F601 /* FBHIDOperations+DuoRotation.h */,
2655
2664
  715AFAC01FFA29180053896D /* FBScreen.m */,
2656
2665
  9279D81EB4894A61B2DAB7C8 /* FBGestureCoordinateContext.m */,
2666
+ B515633A5B3548FAAD6A0377 /* FBHIDOperations+DuoRotation.m */,
2657
2667
  71C9EAAA25E8415A00470CD8 /* FBScreenshot.h */,
2658
2668
  71C9EAAB25E8415A00470CD8 /* FBScreenshot.m */,
2659
2669
  641EE70A2240CE2D00173FCB /* FBTVNavigationTracker.h */,
@@ -3100,6 +3110,7 @@
3100
3110
  641EE6312240C5CA00173FCB /* XCUIElement+FBWebDriverAttributes.h in Headers */,
3101
3111
  641EE6322240C5CA00173FCB /* FBScreen.h in Headers */,
3102
3112
  ACF532F31E714D8F89FC1F14 /* FBGestureCoordinateContext.h in Headers */,
3113
+ 70FB525D1BCD496A80BF3172 /* FBHIDOperations+DuoRotation.h in Headers */,
3103
3114
  641EE6332240C5CA00173FCB /* XCTestPrivateSymbols.h in Headers */,
3104
3115
  641EE6342240C5CA00173FCB /* XCUIElement+FBTyping.h in Headers */,
3105
3116
  641EE6352240C5CA00173FCB /* XCUIElement+FBUtilities.h in Headers */,
@@ -3414,6 +3425,7 @@
3414
3425
  43EBA0D0D54EB99815CE63B6 /* XCUIElement+FBWebDriverAttributes.h in Headers */,
3415
3426
  93D5C4C8442EFE91D70780CC /* FBScreen.h in Headers */,
3416
3427
  00E5348C6BD947E88C6B12A8 /* FBGestureCoordinateContext.h in Headers */,
3428
+ F371783BD9E44E97B1920108 /* FBHIDOperations+DuoRotation.h in Headers */,
3417
3429
  B9FAD6E3F3AB201B59D6F8BD /* XCTestPrivateSymbols.h in Headers */,
3418
3430
  CDDEBD9F5F6A380C8D32D671 /* XCUIElement+FBTyping.h in Headers */,
3419
3431
  488C4CBD86EBFA2AB5396917 /* XCUIElement+FBUtilities.h in Headers */,
@@ -3683,6 +3695,7 @@
3683
3695
  EEE376491D59FAE900ED88DD /* XCUIElement+FBWebDriverAttributes.h in Headers */,
3684
3696
  715AFAC11FFA29180053896D /* FBScreen.h in Headers */,
3685
3697
  6D35951C8DB84801B157C5A4 /* FBGestureCoordinateContext.h in Headers */,
3698
+ C121C4B46B1E4D75BADE9B4C /* FBHIDOperations+DuoRotation.h in Headers */,
3686
3699
  EE6B64FD1D0F86EF00E85F5D /* XCTestPrivateSymbols.h in Headers */,
3687
3700
  AD76723D1D6B7CC000610457 /* XCUIElement+FBTyping.h in Headers */,
3688
3701
  EEE376451D59F81400ED88DD /* XCUIElement+FBUtilities.h in Headers */,
@@ -4594,6 +4607,7 @@
4594
4607
  13DE7A5E287CA444003243C6 /* FBXCElementSnapshotWrapper+Helpers.m in Sources */,
4595
4608
  641EE6232240C5CA00173FCB /* FBScreen.m in Sources */,
4596
4609
  33B06077BE1041969B44A01A /* FBGestureCoordinateContext.m in Sources */,
4610
+ 5DE77FE43A684122AF635C8D /* FBHIDOperations+DuoRotation.m in Sources */,
4597
4611
  71D04DCB25356C43008A052C /* XCUIElement+FBCaching.m in Sources */,
4598
4612
  641EE6242240C5CA00173FCB /* FBXCTestDaemonsProxy.m in Sources */,
4599
4613
  13DE7A58287CA1EC003243C6 /* FBXCElementSnapshotWrapper.m in Sources */,
@@ -4752,6 +4766,7 @@
4752
4766
  9F9218F11A1D06F8DCC8308B /* FBXCElementSnapshotWrapper+Helpers.m in Sources */,
4753
4767
  00ABDDC324B060006EA182F7 /* FBScreen.m in Sources */,
4754
4768
  8DF7FE0E7A32499BAA86C4E2 /* FBGestureCoordinateContext.m in Sources */,
4769
+ 8A8F853BBC2D439DB661C6B7 /* FBHIDOperations+DuoRotation.m in Sources */,
4755
4770
  486F5AEF3C385922994476CD /* XCUIElement+FBCaching.m in Sources */,
4756
4771
  92DC81D2F6E58386AC592482 /* FBXCTestDaemonsProxy.m in Sources */,
4757
4772
  4819BEAC415E02570C0FA074 /* FBXCElementSnapshotWrapper.m in Sources */,
@@ -4879,6 +4894,7 @@
4879
4894
  71D3B3D7267FC7260076473D /* XCUIElement+FBResolve.m in Sources */,
4880
4895
  715AFAC21FFA29180053896D /* FBScreen.m in Sources */,
4881
4896
  3EC777E4AE2944C2998E2626 /* FBGestureCoordinateContext.m in Sources */,
4897
+ B3268698DC4F44D38FB8B32F /* FBHIDOperations+DuoRotation.m in Sources */,
4882
4898
  71B155DC230711E900646AFB /* FBCommandStatus.m in Sources */,
4883
4899
  EE35AD7C1E3B80C000A02D78 /* FBXCTestDaemonsProxy.m in Sources */,
4884
4900
  EE18883B1DA661C400307AA8 /* FBMathUtils.m in Sources */,
@@ -15,11 +15,11 @@
15
15
  <key>CFBundlePackageType</key>
16
16
  <string>FMWK</string>
17
17
  <key>CFBundleShortVersionString</key>
18
- <string>17.0.11</string>
18
+ <string>17.0.12</string>
19
19
  <key>CFBundleSignature</key>
20
20
  <string>????</string>
21
21
  <key>CFBundleVersion</key>
22
- <string>17.0.11</string>
22
+ <string>17.0.12</string>
23
23
  <key>NSPrincipalClass</key>
24
24
  <string/>
25
25
  </dict>
@@ -0,0 +1,24 @@
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
+ @class XCUIScreen;
12
+
13
+ NS_ASSUME_NONNULL_BEGIN
14
+
15
+ #if !TARGET_OS_TV && !TARGET_OS_WATCH
16
+ @interface FBHIDOperations (DuoRotation)
17
+ /** Physical panel identity, or nil if Core Animation metadata does not identify it. */
18
+ + (nullable NSNumber *)isInnerDuoDisplay:(XCUIScreen *)screen;
19
+ /** Resolve the selected panel and map the requested orientation to its vendor HID value. */
20
+ + (nullable NSString *)duoOrientationValue:(UIDeviceOrientation)orientation;
21
+ @end
22
+ #endif
23
+
24
+ NS_ASSUME_NONNULL_END
@@ -0,0 +1,110 @@
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+DuoRotation.h"
10
+
11
+ #import "FBLogger.h"
12
+ #import "FBScreen.h"
13
+ #import "XCUIScreen.h"
14
+
15
+ #if !TARGET_OS_TV && !TARGET_OS_WATCH
16
+
17
+ // Private CADisplay device names observed on Duo simulators.
18
+ static NSString *const FBDuoCoverDisplayDeviceName = @"primary";
19
+ static NSString *const FBDuoInnerDisplayDeviceName = @"primary-1";
20
+
21
+ @protocol FBDuoPhysicalDisplay <NSObject>
22
+ @property (readonly) unsigned int displayId;
23
+ @property (readonly) NSString *deviceName;
24
+ @end
25
+
26
+ @protocol FBDuoDisplayProvider <NSObject>
27
+ + (NSArray<id<FBDuoPhysicalDisplay>> *)displays;
28
+ @end
29
+
30
+ @interface FBHIDOperations (DuoRotationPrivate)
31
+ + (nullable NSNumber *)isInnerDuoDisplay:(XCUIScreen *)screen
32
+ displays:(nullable NSArray<id<FBDuoPhysicalDisplay>> *)displays;
33
+ @end
34
+
35
+ @implementation FBHIDOperations (DuoRotation)
36
+
37
+ + (nullable NSNumber *)isInnerDuoDisplay:(XCUIScreen *)screen
38
+ {
39
+ // Physical panel identity survives changes to XCTest's main screen after folding.
40
+ Class<FBDuoDisplayProvider> displayClass = (Class)NSClassFromString(@"CADisplay");
41
+ NSArray<id<FBDuoPhysicalDisplay>> *displays = [displayClass respondsToSelector:@selector(displays)]
42
+ ? [displayClass displays] : nil;
43
+ return [self isInnerDuoDisplay:screen displays:displays];
44
+ }
45
+
46
+ + (nullable NSNumber *)isInnerDuoDisplay:(XCUIScreen *)screen
47
+ displays:(nullable NSArray<id<FBDuoPhysicalDisplay>> *)displays
48
+ {
49
+ for (id<FBDuoPhysicalDisplay> display in displays) {
50
+ if (![display respondsToSelector:@selector(displayId)]
51
+ || ![display respondsToSelector:@selector(deviceName)]
52
+ || display.displayId != screen.displayID) {
53
+ continue;
54
+ }
55
+ if ([display.deviceName isEqualToString:FBDuoInnerDisplayDeviceName]) {
56
+ return @YES;
57
+ }
58
+ if ([display.deviceName isEqualToString:FBDuoCoverDisplayDeviceName]) {
59
+ return @NO;
60
+ }
61
+ }
62
+ return nil;
63
+ }
64
+
65
+ // Work around XCTest updating Duo device orientation without rotating the app.
66
+ // Reproduction details and checks required before removing this workaround:
67
+ // https://github.com/appium/appium-ios/pull/81
68
+ + (nullable NSString *)duoOrientationValue:(UIDeviceOrientation)orientation
69
+ {
70
+ NSError *error = nil;
71
+ XCUIScreen *screen = [FBScreen currentScreenWithError:&error];
72
+ if (nil == screen) {
73
+ [FBLogger logFmt:@"Cannot resolve the display for Duo rotation: %@", error];
74
+ return nil;
75
+ }
76
+ NSNumber *innerDisplay = [self isInnerDuoDisplay:screen];
77
+ if (nil == innerDisplay) {
78
+ [FBLogger logFmt:@"Cannot identify the physical Duo panel for display %lld; refusing to guess its rotation mapping",
79
+ screen.displayID];
80
+ return nil;
81
+ }
82
+ // The inner panel's native orientation is a quarter turn from the cover.
83
+ // Values match DeviceKit's orientation-picker-control (Xcode 27.1).
84
+ BOOL isInnerDisplay = innerDisplay.boolValue;
85
+ NSString *value;
86
+ switch (orientation) {
87
+ case UIDeviceOrientationPortrait:
88
+ value = !isInnerDisplay ? @"portrait" : @"landscape-left";
89
+ break;
90
+ case UIDeviceOrientationLandscapeLeft:
91
+ value = !isInnerDisplay ? @"landscape-left" : @"pud";
92
+ break;
93
+ case UIDeviceOrientationLandscapeRight:
94
+ value = !isInnerDisplay ? @"landscape-right" : @"portrait";
95
+ break;
96
+ case UIDeviceOrientationPortraitUpsideDown:
97
+ value = !isInnerDisplay ? @"pud" : @"landscape-right";
98
+ break;
99
+ case UIDeviceOrientationUnknown:
100
+ case UIDeviceOrientationFaceUp:
101
+ case UIDeviceOrientationFaceDown:
102
+ default:
103
+ return nil;
104
+ }
105
+
106
+ return value;
107
+ }
108
+
109
+ @end
110
+ #endif
@@ -7,6 +7,7 @@
7
7
  */
8
8
 
9
9
  #import "FBHIDOperations.h"
10
+ #import "FBHIDOperations+DuoRotation.h"
10
11
 
11
12
  #import <dlfcn.h>
12
13
  #import <mach/mach_time.h>
@@ -15,9 +16,7 @@
15
16
  #import "FBErrorBuilder.h"
16
17
  #import "FBLogger.h"
17
18
  #import "FBRunLoopSpinner.h"
18
- #import "FBScreen.h"
19
19
  #import "FBSession.h"
20
- #import "XCUIScreen.h"
21
20
  #import "XCUIDevice+FBHinge.h"
22
21
  #import "XCUIApplication.h"
23
22
  #import "XCUIApplication+FBHelpers.h"
@@ -122,38 +121,8 @@ static BOOL FBPressHIDButton(uint32_t usage, NSError **error)
122
121
  withDescription:@"Cannot create the button HID event or client"] buildError:error];
123
122
  }
124
123
 
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)
124
+ static BOOL FBDispatchHIDOrientation(NSString *value)
129
125
  {
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
126
  const FBHIDAPI *api = FBGetHIDAPI();
158
127
  if (NULL == api->serialize || NULL == api->createVendorEvent
159
128
  || NULL == api->createClient || NULL == api->dispatchEvent) {
@@ -219,6 +188,10 @@ static BOOL FBDispatchHIDOrientation(UIDeviceOrientation orientation)
219
188
  + (BOOL)rotateToOrientation:(UIDeviceOrientation)orientation
220
189
  interfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
221
190
  {
191
+ NSString *value = [self duoOrientationValue:orientation];
192
+ if (nil == value) {
193
+ return NO;
194
+ }
222
195
  FBLogUnverifiedPhysicalHIDOperation(@"rotation");
223
196
  XCUIApplication *application = XCUIApplication.fb_activeApplication;
224
197
  // Point-based detection can select the cover SpringBoard while the app
@@ -228,7 +201,7 @@ static BOOL FBDispatchHIDOrientation(UIDeviceOrientation orientation)
228
201
  [XCUIDevice sharedDevice].orientation = orientation;
229
202
  // On Duo simulators XCTest can update its value without rotating the app.
230
203
  // Use the same direct HID path on simulators and physical hinged devices.
231
- if (!FBDispatchHIDOrientation(orientation)) {
204
+ if (!FBDispatchHIDOrientation(value)) {
232
205
  return NO;
233
206
  }
234
207
  // Event dispatch is asynchronous. Check the app, not just XCTest's value.
@@ -8,13 +8,37 @@
8
8
 
9
9
  #import <XCTest/XCTest.h>
10
10
  #import <UIKit/UIKit.h>
11
+ #import <objc/runtime.h>
12
+ #import <limits.h>
13
+ #import "FBHIDOperations.h"
14
+ #import "FBHIDOperations+DuoRotation.h"
11
15
  #import "FBIntegrationTestCase.h"
12
16
  #import "XCUIDevice+FBRotation.h"
13
17
  #import "XCUIDevice+FBHinge.h"
14
18
  #import "FBConfiguration.h"
15
19
  #import "FBScreen.h"
20
+ #import "XCUIElement.h"
21
+ #import "XCUIScreen.h"
16
22
  #import "FBSession.h"
17
23
 
24
+ @interface FBHIDOperations (FBPanelResolutionTesting)
25
+ + (nullable NSNumber *)isInnerDuoDisplay:(XCUIScreen *)screen displays:(nullable NSArray *)displays;
26
+ @end
27
+
28
+ @interface FBRotationDisplayDouble : NSObject
29
+ @property (nonatomic) unsigned int displayId;
30
+ @property (nonatomic, copy) NSString *deviceName;
31
+ @end
32
+ @implementation FBRotationDisplayDouble
33
+ @end
34
+
35
+ @interface FBRotationScreenDouble : NSObject
36
+ @property (nonatomic) long long displayID;
37
+ @property (nonatomic) BOOL isMainScreen;
38
+ @end
39
+ @implementation FBRotationScreenDouble
40
+ @end
41
+
18
42
  @interface XCUIDeviceRotationTests : FBIntegrationTestCase
19
43
  @property (nonatomic, strong) FBSession *session;
20
44
 
@@ -109,6 +133,104 @@
109
133
  XCTAssertEqual(currentRotation, [XCUIDevice sharedDevice].orientation, @"Device doesnt support tilt, should be at previous orientation");
110
134
  }
111
135
 
136
+ - (void)assertRotationRejectedWithoutOrientationChange
137
+ {
138
+ Method method = class_getInstanceMethod(XCUIDevice.class, @selector(setOrientation:));
139
+ IMP original = method_getImplementation(method);
140
+ __block NSUInteger orientationChanges = 0;
141
+ IMP replacement = imp_implementationWithBlock(^(id receiver, UIDeviceOrientation orientation) {
142
+ orientationChanges++;
143
+ });
144
+ method_setImplementation(method, replacement);
145
+ @try {
146
+ XCTAssertFalse([FBHIDOperations rotateToOrientation:UIDeviceOrientationLandscapeLeft
147
+ interfaceOrientation:UIInterfaceOrientationLandscapeRight]);
148
+ XCTAssertEqual(orientationChanges, 0UL, @"Unresolved display identity must fail before changing device orientation");
149
+ } @finally {
150
+ method_setImplementation(method, original);
151
+ imp_removeBlock(replacement);
152
+ }
153
+ }
154
+
155
+ - (void)testInvalidDisplayDoesNotChangeDeviceOrientation
156
+ {
157
+ NSNumber *originalDisplay = FBConfiguration.sharedInstance.currentDisplayId;
158
+ @try {
159
+ FBConfiguration.sharedInstance.currentDisplayId = @(LLONG_MAX);
160
+ [self assertRotationRejectedWithoutOrientationChange];
161
+ } @finally {
162
+ FBConfiguration.sharedInstance.currentDisplayId = originalDisplay;
163
+ }
164
+ }
165
+
166
+ - (void)testUnknownPanelDoesNotChangeDeviceOrientation
167
+ {
168
+ Method method = class_getClassMethod(FBHIDOperations.class, @selector(isInnerDuoDisplay:displays:));
169
+ IMP original = method_getImplementation(method);
170
+ __block NSUInteger resolutions = 0;
171
+ IMP replacement = imp_implementationWithBlock(^NSNumber *(id receiver, XCUIScreen *screen, NSArray *displays) {
172
+ resolutions++;
173
+ return nil;
174
+ });
175
+ method_setImplementation(method, replacement);
176
+ @try {
177
+ [self assertRotationRejectedWithoutOrientationChange];
178
+ XCTAssertEqual(resolutions, 1UL);
179
+ } @finally {
180
+ method_setImplementation(method, original);
181
+ imp_removeBlock(replacement);
182
+ }
183
+ }
184
+
185
+ - (void)testPhysicalPanelIdentityDoesNotFollowMainScreen
186
+ {
187
+ FBRotationDisplayDouble *cover = [FBRotationDisplayDouble new];
188
+ cover.displayId = 42;
189
+ cover.deviceName = @"primary";
190
+ FBRotationDisplayDouble *inner = [FBRotationDisplayDouble new];
191
+ inner.displayId = 73;
192
+ inner.deviceName = @"primary-1";
193
+ FBRotationScreenDouble *screen = [FBRotationScreenDouble new];
194
+ for (NSNumber *isMain in @[@YES, @NO]) {
195
+ screen.isMainScreen = isMain.boolValue;
196
+ screen.displayID = cover.displayId;
197
+ XCTAssertEqualObjects(([FBHIDOperations isInnerDuoDisplay:(id)screen displays:@[inner, cover]]), @NO);
198
+ screen.displayID = inner.displayId;
199
+ XCTAssertEqualObjects(([FBHIDOperations isInnerDuoDisplay:(id)screen displays:@[cover, inner]]), @YES);
200
+ }
201
+ }
202
+
203
+ - (void)testUnrecognizedPhysicalPanelIsNotGuessed
204
+ {
205
+ FBRotationScreenDouble *screen = [FBRotationScreenDouble new];
206
+ screen.displayID = 42;
207
+ FBRotationDisplayDouble *display = [FBRotationDisplayDouble new];
208
+ display.displayId = 73;
209
+ display.deviceName = @"primary";
210
+ for (NSNumber *isMain in @[@YES, @NO]) {
211
+ screen.isMainScreen = isMain.boolValue;
212
+ XCTAssertNil([FBHIDOperations isInnerDuoDisplay:(id)screen displays:nil]);
213
+ XCTAssertNil([FBHIDOperations isInnerDuoDisplay:(id)screen displays:@[]]);
214
+ XCTAssertNil([FBHIDOperations isInnerDuoDisplay:(id)screen displays:@[[NSObject new]]]);
215
+ display.displayId = 73;
216
+ display.deviceName = @"primary";
217
+ XCTAssertNil([FBHIDOperations isInnerDuoDisplay:(id)screen displays:@[display]]);
218
+ display.displayId = 42;
219
+ display.deviceName = @"unrecognized-panel";
220
+ XCTAssertNil([FBHIDOperations isInnerDuoDisplay:(id)screen displays:@[display]]);
221
+ }
222
+ // Do not truncate XCTest's wider ID to a Core Animation display ID.
223
+ screen.displayID = (1LL << 32) + 42;
224
+ display.deviceName = @"primary";
225
+ XCTAssertNil([FBHIDOperations isInnerDuoDisplay:(id)screen displays:@[display]]);
226
+ }
227
+
228
+ - (void)assertDevice:(XCUIDevice *)device hasOrientation:(UIDeviceOrientation)orientation name:(NSString *)name
229
+ {
230
+ XCTAssertEqual(device.orientation, orientation);
231
+ XCTAssertEqualObjects(device.fb_deviceOrientation, name);
232
+ }
233
+
112
234
  - (void)testRotationOnSelectedDuoDisplay
113
235
  {
114
236
  #if TARGET_OS_SIMULATOR
@@ -122,25 +244,60 @@
122
244
  for (NSNumber *angle in @[@0, @90, @180]) {
123
245
  XCTAssertTrue([device fb_setSimulatedHingeAngle:angle.doubleValue error:nil]);
124
246
  [[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
247
  [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];
248
+ XCUIElement *window = self.testedApplication.windows.firstMatch;
249
+ XCTAssertTrue([window waitForExistenceWithTimeout:5], @"The app must have a window after the hinge change");
250
+ (void)window.frame;
251
+ XCUIScreen *screen = window.screen;
252
+ XCTAssertNotNil(screen, @"The resolved window must expose its display");
253
+ NSError *screenError = nil;
254
+ NSArray<NSDictionary *> *screens = [FBScreen screensWithError:&screenError];
255
+ XCTAssertNotNil(screens);
256
+ XCTAssertNil(screenError);
257
+ NSNumber *displayID = @(screen.displayID);
258
+ XCTAssertTrue([[screens valueForKey:@"displayId"] containsObject:displayID],
259
+ @"The app window must belong to an available display");
260
+ NSNumber *isInnerDisplay = [FBHIDOperations isInnerDuoDisplay:screen];
261
+ XCTAssertNotNil(isInnerDisplay);
262
+ XCTAssertEqual(isInnerDisplay.boolValue, angle.doubleValue > 0,
263
+ @"The fixture must use the cover when closed and the inner panel when open");
264
+ FBConfiguration.sharedInstance.currentDisplayId = displayID;
265
+ // 27.1/27.2 keep XCTest's assigned value; 27.3 reports the HID-adjusted value on the inner panel.
266
+ BOOL reportsHIDOrientation = isInnerDisplay.boolValue
267
+ && [NSProcessInfo.processInfo isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){27, 3, 0}];
268
+ // Independent expectations for the app's interface and XCTest's raw device reading.
269
+ NSArray<NSDictionary *> *cases = @[
270
+ @{@"device": @(UIDeviceOrientationLandscapeLeft), @"interface": @(UIInterfaceOrientationLandscapeRight),
271
+ @"innerDevice": @(UIDeviceOrientationPortraitUpsideDown), @"label": @"LandscapeRight"},
272
+ @{@"device": @(UIDeviceOrientationLandscapeRight), @"interface": @(UIInterfaceOrientationLandscapeLeft),
273
+ @"innerDevice": @(UIDeviceOrientationPortrait), @"label": @"LandscapeLeft"},
274
+ @{@"device": @(UIDeviceOrientationPortrait), @"interface": @(UIInterfaceOrientationPortrait),
275
+ @"innerDevice": @(UIDeviceOrientationLandscapeLeft), @"label": @"Portrait"},
276
+ ];
277
+ NSDictionary<NSNumber *, NSString *> *deviceNames = @{
278
+ @(UIDeviceOrientationPortrait): @"UIDeviceOrientationPortrait",
279
+ @(UIDeviceOrientationPortraitUpsideDown): @"UIDeviceOrientationPortraitUpsideDown",
280
+ @(UIDeviceOrientationLandscapeLeft): @"UIDeviceOrientationLandscapeLeft",
281
+ @(UIDeviceOrientationLandscapeRight): @"UIDeviceOrientationLandscapeRight",
282
+ };
283
+ for (NSDictionary *testCase in cases) {
284
+ UIDeviceOrientation orientation = [testCase[@"device"] integerValue];
137
285
  XCTAssertTrue([device fb_setDeviceInterfaceOrientation:orientation]);
138
- XCTAssertTrue([self.testedApplication.staticTexts[labels[i]] waitForExistenceWithTimeout:5]);
139
- XCTAssertEqual(device.orientation, orientation);
286
+ XCTAssertTrue([self.testedApplication.staticTexts[testCase[@"label"]] waitForExistenceWithTimeout:5]);
287
+ XCTAssertEqual(self.testedApplication.interfaceOrientation, [testCase[@"interface"] integerValue]);
288
+ UIDeviceOrientation rawOrientation = [testCase[reportsHIDOrientation ? @"innerDevice" : @"device"] integerValue];
289
+ [self assertDevice:device hasOrientation:rawOrientation name:deviceNames[@(rawOrientation)]];
290
+ (void)window.frame;
291
+ XCTAssertNotNil(window.screen);
292
+ XCTAssertEqual(window.screen.displayID, displayID.longLongValue, @"Rotation must keep the app on the selected panel");
140
293
  }
141
294
  BOOL rotated = [device fb_setDeviceRotation:@{@"x": @0, @"y": @0, @"z": @270}];
142
295
  XCTAssertTrue(rotated);
143
- XCTAssertTrue(self.testedApplication.staticTexts[@"LandscapeRight"].exists);
296
+ XCTAssertTrue([self.testedApplication.staticTexts[@"LandscapeRight"] waitForExistenceWithTimeout:5]);
297
+ XCTAssertEqual(self.testedApplication.interfaceOrientation, UIInterfaceOrientationLandscapeRight);
298
+ UIDeviceOrientation rawOrientation = reportsHIDOrientation
299
+ ? UIDeviceOrientationPortraitUpsideDown : UIDeviceOrientationLandscapeLeft;
300
+ [self assertDevice:device hasOrientation:rawOrientation name:deviceNames[@(rawOrientation)]];
144
301
  }
145
302
  } @finally {
146
303
  [device fb_setSimulatedHingeAngle:0 error:nil];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appium-webdriveragent",
3
- "version": "17.0.11",
3
+ "version": "17.0.12",
4
4
  "description": "Package bundling WebDriverAgent",
5
5
  "keywords": [
6
6
  "Appium",
@@ -83,5 +83,5 @@
83
83
  "node": "^22.22.2 || ^24.15.0 || >=26.0.0",
84
84
  "npm": ">=10"
85
85
  },
86
- "gitHead": "582beec62211b41800a9dd32f8e91cced0228158"
86
+ "gitHead": "717f2ef78791b512db80f81d9a73ff5be321ea57"
87
87
  }