appium-webdriveragent 4.10.7 → 4.10.8

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
@@ -1,3 +1,5 @@
1
+ ## [4.10.8](https://github.com/appium/WebDriverAgent/compare/v4.10.7...v4.10.8) (2022-11-24)
2
+
1
3
  ## [4.10.7](https://github.com/appium/WebDriverAgent/compare/v4.10.6...v4.10.7) (2022-11-24)
2
4
 
3
5
  ## [4.10.6](https://github.com/appium/WebDriverAgent/compare/v4.10.5...v4.10.6) (2022-11-23)
@@ -31,7 +31,6 @@
31
31
  #import "XCTestPrivateSymbols.h"
32
32
  #import "XCTRunnerDaemonSession.h"
33
33
 
34
- const static NSTimeInterval FBMinimumAppSwitchWait = 3.0;
35
34
  static NSString* const FBUnknownBundleId = @"unknown";
36
35
 
37
36
 
@@ -92,7 +91,7 @@ static NSString* const FBUnknownBundleId = @"unknown";
92
91
  if(![[XCUIDevice sharedDevice] fb_goToHomescreenWithError:error]) {
93
92
  return NO;
94
93
  }
95
- [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:MAX(duration, FBMinimumAppSwitchWait)]];
94
+ [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:MAX(duration, .0)]];
96
95
  [self fb_activate];
97
96
  return YES;
98
97
  }
@@ -31,7 +31,6 @@ static const char *QUEUE_NAME = "JPEG Screenshots Provider Queue";
31
31
 
32
32
  @property (nonatomic, readonly) dispatch_queue_t backgroundQueue;
33
33
  @property (nonatomic, readonly) NSMutableArray<GCDAsyncSocket *> *listeningClients;
34
- @property (nonatomic, readonly) mach_timebase_info_data_t timebaseInfo;
35
34
  @property (nonatomic, readonly) FBImageIOScaler *imageScaler;
36
35
  @property (nonatomic, readonly) long long mainScreenID;
37
36
 
@@ -46,7 +45,6 @@ static const char *QUEUE_NAME = "JPEG Screenshots Provider Queue";
46
45
  _listeningClients = [NSMutableArray array];
47
46
  dispatch_queue_attr_t queueAttributes = dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, QOS_CLASS_UTILITY, 0);
48
47
  _backgroundQueue = dispatch_queue_create(QUEUE_NAME, queueAttributes);
49
- mach_timebase_info(&_timebaseInfo);
50
48
  dispatch_async(_backgroundQueue, ^{
51
49
  [self streamScreenshot];
52
50
  });
@@ -58,8 +56,8 @@ static const char *QUEUE_NAME = "JPEG Screenshots Provider Queue";
58
56
 
59
57
  - (void)scheduleNextScreenshotWithInterval:(uint64_t)timerInterval timeStarted:(uint64_t)timeStarted
60
58
  {
61
- uint64_t timeElapsed = mach_absolute_time() - timeStarted;
62
- int64_t nextTickDelta = timerInterval - timeElapsed * self.timebaseInfo.numer / self.timebaseInfo.denom;
59
+ uint64_t timeElapsed = clock_gettime_nsec_np(CLOCK_MONOTONIC_RAW) - timeStarted;
60
+ int64_t nextTickDelta = timerInterval - timeElapsed;
63
61
  if (nextTickDelta > 0) {
64
62
  dispatch_after(dispatch_time(DISPATCH_TIME_NOW, nextTickDelta), self.backgroundQueue, ^{
65
63
  [self streamScreenshot];
@@ -81,7 +79,7 @@ static const char *QUEUE_NAME = "JPEG Screenshots Provider Queue";
81
79
 
82
80
  NSUInteger framerate = FBConfiguration.mjpegServerFramerate;
83
81
  uint64_t timerInterval = (uint64_t)(1.0 / ((0 == framerate || framerate > MAX_FPS) ? MAX_FPS : framerate) * NSEC_PER_SEC);
84
- uint64_t timeStarted = mach_absolute_time();
82
+ uint64_t timeStarted = clock_gettime_nsec_np(CLOCK_MONOTONIC_RAW);
85
83
  @synchronized (self.listeningClients) {
86
84
  if (0 == self.listeningClients.count) {
87
85
  [self scheduleNextScreenshotWithInterval:timerInterval timeStarted:timeStarted];
@@ -94,7 +94,7 @@
94
94
  pasteboardContent = result;
95
95
  didFinishGetPasteboard = YES;
96
96
  });
97
- uint64_t timeStarted = mach_absolute_time();
97
+ uint64_t timeStarted = clock_gettime_nsec_np(CLOCK_MONOTONIC_RAW);
98
98
  while (!didFinishGetPasteboard) {
99
99
  [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:ALERT_CHECK_INTERVAL_SEC]];
100
100
  if (didFinishGetPasteboard) {
@@ -106,7 +106,7 @@
106
106
  FBAlert *alert = [FBAlert alertWithElement:alertElement];
107
107
  [alert acceptWithError:nil];
108
108
  }
109
- uint64_t timeElapsed = mach_absolute_time() - timeStarted;
109
+ uint64_t timeElapsed = clock_gettime_nsec_np(CLOCK_MONOTONIC_RAW) - timeStarted;
110
110
  if (timeElapsed / NSEC_PER_SEC > timeout) {
111
111
  NSString *description = [NSString stringWithFormat:@"Cannot handle pasteboard alert within %@s timeout", @(timeout)];
112
112
  if (error) {
Binary file
@@ -46,10 +46,10 @@
46
46
  - (void)testDeactivateApplication
47
47
  {
48
48
  NSError *error;
49
- uint64_t timeStarted = mach_absolute_time();
49
+ uint64_t timeStarted = clock_gettime_nsec_np(CLOCK_MONOTONIC_RAW);
50
50
  NSTimeInterval backgroundDuration = 5.0;
51
51
  XCTAssertTrue([self.testedApplication fb_deactivateWithDuration:backgroundDuration error:&error]);
52
- NSTimeInterval timeElapsed = (mach_absolute_time() - timeStarted) / NSEC_PER_SEC;
52
+ NSTimeInterval timeElapsed = (clock_gettime_nsec_np(CLOCK_MONOTONIC_RAW) - timeStarted) / NSEC_PER_SEC;
53
53
  XCTAssertNil(error);
54
54
  XCTAssertEqualWithAccuracy(timeElapsed, backgroundDuration, 3.0);
55
55
  XCTAssertTrue(self.testedApplication.buttons[@"Alerts"].exists);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appium-webdriveragent",
3
- "version": "4.10.7",
3
+ "version": "4.10.8",
4
4
  "description": "Package bundling WebDriverAgent",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {