appium-webdriveragent 9.3.2 → 9.4.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## [9.4.0](https://github.com/appium/WebDriverAgent/compare/v9.3.3...v9.4.0) (2025-04-02)
2
+
3
+ ### Features
4
+
5
+ * Always apply the native snapshotting strategy for XCUIApplication instances ([#998](https://github.com/appium/WebDriverAgent/issues/998)) ([60f5aef](https://github.com/appium/WebDriverAgent/commit/60f5aeffdda85faffd60aba416dc9d92987f19ac))
6
+
7
+ ## [9.3.3](https://github.com/appium/WebDriverAgent/compare/v9.3.2...v9.3.3) (2025-03-27)
8
+
9
+ ### Bug Fixes
10
+
11
+ * Properly set snapshot lookup scope if limitXpathContextScope is disabled ([#996](https://github.com/appium/WebDriverAgent/issues/996)) ([03ca7cd](https://github.com/appium/WebDriverAgent/commit/03ca7cd27b7cd92a45b344eb661db973c5dde809))
12
+
1
13
  ## [9.3.2](https://github.com/appium/WebDriverAgent/compare/v9.3.1...v9.3.2) (2025-03-26)
2
14
 
3
15
  ### Bug Fixes
@@ -12,6 +12,7 @@
12
12
 
13
13
  #import "FBMacros.h"
14
14
  #import "FBElementTypeTransformer.h"
15
+ #import "FBConfiguration.h"
15
16
  #import "NSPredicate+FBFormat.h"
16
17
  #import "FBXCElementSnapshotWrapper+Helpers.h"
17
18
  #import "FBXCodeCompatibility.h"
@@ -109,8 +110,9 @@
109
110
  id<FBXCElementSnapshot> snapshot = matchingSnapshots.firstObject;
110
111
  matchingSnapshots = @[snapshot];
111
112
  }
112
- return [self fb_filterDescendantsWithSnapshots:matchingSnapshots
113
- onlyChildren:NO];
113
+ XCUIElement *scopeRoot = FBConfiguration.limitXpathContextScope ? self : self.application;
114
+ return [scopeRoot fb_filterDescendantsWithSnapshots:matchingSnapshots
115
+ onlyChildren:NO];
114
116
  }
115
117
 
116
118
 
@@ -49,7 +49,7 @@
49
49
  __block id<FBXCElementSnapshot> snapshot = nil;
50
50
  @autoreleasepool {
51
51
  NSError *error = nil;
52
- snapshot = inDepth
52
+ snapshot = inDepth && ![self isKindOfClass:XCUIApplication.class]
53
53
  ? [self.fb_query fb_uniqueSnapshotWithError:&error]
54
54
  : (id<FBXCElementSnapshot>)[self snapshotWithError:&error];
55
55
  if (nil == snapshot) {
@@ -15,11 +15,11 @@
15
15
  <key>CFBundlePackageType</key>
16
16
  <string>FMWK</string>
17
17
  <key>CFBundleShortVersionString</key>
18
- <string>9.3.2</string>
18
+ <string>9.4.0</string>
19
19
  <key>CFBundleSignature</key>
20
20
  <string>????</string>
21
21
  <key>CFBundleVersion</key>
22
- <string>9.3.2</string>
22
+ <string>9.4.0</string>
23
23
  <key>NSPrincipalClass</key>
24
24
  <string/>
25
25
  </dict>
@@ -108,12 +108,24 @@
108
108
  [FBXCElementSnapshotWrapper ensureWrapped:[parentSnapshots objectAtIndex:0]].wdLabel,
109
109
  @"MainView"
110
110
  );
111
+ NSArray *elements = [button.application fb_filterDescendantsWithSnapshots:parentSnapshots onlyChildren:NO];
112
+ XCTAssertEqual(elements.count, 1);
113
+ XCTAssertEqualObjects(
114
+ [[elements objectAtIndex:0] wdLabel],
115
+ @"MainView"
116
+ );
111
117
  NSArray *currentSnapshots = [FBXPath matchesWithRootElement:button forQuery:@"."];
112
118
  XCTAssertEqual(currentSnapshots.count, 1);
113
119
  XCTAssertEqualObjects(
114
120
  [FBXCElementSnapshotWrapper ensureWrapped:[currentSnapshots objectAtIndex:0]].wdType,
115
121
  @"XCUIElementTypeButton"
116
122
  );
123
+ NSArray *currentElements = [button.application fb_filterDescendantsWithSnapshots:currentSnapshots onlyChildren:NO];
124
+ XCTAssertEqual(currentElements.count, 1);
125
+ XCTAssertEqualObjects(
126
+ [[currentElements objectAtIndex:0] wdType],
127
+ @"XCUIElementTypeButton"
128
+ );
117
129
  } @finally {
118
130
  FBConfiguration.limitXpathContextScope = previousValue;
119
131
  }
@@ -20,6 +20,23 @@
20
20
  #import "XCUIElement+FBIsVisible.h"
21
21
  #import "FBXCodeCompatibility.h"
22
22
 
23
+ void calculateMaxTreeDepth(NSDictionary *tree, NSNumber *currentDepth, NSNumber** maxDepth) {
24
+ if (nil == maxDepth) {
25
+ return;
26
+ }
27
+
28
+ NSArray *children = tree[@"children"];
29
+ if (nil == children || 0 == children.count) {
30
+ return;
31
+ }
32
+ for (NSDictionary *child in children) {
33
+ if (currentDepth.integerValue > [*maxDepth integerValue]) {
34
+ *maxDepth = currentDepth;
35
+ }
36
+ calculateMaxTreeDepth(child, @(currentDepth.integerValue + 1), maxDepth);
37
+ }
38
+ }
39
+
23
40
  @interface XCUIApplicationHelperTests : FBIntegrationTestCase
24
41
  @end
25
42
 
@@ -40,7 +57,11 @@
40
57
 
41
58
  - (void)testApplicationTree
42
59
  {
43
- XCTAssertNotNil(self.testedApplication.fb_tree);
60
+ NSDictionary *tree = self.testedApplication.fb_tree;
61
+ XCTAssertNotNil(tree);
62
+ NSNumber *maxDepth;
63
+ calculateMaxTreeDepth(tree, @0, &maxDepth);
64
+ XCTAssertGreaterThan(maxDepth.integerValue, 3);
44
65
  XCTAssertNotNil(self.testedApplication.fb_accessibilityTree);
45
66
  }
46
67
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appium-webdriveragent",
3
- "version": "9.3.2",
3
+ "version": "9.4.0",
4
4
  "description": "Package bundling WebDriverAgent",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",