appium-webdriveragent 16.16.0 → 16.16.2

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,20 @@
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.2](https://github.com/appium/appium-ios/compare/appium-webdriveragent@16.16.1...appium-webdriveragent@16.16.2) (2026-10-18)
7
+
8
+ ### Bug Fixes
9
+
10
+ * **webdriveragent:** use Home to background watchOS apps ([#84](https://github.com/appium/appium-ios/issues/84)) ([b1dd12e](https://github.com/appium/appium-ios/commit/b1dd12e93d8eb0f6acc0a0addaf8733b2bfb0b19))
11
+
12
+
13
+ ## [16.16.1](https://github.com/appium/appium-ios/compare/appium-webdriveragent@16.16.0...appium-webdriveragent@16.16.1) (2026-10-18)
14
+
15
+ ### Bug Fixes
16
+
17
+ * **webdriveragent:** use the remote Home button to background tvOS apps ([#83](https://github.com/appium/appium-ios/issues/83)) ([2d953f4](https://github.com/appium/appium-ios/commit/2d953f41a598ddcb2ebe10398aecf3164bd00ad4))
18
+
19
+
6
20
  ## 16.16.0 (2026-10-17)
7
21
 
8
22
  ### Features
@@ -22,10 +22,15 @@
22
22
  #import "FBXCodeCompatibility.h"
23
23
  #import "FBXCTestDaemonsProxy.h"
24
24
  #import "XCUIDevice.h"
25
+ #import "XCUIApplication.h"
25
26
 
26
27
  static const NSTimeInterval FBHomeButtonCoolOffTime = 1.;
27
28
  static const NSTimeInterval FBScreenLockTimeout = 5.;
28
29
 
30
+ #if TARGET_OS_WATCH
31
+ static NSString *const FBClockFaceBundleId = @"com.apple.clockface";
32
+ #endif
33
+
29
34
  #if TARGET_OS_TV
30
35
  NSDictionary<NSString *, NSNumber *> *fb_availableButtonNames(void) {
31
36
  static dispatch_once_t onceToken;
@@ -136,8 +141,58 @@ static bool fb_isLocked;
136
141
 
137
142
  - (BOOL)fb_goToHomescreenWithError:(NSError **)error
138
143
  {
144
+ #if TARGET_OS_TV
145
+ return [self fb_goToHomescreenOnTVWithError:error];
146
+ #elif TARGET_OS_WATCH
147
+ return [self fb_goToHomescreenOnWatchWithError:error];
148
+ #else
139
149
  return [XCUIApplication fb_switchToSystemApplicationWithError:error];
150
+ #endif
151
+ }
152
+
153
+ #if TARGET_OS_WATCH
154
+ - (BOOL)fb_goToHomescreenOnWatchWithError:(NSError **)error
155
+ {
156
+ // Carousel rejects launch/activate requests on watchOS 27.0.
157
+ XCUIApplication *foregroundApp = XCUIApplication.fb_activeApplication;
158
+ // The watch face is a separate foreground application from Carousel.
159
+ if ([foregroundApp.bundleID isEqualToString:FBClockFaceBundleId]
160
+ || [foregroundApp fb_isSameAppAs:XCUIApplication.fb_systemApplication]) {
161
+ return YES;
162
+ }
163
+ @try {
164
+ [self pressButton:XCUIDeviceButtonHome];
165
+ } @catch (NSException *exception) {
166
+ return [[[FBErrorBuilder alloc] withDescription:exception.reason] buildError:error];
167
+ }
168
+ return [[[[FBRunLoopSpinner new] timeout:5]
169
+ timeoutErrorMessage:@"Timed out while waiting for the home screen"]
170
+ spinUntilTrue:^BOOL{
171
+ return foregroundApp.state != XCUIApplicationStateRunningForeground;
172
+ } error:error];
173
+ }
174
+ #endif
175
+
176
+ #if TARGET_OS_TV
177
+ - (BOOL)fb_goToHomescreenOnTVWithError:(NSError **)error
178
+ {
179
+ // PineBoard rejects launch/activate requests on tvOS 26.5 and 27.0.
180
+ XCUIApplication *foregroundApp = XCUIApplication.fb_activeApplication;
181
+ if ([foregroundApp fb_isSameAppAs:XCUIApplication.fb_systemApplication]) {
182
+ return YES;
183
+ }
184
+ @try {
185
+ [XCUIRemote.sharedRemote pressButton:XCUIRemoteButtonHome];
186
+ } @catch (NSException *exception) {
187
+ return [[[FBErrorBuilder alloc] withDescription:exception.reason] buildError:error];
188
+ }
189
+ return [[[[FBRunLoopSpinner new] timeout:5]
190
+ timeoutErrorMessage:@"Timed out while waiting for the home screen"]
191
+ spinUntilTrue:^BOOL{
192
+ return foregroundApp.state != XCUIApplicationStateRunningForeground;
193
+ } error:error];
140
194
  }
195
+ #endif
141
196
 
142
197
  - (BOOL)fb_lockScreen:(NSError **)error
143
198
  {
@@ -15,11 +15,11 @@
15
15
  <key>CFBundlePackageType</key>
16
16
  <string>FMWK</string>
17
17
  <key>CFBundleShortVersionString</key>
18
- <string>16.16.0</string>
18
+ <string>16.16.2</string>
19
19
  <key>CFBundleSignature</key>
20
20
  <string>????</string>
21
21
  <key>CFBundleVersion</key>
22
- <string>16.16.0</string>
22
+ <string>16.16.2</string>
23
23
  <key>NSPrincipalClass</key>
24
24
  <string/>
25
25
  </dict>
@@ -7,6 +7,8 @@
7
7
  */
8
8
 
9
9
  #import <XCTest/XCTest.h>
10
+ #import "XCUIApplication+FBHelpers.h"
11
+ #import "XCUIDevice+FBHelpers.h"
10
12
 
11
13
  #if TARGET_OS_TV
12
14
 
@@ -79,6 +81,25 @@
79
81
  XCTAssertFalse(disabled.hasFocus);
80
82
  }
81
83
 
84
+ - (void)testHomeAndInputAfterDeactivate
85
+ {
86
+ NSError *error = nil;
87
+ XCTAssertTrue([XCUIDevice.sharedDevice fb_goToHomescreenWithError:&error], @"%@", error);
88
+ XCTAssertNotEqual(self.app.state, XCUIApplicationStateRunningForeground);
89
+ XCTAssertEqual(XCUIApplication.fb_systemApplication.state, XCUIApplicationStateRunningForeground);
90
+ [self.app activate];
91
+ for (NSNumber *duration in @[@0, @2]) {
92
+ [self.app launch];
93
+ XCTAssertTrue([self.app fb_deactivateWithDuration:duration.doubleValue error:&error], @"%@", error);
94
+ XCTAssertEqual(self.app.state, XCUIApplicationStateRunningForeground);
95
+ XCTAssertTrue([self.app.buttons[@"cell_1_2"] fb_selectWithError:&error], @"%@", error);
96
+ XCTNSPredicateExpectation *updated = [[XCTNSPredicateExpectation alloc]
97
+ initWithPredicate:[NSPredicate predicateWithFormat:@"label == %@", @"cell_1_2"]
98
+ object:self.app.staticTexts[@"lastSelectedLabel"]];
99
+ [self waitForExpectations:@[updated] timeout:5];
100
+ }
101
+ }
102
+
82
103
  @end
83
104
 
84
105
  #endif
@@ -34,4 +34,16 @@ final class WDAAppLifecycleIntegrationTests: WDAWatchInProcessTestCase {
34
34
  app.activate()
35
35
  XCTAssertEqual(app.state, .runningForeground)
36
36
  }
37
+ func testHomeAndDeactivate() throws {
38
+ try XCUIDevice.shared.fb_goToHomescreen()
39
+ XCTAssertNotEqual(app.state, .runningForeground)
40
+ try XCUIDevice.shared.fb_goToHomescreen()
41
+ XCTAssertNotEqual(app.state, .runningForeground)
42
+ for duration in [0.0, 2.0] {
43
+ app.activate()
44
+ try app.fb_deactivate(withDuration: duration)
45
+ XCTAssertEqual(app.state, .runningForeground)
46
+ }
47
+ }
48
+
37
49
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appium-webdriveragent",
3
- "version": "16.16.0",
3
+ "version": "16.16.2",
4
4
  "description": "Package bundling WebDriverAgent",
5
5
  "keywords": [
6
6
  "Appium",