appium-webdriveragent 16.12.11 → 16.13.0

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.
Files changed (32) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/WebDriverAgentLib/Categories/XCUIApplication+FBTouchAction.h +53 -0
  3. package/WebDriverAgentLib/Categories/XCUIApplication+FBTouchAction.m +124 -0
  4. package/WebDriverAgentLib/Commands/FBElementCommands.m +20 -5
  5. package/WebDriverAgentLib/Info.plist +2 -2
  6. package/WebDriverAgentLib/Routing/FBHTTPServer.m +14 -1
  7. package/WebDriverAgentLib/Routing/FBTCPSocket.h +5 -1
  8. package/WebDriverAgentLib/Routing/FBTCPSocket.m +10 -1
  9. package/WebDriverAgentLib/Utilities/FBConfiguration.h +6 -0
  10. package/WebDriverAgentLib/Utilities/FBConfiguration.m +1 -0
  11. package/WebDriverAgentLib/Utilities/FBImageProcessor.m +3 -1
  12. package/WebDriverAgentLib/Utilities/FBMjpegServer.m +2 -0
  13. package/WebDriverAgentLib/Utilities/FBScreen.h +17 -0
  14. package/WebDriverAgentLib/Utilities/FBScreen.m +32 -0
  15. package/WebDriverAgentLib/Utilities/FBScreenshot.h +2 -2
  16. package/WebDriverAgentLib/Utilities/FBScreenshot.m +6 -2
  17. package/WebDriverAgentLib/Utilities/FBSettings.h +1 -0
  18. package/WebDriverAgentLib/Utilities/FBSettings.m +1 -0
  19. package/WebDriverAgentLib/Utilities/FBSettingsHandler.m +24 -0
  20. package/WebDriverAgentLib/Utilities/LRUCache/LRUCache.m +8 -5
  21. package/WebDriverAgentLib/Utilities/LRUCache/LRUCacheNode.h +1 -1
  22. package/WebDriverAgentTests/IntegrationTests/FBElementSwipingTests.m +95 -0
  23. package/WebDriverAgentTests/IntegrationTests/FBImageProcessorTests.m +34 -0
  24. package/WebDriverAgentTests/IntegrationTests/FBScreenTests.m +67 -0
  25. package/WebDriverAgentTests/UnitTests/FBHTTPServerTests.m +149 -5
  26. package/WebDriverAgentTests/UnitTests/FBLRUCacheTests.m +34 -0
  27. package/build/lib/xcodebuild.d.ts +0 -1
  28. package/build/lib/xcodebuild.d.ts.map +1 -1
  29. package/build/lib/xcodebuild.js +7 -7
  30. package/build/lib/xcodebuild.js.map +1 -1
  31. package/lib/xcodebuild.ts +7 -7
  32. package/package.json +1 -1
package/lib/xcodebuild.ts CHANGED
@@ -74,7 +74,6 @@ export class XcodeBuild {
74
74
  private readonly resultBundlePath?: string;
75
75
  private readonly resultBundleVersion?: string;
76
76
  private _didBuildFail: boolean;
77
- private _didProcessExit: boolean;
78
77
  private readonly _buildSettingsPromises = new Map<string, Promise<XcodeBuildSettings | undefined>>();
79
78
  private noSessionProxy?: NoSessionProxy;
80
79
  private xctestrunFilePath?: string;
@@ -130,7 +129,6 @@ export class XcodeBuild {
130
129
  this.resultBundleVersion = args.resultBundleVersion;
131
130
 
132
131
  this._didBuildFail = false;
133
- this._didProcessExit = false;
134
132
  }
135
133
 
136
134
  /**
@@ -250,11 +248,13 @@ export class XcodeBuild {
250
248
  throw new Error('xcodebuild subprocess was not created');
251
249
  }
252
250
  const xcodebuild = this.xcodebuild;
251
+ // Exit state belongs to this invocation, including build-only invocations.
252
+ let didProcessExit = false;
253
253
  return await new Promise<StringRecord | void>((resolve, reject) => {
254
254
  xcodebuild.once('exit', (code, signal) => {
255
255
  xcodeLog.error(`xcodebuild exited with code '${code}' and signal '${signal}'`);
256
256
  xcodebuild.removeAllListeners();
257
- this._didProcessExit = true;
257
+ didProcessExit = true;
258
258
  if (this._didBuildFail || (!signal && code !== 0)) {
259
259
  let errorMessage =
260
260
  `xcodebuild failed with code ${code}.` +
@@ -285,7 +285,7 @@ export class XcodeBuild {
285
285
  }
286
286
  await xcodebuild.start(true);
287
287
  if (!buildOnly) {
288
- const result = await this.waitForStart(timer);
288
+ const result = await this.waitForStart(timer, () => didProcessExit);
289
289
  resolve(result ?? undefined);
290
290
  }
291
291
  } catch (err: any) {
@@ -553,7 +553,7 @@ export class XcodeBuild {
553
553
  return xcodebuild;
554
554
  }
555
555
 
556
- private async waitForStart(timer: timing.Timer): Promise<StringRecord | null> {
556
+ private async waitForStart(timer: timing.Timer, didProcessExit: () => boolean): Promise<StringRecord | null> {
557
557
  // try to connect once every 0.5 seconds, until `launchTimeout` is up
558
558
  const timeout = this.launchTimeout || 60000; // Default to 60 seconds if not set
559
559
  this.log.debug(`Waiting up to ${timeout}ms for WebDriverAgent to start`);
@@ -565,7 +565,7 @@ export class XcodeBuild {
565
565
  }
566
566
  const noSessionProxy = this.noSessionProxy;
567
567
  await retryInterval(retries, 1000, async () => {
568
- if (this._didProcessExit) {
568
+ if (didProcessExit()) {
569
569
  // there has been an error elsewhere and we need to short-circuit
570
570
  return currentStatus;
571
571
  }
@@ -585,7 +585,7 @@ export class XcodeBuild {
585
585
  }
586
586
  });
587
587
 
588
- if (this._didProcessExit) {
588
+ if (didProcessExit()) {
589
589
  // there has been an error elsewhere and we need to short-circuit
590
590
  return currentStatus;
591
591
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appium-webdriveragent",
3
- "version": "16.12.11",
3
+ "version": "16.13.0",
4
4
  "description": "Package bundling WebDriverAgent",
5
5
  "keywords": [
6
6
  "Appium",