appium-webdriveragent 16.18.1 → 16.18.3

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.18.3](https://github.com/appium/appium-ios/compare/appium-webdriveragent@16.18.2...appium-webdriveragent@16.18.3) (2026-11-08)
7
+
8
+ ### Bug Fixes
9
+
10
+ * **webdriveragent:** cache the screen lookup in the MJPEG server ([#171](https://github.com/appium/appium-ios/issues/171)) ([e764254](https://github.com/appium/appium-ios/commit/e764254f068127669c1ba16d32394836c97307ac))
11
+
12
+
13
+ ## [16.18.2](https://github.com/appium/appium-ios/compare/appium-webdriveragent@16.18.1...appium-webdriveragent@16.18.2) (2026-11-07)
14
+
15
+ ### Code Refactoring
16
+
17
+ * use ConditionUnmetError instead of message matching ([#169](https://github.com/appium/appium-ios/issues/169)) ([ccaac20](https://github.com/appium/appium-ios/commit/ccaac207cd2e449a821f75dd0881ffc3dfc595e2))
18
+
19
+
6
20
  ## [16.18.1](https://github.com/appium/appium-ios/compare/appium-webdriveragent@16.18.0...appium-webdriveragent@16.18.1) (2026-11-07)
7
21
 
8
22
  **Note:** Version bump only for package appium-webdriveragent
@@ -15,11 +15,11 @@
15
15
  <key>CFBundlePackageType</key>
16
16
  <string>FMWK</string>
17
17
  <key>CFBundleShortVersionString</key>
18
- <string>16.18.1</string>
18
+ <string>16.18.3</string>
19
19
  <key>CFBundleSignature</key>
20
20
  <string>????</string>
21
21
  <key>CFBundleVersion</key>
22
- <string>16.18.1</string>
22
+ <string>16.18.3</string>
23
23
  <key>NSPrincipalClass</key>
24
24
  <string/>
25
25
  </dict>
@@ -28,6 +28,8 @@ static const NSTimeInterval FRAME_TIMEOUT = 1.;
28
28
  static const NSUInteger MAX_PENDING_FRAMES_PER_CLIENT = 4;
29
29
  static const NSTimeInterval FAILURE_BACKOFF_MIN = 1.0;
30
30
  static const NSTimeInterval FAILURE_BACKOFF_MAX = 10.0;
31
+ // The screen lookup is a round trip to testmanagerd, so it is not repeated for every frame.
32
+ static const uint64_t SCREEN_REFRESH_INTERVAL = 3 * NSEC_PER_SEC;
31
33
 
32
34
  static NSString *const SERVER_NAME = @"WDA MJPEG Server";
33
35
  static const char *QUEUE_NAME = "JPEG Screenshots Provider Queue";
@@ -48,6 +50,10 @@ static NSUInteger FBNormalizedMjpegFramerate(NSUInteger framerate)
48
50
  @property (nonatomic, assign) NSUInteger sentFramesCount;
49
51
  @property (nonatomic, assign) NSUInteger sentBytesCount;
50
52
  @property (nonatomic, assign) NSUInteger droppedFramesCount;
53
+ // Touched only on backgroundQueue.
54
+ @property (nonatomic, strong, nullable) XCUIScreen *cachedScreen;
55
+ @property (nonatomic, strong, nullable) NSNumber *cachedScreenDisplayId;
56
+ @property (nonatomic, assign) uint64_t cachedScreenTimestamp;
51
57
  // Frames submitted but not sent yet, per client. Guarded by @synchronized (self.listeningClients).
52
58
  @property (nonatomic, readonly) NSMapTable<id, NSNumber *> *pendingFrameCounts;
53
59
 
@@ -97,6 +103,25 @@ static NSUInteger FBNormalizedMjpegFramerate(NSUInteger framerate)
97
103
  }
98
104
  }
99
105
 
106
+ - (nullable XCUIScreen *)currentScreenWithError:(NSError **)error
107
+ {
108
+ NSNumber *displayId = FBConfiguration.sharedInstance.currentDisplayId;
109
+ uint64_t now = clock_gettime_nsec_np(CLOCK_MONOTONIC_RAW);
110
+ BOOL isCacheValid = nil != self.cachedScreen
111
+ && (displayId == self.cachedScreenDisplayId || [displayId isEqual:self.cachedScreenDisplayId])
112
+ && now - self.cachedScreenTimestamp < SCREEN_REFRESH_INTERVAL;
113
+ if (isCacheValid) {
114
+ return self.cachedScreen;
115
+ }
116
+ // Resolve with the captured id, so the cache key always matches the cached screen.
117
+ self.cachedScreen = nil == displayId
118
+ ? XCUIScreen.mainScreen
119
+ : [FBScreen screenWithDisplayID:displayId.longLongValue error:error];
120
+ self.cachedScreenDisplayId = displayId;
121
+ self.cachedScreenTimestamp = now;
122
+ return self.cachedScreen;
123
+ }
124
+
100
125
  - (void)streamScreenshot
101
126
  {
102
127
  if (!self.isStreaming) {
@@ -115,13 +140,14 @@ static NSUInteger FBNormalizedMjpegFramerate(NSUInteger framerate)
115
140
  NSError *error;
116
141
  CGFloat compressionQuality = MAX(FBMinCompressionQuality,
117
142
  MIN(FBMaxCompressionQuality, (double)FBConfiguration.sharedInstance.mjpegServerScreenshotQuality / 100.0));
118
- XCUIScreen *screen = [FBScreen currentScreenWithError:&error];
143
+ XCUIScreen *screen = [self currentScreenWithError:&error];
119
144
  NSData *screenshotData = nil == screen ? nil : [FBScreenshot takeInOriginalResolutionWithScreenID:screen.displayID
120
145
  compressionQuality:compressionQuality
121
146
  uti:UTTypeJPEG
122
147
  timeout:FRAME_TIMEOUT
123
148
  error:&error];
124
149
  if (nil == screenshotData) {
150
+ self.cachedScreen = nil;
125
151
  [FBLogger logFmt:@"%@", error.description];
126
152
  self.consecutiveScreenshotFailures++;
127
153
  NSTimeInterval backoffSeconds = MIN(FAILURE_BACKOFF_MAX,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appium-webdriveragent",
3
- "version": "16.18.1",
3
+ "version": "16.18.3",
4
4
  "description": "Package bundling WebDriverAgent",
5
5
  "keywords": [
6
6
  "Appium",
@@ -64,18 +64,18 @@
64
64
  "@appium/base-driver": "^10.8.0",
65
65
  "@appium/strongbox": "^2.0.0",
66
66
  "@appium/support": "^7.2.6",
67
- "asyncbox": "^6.5.0",
67
+ "asyncbox": "^6.6.0",
68
68
  "axios": "^1.21.0",
69
69
  "teen_process": "^4.2.0"
70
70
  },
71
71
  "devDependencies": {
72
- "@appium/coresim": "^1.15.0",
72
+ "@appium/coresim": "^1.15.1",
73
73
  "@appium/oxc-config": "^1.1.0",
74
74
  "@appium/tsconfig": "^1.2.0",
75
75
  "@appium/types": "^1.7.2",
76
76
  "@types/node": "^26.0.0",
77
77
  "@types/sinon": "^22.0.2",
78
- "appium-xcode": "^7.2.4",
78
+ "appium-xcode": "^7.2.5",
79
79
  "semver": "^7.3.7",
80
80
  "sinon": "^22.0.0"
81
81
  },
@@ -83,5 +83,5 @@
83
83
  "node": "^20.19.0 || ^22.12.0 || >=24.0.0",
84
84
  "npm": ">=10"
85
85
  },
86
- "gitHead": "943e2efdb5d8b26a704d0cef58cb5eec0f37076c"
86
+ "gitHead": "20c3bde38f8413bd760187c521ace065a62538a6"
87
87
  }