appium-webdriveragent 8.9.0 → 8.9.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
@@ -1,3 +1,15 @@
1
+ ## [8.9.2](https://github.com/appium/WebDriverAgent/compare/v8.9.1...v8.9.2) (2024-09-13)
2
+
3
+ ### Miscellaneous Chores
4
+
5
+ * **deps-dev:** bump sinon from 18.0.1 to 19.0.1 ([#938](https://github.com/appium/WebDriverAgent/issues/938)) ([3ef0093](https://github.com/appium/WebDriverAgent/commit/3ef009317801dca47efe34bd048d3cab2e644ee2))
6
+
7
+ ## [8.9.1](https://github.com/appium/WebDriverAgent/compare/v8.9.0...v8.9.1) (2024-08-09)
8
+
9
+ ### Bug Fixes
10
+
11
+ * Update swizzling of waitForQuiescenceIncludingAnimationsIdle: API for Xcode16-beta5 ([#935](https://github.com/appium/WebDriverAgent/issues/935)) ([2ccc436](https://github.com/appium/WebDriverAgent/commit/2ccc436991ca880a1dfdec688dc8167008fe382d))
12
+
1
13
  ## [8.9.0](https://github.com/appium/WebDriverAgent/compare/v8.8.0...v8.9.0) (2024-08-07)
2
14
 
3
15
  ### Features
@@ -65,7 +65,11 @@
65
65
  - (void)terminate;
66
66
  - (void)waitForViewControllerViewDidDisappearWithTimeout:(double)arg1;
67
67
  - (void)waitForAutomationSession;
68
+ // Before Xcode16-beta5
68
69
  - (void)waitForQuiescenceIncludingAnimationsIdle:(BOOL)arg1;
70
+ // Since Xcode16-beta5
71
+ - (void)waitForQuiescenceIncludingAnimationsIdle:(BOOL)arg1 isPreEvent:(BOOL)arg2;
72
+
69
73
 
70
74
  - (id)shortDescription;
71
75
  - (id)_queue_description;
@@ -65,6 +65,7 @@ static id swizzledSnapshotParameters(id self, SEL _cmd)
65
65
 
66
66
  #pragma clang diagnostic push
67
67
  #pragma clang diagnostic ignored "-Wobjc-load-method"
68
+ #pragma clang diagnostic ignored "-Wcast-function-type-strict"
68
69
 
69
70
  + (void)load
70
71
  {
@@ -20,6 +20,8 @@ static _Bool swizzledShouldInterruptTest(id self, SEL _cmd)
20
20
 
21
21
  #pragma clang diagnostic push
22
22
  #pragma clang diagnostic ignored "-Wobjc-load-method"
23
+ #pragma clang diagnostic ignored "-Wcast-function-type-strict"
24
+
23
25
  + (void)load
24
26
  {
25
27
  SEL originalShouldInterruptTest = NSSelectorFromString(@"shouldInterruptTest");
@@ -28,6 +30,7 @@ static _Bool swizzledShouldInterruptTest(id self, SEL _cmd)
28
30
  if (nil == originalShouldInterruptTestMethod) return;
29
31
  method_setImplementation(originalShouldInterruptTestMethod, (IMP)swizzledShouldInterruptTest);
30
32
  }
33
+
31
34
  #pragma clang diagnostic pop
32
35
 
33
36
  @end
@@ -18,6 +18,11 @@ NS_ASSUME_NONNULL_BEGIN
18
18
  /*! Defines wtether the process should perform quiescence checks. YES by default */
19
19
  @property (nonatomic) NSNumber* fb_shouldWaitForQuiescence;
20
20
 
21
+ /**
22
+ @param waitForAnimations Set it to YES if XCTest should also wait for application animations to complete
23
+ */
24
+ - (void)fb_waitForQuiescenceIncludingAnimationsIdle:(bool)waitForAnimations;
25
+
21
26
  @end
22
27
 
23
28
  NS_ASSUME_NONNULL_END
@@ -12,10 +12,12 @@
12
12
  #import <objc/runtime.h>
13
13
 
14
14
  #import "FBConfiguration.h"
15
+ #import "FBExceptions.h"
15
16
  #import "FBLogger.h"
16
17
  #import "FBSettings.h"
17
18
 
18
19
  static void (*original_waitForQuiescenceIncludingAnimationsIdle)(id, SEL, BOOL);
20
+ static void (*original_waitForQuiescenceIncludingAnimationsIdlePreEvent)(id, SEL, BOOL, BOOL);
19
21
 
20
22
  static void swizzledWaitForQuiescenceIncludingAnimationsIdle(id self, SEL _cmd, BOOL includingAnimations)
21
23
  {
@@ -38,17 +40,43 @@ static void swizzledWaitForQuiescenceIncludingAnimationsIdle(id self, SEL _cmd,
38
40
  }
39
41
  }
40
42
 
43
+ static void swizzledWaitForQuiescenceIncludingAnimationsIdlePreEvent(id self, SEL _cmd, BOOL includingAnimations, BOOL isPreEvent)
44
+ {
45
+ NSString *bundleId = [self bundleID];
46
+ if (![[self fb_shouldWaitForQuiescence] boolValue] || FBConfiguration.waitForIdleTimeout < DBL_EPSILON) {
47
+ [FBLogger logFmt:@"Quiescence checks are disabled for %@ application. Making it to believe it is idling",
48
+ bundleId];
49
+ return;
50
+ }
51
+
52
+ NSTimeInterval desiredTimeout = FBConfiguration.waitForIdleTimeout;
53
+ NSTimeInterval previousTimeout = _XCTApplicationStateTimeout();
54
+ _XCTSetApplicationStateTimeout(desiredTimeout);
55
+ [FBLogger logFmt:@"Waiting up to %@s until %@ is in idle state (%@ animations)",
56
+ @(desiredTimeout), bundleId, includingAnimations ? @"including" : @"excluding"];
57
+ @try {
58
+ original_waitForQuiescenceIncludingAnimationsIdlePreEvent(self, _cmd, includingAnimations, isPreEvent);
59
+ } @finally {
60
+ _XCTSetApplicationStateTimeout(previousTimeout);
61
+ }
62
+ }
63
+
41
64
  @implementation XCUIApplicationProcess (FBQuiescence)
42
65
 
43
66
  #pragma clang diagnostic push
44
67
  #pragma clang diagnostic ignored "-Wobjc-load-method"
68
+ #pragma clang diagnostic ignored "-Wcast-function-type-strict"
45
69
 
46
70
  + (void)load
47
71
  {
48
72
  Method waitForQuiescenceIncludingAnimationsIdleMethod = class_getInstanceMethod(self.class, @selector(waitForQuiescenceIncludingAnimationsIdle:));
73
+ Method waitForQuiescenceIncludingAnimationsIdlePreEventMethod = class_getInstanceMethod(self.class, @selector(waitForQuiescenceIncludingAnimationsIdle:isPreEvent:));
49
74
  if (nil != waitForQuiescenceIncludingAnimationsIdleMethod) {
50
75
  IMP swizzledImp = (IMP)swizzledWaitForQuiescenceIncludingAnimationsIdle;
51
76
  original_waitForQuiescenceIncludingAnimationsIdle = (void (*)(id, SEL, BOOL)) method_setImplementation(waitForQuiescenceIncludingAnimationsIdleMethod, swizzledImp);
77
+ } else if (nil != waitForQuiescenceIncludingAnimationsIdlePreEventMethod) {
78
+ IMP swizzledImp = (IMP)swizzledWaitForQuiescenceIncludingAnimationsIdlePreEvent;
79
+ original_waitForQuiescenceIncludingAnimationsIdlePreEvent = (void (*)(id, SEL, BOOL, BOOL)) method_setImplementation(waitForQuiescenceIncludingAnimationsIdlePreEventMethod, swizzledImp);
52
80
  } else {
53
81
  [FBLogger log:@"Could not find method -[XCUIApplicationProcess waitForQuiescenceIncludingAnimationsIdle:]"];
54
82
  }
@@ -74,4 +102,18 @@ static char XCUIAPPLICATIONPROCESS_SHOULD_WAIT_FOR_QUIESCENCE;
74
102
  objc_setAssociatedObject(self, &XCUIAPPLICATIONPROCESS_SHOULD_WAIT_FOR_QUIESCENCE, value, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
75
103
  }
76
104
 
105
+ - (void)fb_waitForQuiescenceIncludingAnimationsIdle:(bool)waitForAnimations
106
+ {
107
+ if ([self respondsToSelector:@selector(waitForQuiescenceIncludingAnimationsIdle:)]) {
108
+ [self waitForQuiescenceIncludingAnimationsIdle:waitForAnimations];
109
+ } else if ([self respondsToSelector:@selector(waitForQuiescenceIncludingAnimationsIdle:isPreEvent:)]) {
110
+ [self waitForQuiescenceIncludingAnimationsIdle:waitForAnimations isPreEvent:NO];
111
+ } else {
112
+ @throw [NSException exceptionWithName:FBIncompatibleWdaException
113
+ reason:@"The current WebDriverAgent build is not compatible to your device OS version"
114
+ userInfo:@{}];
115
+ }
116
+ }
117
+
118
+
77
119
  @end
@@ -42,6 +42,7 @@ static void swizzled_validatePredicateWithExpressionsAllowed(id self, SEL _cmd,
42
42
 
43
43
  #pragma clang diagnostic push
44
44
  #pragma clang diagnostic ignored "-Wobjc-load-method"
45
+ #pragma clang diagnostic ignored "-Wcast-function-type-strict"
45
46
  + (void)load
46
47
  {
47
48
  Class XCElementSnapshotCls = objc_lookUpClass("XCElementSnapshot");
@@ -31,6 +31,7 @@
31
31
  #import "XCTElementSetTransformer-Protocol.h"
32
32
  #import "XCTestPrivateSymbols.h"
33
33
  #import "XCTRunnerDaemonSession.h"
34
+ #import "XCUIApplicationProcess+FBQuiescence.h"
34
35
  #import "XCUIElement+FBCaching.h"
35
36
  #import "XCUIElement+FBWebDriverAttributes.h"
36
37
  #import "XCUIElementQuery.h"
@@ -190,7 +191,7 @@
190
191
  self.application.fb_shouldWaitForQuiescence = YES;
191
192
  }
192
193
  [[[self.application applicationImpl] currentProcess]
193
- waitForQuiescenceIncludingAnimationsIdle:YES];
194
+ fb_waitForQuiescenceIncludingAnimationsIdle:YES];
194
195
  if (previousQuiescence != self.application.fb_shouldWaitForQuiescence) {
195
196
  self.application.fb_shouldWaitForQuiescence = previousQuiescence;
196
197
  }
@@ -15,11 +15,11 @@
15
15
  <key>CFBundlePackageType</key>
16
16
  <string>FMWK</string>
17
17
  <key>CFBundleShortVersionString</key>
18
- <string>8.9.0</string>
18
+ <string>8.9.2</string>
19
19
  <key>CFBundleSignature</key>
20
20
  <string>????</string>
21
21
  <key>CFBundleVersion</key>
22
- <string>8.9.0</string>
22
+ <string>8.9.2</string>
23
23
  <key>NSPrincipalClass</key>
24
24
  <string/>
25
25
  </dict>
@@ -55,4 +55,7 @@ extern NSString *const FBApplicationCrashedException;
55
55
  /*! Exception used to notify about the application is not installed */
56
56
  extern NSString *const FBApplicationMissingException;
57
57
 
58
+ /*! Exception used to notify about WDA incompatibility with the current platform version */
59
+ extern NSString *const FBIncompatibleWdaException;
60
+
58
61
  NS_ASSUME_NONNULL_END
@@ -22,3 +22,4 @@ NSString *const FBXPathQueryEvaluationException = @"FBXPathQueryEvaluationExcept
22
22
  NSString *const FBClassChainQueryParseException = @"FBClassChainQueryParseException";
23
23
  NSString *const FBApplicationCrashedException = @"FBApplicationCrashedException";
24
24
  NSString *const FBApplicationMissingException = @"FBApplicationMissingException";
25
+ NSString *const FBIncompatibleWdaException = @"FBIncompatibleWdaException";
@@ -39,7 +39,10 @@ static NSString *const FBRouteSessionPrefix = @"/session/:sessionID";
39
39
  - (void)mountRequest:(FBRouteRequest *)request intoResponse:(RouteResponse *)response
40
40
  {
41
41
  [self decorateRequest:request];
42
+ #pragma clang diagnostic push
43
+ #pragma clang diagnostic ignored "-Wcast-function-type-strict"
42
44
  id<FBResponsePayload> (*requestMsgSend)(id, SEL, FBRouteRequest *) = ((id<FBResponsePayload>(*)(id, SEL, FBRouteRequest *))objc_msgSend);
45
+ #pragma clang diagnostic pop
43
46
  id<FBResponsePayload> payload = requestMsgSend(self.target, self.action, request);
44
47
  [payload dispatchWithResponse:response];
45
48
  }
@@ -73,9 +73,12 @@ static void swizzledLaunchApp(id self, SEL _cmd, NSString *path, NSString *bundl
73
73
  [FBLogger log:@"Could not find method -[XCTRunnerDaemonSession launchApplicationWithPath:]"];
74
74
  return;
75
75
  }
76
+ #pragma clang diagnostic push
77
+ #pragma clang diagnostic ignored "-Wcast-function-type-strict"
76
78
  // Workaround for https://github.com/appium/WebDriverAgent/issues/702
77
79
  originalLaunchAppMethod = (void(*)(id, SEL, NSString*, NSString*, NSArray*, NSDictionary*, void (^)(_Bool, NSError *))) method_getImplementation(original);
78
80
  method_setImplementation(original, (IMP)swizzledLaunchApp);
81
+ #pragma clang diagnostic pop
79
82
  }
80
83
 
81
84
  + (id<XCTestManager_ManagerInterface>)testRunnerProxy
@@ -61,7 +61,10 @@ static NSLock * lock = nil;
61
61
  [FBLogger log:@"Could not find method -[XCUIApplicationProcess setEventLoopHasIdled:]"];
62
62
  return;
63
63
  }
64
+ #pragma clang diagnostic push
65
+ #pragma clang diagnostic ignored "-Wcast-function-type-strict"
64
66
  orig_set_event_loop_has_idled = (void(*)(id, SEL, BOOL)) method_getImplementation(original);
67
+ #pragma clang diagnostic pop
65
68
  Method replace = class_getClassMethod([XCUIApplicationProcessDelay class], @selector(setEventLoopHasIdled:));
66
69
  method_setImplementation(original, method_getImplementation(replace));
67
70
  isSwizzled = YES;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appium-webdriveragent",
3
- "version": "8.9.0",
3
+ "version": "8.9.2",
4
4
  "description": "Package bundling WebDriverAgent",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -68,7 +68,7 @@
68
68
  "prettier": "^3.0.0",
69
69
  "semantic-release": "^24.0.0",
70
70
  "semver": "^7.3.7",
71
- "sinon": "^18.0.0",
71
+ "sinon": "^19.0.1",
72
72
  "ts-node": "^10.9.1",
73
73
  "typescript": "^5.4.2"
74
74
  },