appium-webdriveragent 16.17.3 → 16.17.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 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.17.5](https://github.com/appium/appium-ios/compare/appium-webdriveragent@16.17.4...appium-webdriveragent@16.17.5) (2026-10-24)
7
+
8
+ **Note:** Version bump only for package appium-webdriveragent
9
+
10
+
11
+
12
+
13
+
14
+ ## [16.17.4](https://github.com/appium/appium-ios/compare/appium-webdriveragent@16.17.3...appium-webdriveragent@16.17.4) (2026-10-24)
15
+
16
+ ### Bug Fixes
17
+
18
+ * **webdriveragent:** wait for SpringBoard after background apps resume ([#82](https://github.com/appium/appium-ios/issues/82)) ([b8b0b45](https://github.com/appium/appium-ios/commit/b8b0b45294c47882c3d31c023a9fb6912496518d))
19
+
20
+
6
21
  ## [16.17.3](https://github.com/appium/appium-ios/compare/appium-webdriveragent@16.17.2...appium-webdriveragent@16.17.3) (2026-10-23)
7
22
 
8
23
  ### Miscellaneous Chores
@@ -18,6 +18,9 @@ NS_ASSUME_NONNULL_BEGIN
18
18
 
19
19
  @interface XCUIApplication (FBHelpers)
20
20
 
21
+ /** Activates the application and waits for the system transition when resuming on iOS. */
22
+ - (void)fb_activate;
23
+
21
24
  /**
22
25
  Deactivates application for given time
23
26
 
@@ -120,6 +120,10 @@ NSDictionary<NSString *, NSString *> *customExclusionAttributesMap(void) {
120
120
  return result;
121
121
  }
122
122
 
123
+ @interface XCUIApplication (FBActivationPrivate)
124
+ - (void)fb_activateWaitingForSystemTransition:(BOOL)shouldWait;
125
+ @end
126
+
123
127
  @implementation XCUIApplication (FBHelpers)
124
128
 
125
129
  - (BOOL)fb_waitForAppElement:(NSTimeInterval)timeout
@@ -172,13 +176,38 @@ NSDictionary<NSString *, NSString *> *customExclusionAttributesMap(void) {
172
176
  return [self fb_appsInfoWithAxElements:[FBXCAXClientProxy.sharedClient activeApplications]];
173
177
  }
174
178
 
179
+ - (void)fb_activate
180
+ {
181
+ BOOL shouldWaitForSystemTransition = NO;
182
+ #if !TARGET_OS_TV && !TARGET_OS_WATCH
183
+ XCUIApplicationState previousState = self.state;
184
+ shouldWaitForSystemTransition = previousState == XCUIApplicationStateRunningBackground
185
+ || previousState == XCUIApplicationStateRunningBackgroundSuspended;
186
+ #endif
187
+ [self fb_activateWaitingForSystemTransition:shouldWaitForSystemTransition];
188
+ }
189
+
190
+ - (void)fb_activateWaitingForSystemTransition:(BOOL)shouldWait
191
+ {
192
+ [self activate];
193
+ #if !TARGET_OS_TV && !TARGET_OS_WATCH
194
+ if (shouldWait) {
195
+ // App quiescence alone can miss the system resume transition.
196
+ // https://github.com/appium/appium/issues/22857
197
+ [XCUIApplication.fb_systemApplication fb_waitUntilStableWithTimeout:
198
+ FBConfiguration.sharedInstance.animationCoolOffTimeout];
199
+ }
200
+ #endif
201
+ }
202
+
175
203
  - (BOOL)fb_deactivateWithDuration:(NSTimeInterval)duration error:(NSError **)error
176
204
  {
177
205
  if(![[XCUIDevice sharedDevice] fb_goToHomescreenWithError:error]) {
178
206
  return NO;
179
207
  }
180
208
  [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:MAX(duration, .0)]];
181
- [self activate];
209
+ // A zero-duration background transition may still report the app as foreground.
210
+ [self fb_activateWaitingForSystemTransition:YES];
182
211
  return YES;
183
212
  }
184
213
 
@@ -411,7 +411,7 @@
411
411
  if (nil != initialUrl) {
412
412
  return [self openDeepLink:initialUrl withApplication:bundleID timeout:nil];
413
413
  }
414
- [app activate];
414
+ [app fb_activate];
415
415
  return nil;
416
416
  }
417
417
 
@@ -15,11 +15,11 @@
15
15
  <key>CFBundlePackageType</key>
16
16
  <string>FMWK</string>
17
17
  <key>CFBundleShortVersionString</key>
18
- <string>16.17.3</string>
18
+ <string>16.17.5</string>
19
19
  <key>CFBundleSignature</key>
20
20
  <string>????</string>
21
21
  <key>CFBundleVersion</key>
22
- <string>16.17.3</string>
22
+ <string>16.17.5</string>
23
23
  <key>NSPrincipalClass</key>
24
24
  <string/>
25
25
  </dict>
@@ -24,6 +24,7 @@
24
24
  #import "FBXCTestDaemonsProxy.h"
25
25
  #import "XCUIApplication+FBQuiescence.h"
26
26
  #import "XCUIElement.h"
27
+ #import "XCUIElement+FBUtilities.h"
27
28
 
28
29
  /*!
29
30
  The intial value for the default application property.
@@ -432,7 +433,7 @@ static NSUInteger _committedTerminationCount = 0;
432
433
  app.launchEnvironment = environment ?: @{};
433
434
  [app launch];
434
435
  } else {
435
- [app activate];
436
+ [app fb_activate];
436
437
  }
437
438
  if (asApplicationUnderTest) {
438
439
  BOOL waitForQuiescence = app.fb_shouldWaitForQuiescence;
@@ -475,7 +476,7 @@ static NSUInteger _committedTerminationCount = 0;
475
476
  - (XCUIApplication *)activateApplicationWithBundleId:(NSString *)bundleIdentifier
476
477
  {
477
478
  XCUIApplication *app = [self makeApplicationWithBundleId:bundleIdentifier];
478
- [app activate];
479
+ [app fb_activate];
479
480
  return app;
480
481
  }
481
482
 
@@ -9,15 +9,29 @@
9
9
  #import <XCTest/XCTest.h>
10
10
 
11
11
  #import <mach/mach_time.h>
12
+ #import <math.h>
12
13
 
13
14
  #import "FBIntegrationTestCase.h"
14
15
  #import "FBElement.h"
16
+ #import "FBSession.h"
17
+ #import "FBSessionCommands.h"
15
18
  #import "FBMacros.h"
16
19
  #import "FBTestMacros.h"
17
20
  #import "XCUIApplication.h"
18
21
  #import "XCUIApplication+FBHelpers.h"
19
22
  #import "XCUIElement+FBIsVisible.h"
20
23
  #import "FBXCodeCompatibility.h"
24
+ #import "FBConfiguration.h"
25
+ #import "FBScreen.h"
26
+ #import "FBRunLoopSpinner.h"
27
+ #import "XCUIDevice+FBHinge.h"
28
+
29
+ // Exercise the session-start resume path without creating a second session.
30
+ @interface FBSessionCommands (FBActivationTests)
31
+ + (id)activateBackgroundApplication:(XCUIApplication *)app
32
+ bundleID:(NSString *)bundleID
33
+ initialUrl:(nullable NSString *)initialUrl;
34
+ @end
21
35
 
22
36
  void calculateMaxTreeDepth(NSDictionary *tree, NSNumber *currentDepth, NSNumber** maxDepth) {
23
37
  if (nil == maxDepth) {
@@ -83,6 +97,103 @@ void calculateMaxTreeDepth(NSDictionary *tree, NSNumber *currentDepth, NSNumber*
83
97
  XCTAssertTrue(self.testedApplication.buttons[@"Alerts"].exists);
84
98
  }
85
99
 
100
+ - (void)testInputAfterDeactivate
101
+ {
102
+ [self verifyInputAfterBackgroundWithMode:0];
103
+ }
104
+
105
+ - (void)testInputAfterSessionActivate
106
+ {
107
+ [self verifyInputAfterBackgroundWithMode:1];
108
+ }
109
+
110
+ - (void)testInputAfterSessionLaunch
111
+ {
112
+ [self verifyInputAfterBackgroundWithMode:2];
113
+ }
114
+
115
+ - (void)testInputAfterSessionStartActivate
116
+ {
117
+ [self verifyInputAfterBackgroundWithMode:3];
118
+ }
119
+
120
+ - (void)verifyInputAfterBackgroundWithMode:(NSUInteger)mode
121
+ {
122
+ XCTSkipIf(self.class.isRunningInCI, @"Immediate input after activation is unreliable on slow CI hosts");
123
+ XCUIDevice *device = XCUIDevice.sharedDevice;
124
+ BOOL canFold = NO;
125
+ #if TARGET_OS_SIMULATOR
126
+ canFold = device.fb_canAttemptSimulatedHingeAngleInjection;
127
+ #endif
128
+ NSNumber *originalAngle = canFold ? [device fb_getSimulatedHingeAngle:nil] : nil;
129
+ NSNumber *originalDisplay = FBConfiguration.sharedInstance.currentDisplayId;
130
+ if (canFold) {
131
+ XCTAssertNotNil(originalAngle);
132
+ }
133
+ BOOL (^setAngleAndWait)(NSNumber *) = ^BOOL(NSNumber *angle) {
134
+ if (![device fb_setSimulatedHingeAngle:angle.doubleValue error:nil]) {
135
+ return NO;
136
+ }
137
+ return [[[FBRunLoopSpinner new] timeout:5] spinUntilTrue:^BOOL{
138
+ NSNumber *reading = [device fb_getSimulatedHingeAngle:nil];
139
+ return nil != reading && fabs(reading.doubleValue - angle.doubleValue) < 1;
140
+ }];
141
+ };
142
+ FBSession *session = mode != 0 ? [FBSession initWithApplication:self.testedApplication] : nil;
143
+ @try {
144
+ for (NSNumber *angle in (canFold ? @[@0, @90, @180] : @[@0])) {
145
+ if (canFold) {
146
+ XCTAssertTrue(setAngleAndWait(angle), @"Hinge did not reach %@ degrees", angle);
147
+ for (NSDictionary *screen in [FBScreen screensWithError:nil]) {
148
+ if ([screen[@"isMain"] boolValue] == (angle.intValue == 0)) {
149
+ FBConfiguration.sharedInstance.currentDisplayId = screen[@"displayId"];
150
+ }
151
+ }
152
+ }
153
+ for (NSNumber *duration in @[@0, @2]) {
154
+ [self launchApplication];
155
+ NSError *error = nil;
156
+ if (mode != 0) {
157
+ XCTAssertTrue([device fb_goToHomescreenWithError:&error]);
158
+ XCTAssertTrue([[[FBRunLoopSpinner new] timeout:5] spinUntilTrue:^BOOL{
159
+ XCUIApplicationState state = self.testedApplication.state;
160
+ return state == XCUIApplicationStateRunningBackground
161
+ || state == XCUIApplicationStateRunningBackgroundSuspended;
162
+ }]);
163
+ [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:duration.doubleValue]];
164
+ XCUIApplicationState state = self.testedApplication.state;
165
+ XCTAssertTrue(state == XCUIApplicationStateRunningBackground
166
+ || state == XCUIApplicationStateRunningBackgroundSuspended,
167
+ @"Expected a background app before activation (angle %@, duration %@), got %lu",
168
+ angle, duration, (unsigned long)state);
169
+ if (mode == 1) {
170
+ [session activateApplicationWithBundleId:self.testedApplication.bundleID];
171
+ } else if (mode == 2) {
172
+ [session launchApplicationWithBundleId:self.testedApplication.bundleID
173
+ shouldWaitForQuiescence:nil arguments:nil environment:nil];
174
+ } else {
175
+ XCTAssertNil([FBSessionCommands activateBackgroundApplication:self.testedApplication
176
+ bundleID:self.testedApplication.bundleID
177
+ initialUrl:nil]);
178
+ }
179
+ } else {
180
+ XCTAssertTrue([self.testedApplication fb_deactivateWithDuration:duration.doubleValue error:&error]);
181
+ }
182
+ XCTAssertNil(error);
183
+ // Existence/foreground checks alone miss lost input. Do not add a
184
+ // delay or retry: this first tap must actually open the alerts page.
185
+ [self.testedApplication.buttons[@"Alerts"] tap];
186
+ XCTAssertTrue([self.testedApplication.buttons[FBShowAlertButtonName] waitForExistenceWithTimeout:2]);
187
+ }
188
+ }
189
+ } @finally {
190
+ [session kill];
191
+ BOOL restored = nil == originalAngle || setAngleAndWait(originalAngle);
192
+ FBConfiguration.sharedInstance.currentDisplayId = originalDisplay;
193
+ XCTAssertTrue(restored, @"Hinge did not return to %@ degrees", originalAngle);
194
+ }
195
+ }
196
+
86
197
  - (void)testActiveApplication
87
198
  {
88
199
  XCUIApplication *systemApp = XCUIApplication.fb_systemApplication;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appium-webdriveragent",
3
- "version": "16.17.3",
3
+ "version": "16.17.5",
4
4
  "description": "Package bundling WebDriverAgent",
5
5
  "keywords": [
6
6
  "Appium",
@@ -69,7 +69,7 @@
69
69
  "teen_process": "^4.2.0"
70
70
  },
71
71
  "devDependencies": {
72
- "@appium/coresim": "^1.13.2",
72
+ "@appium/coresim": "^1.14.0",
73
73
  "@appium/oxc-config": "^1.1.0",
74
74
  "@appium/tsconfig": "^1.2.0",
75
75
  "@appium/types": "^1.0.0-rc.1",
@@ -83,5 +83,5 @@
83
83
  "node": "^20.19.0 || ^22.12.0 || >=24.0.0",
84
84
  "npm": ">=10"
85
85
  },
86
- "gitHead": "81fb72dc3b3f23f23c804f1969f0c1eb19c8a7a2"
86
+ "gitHead": "1e3ecf666350a1868a196e84bf09cc1fe116cc4a"
87
87
  }