appium-webdriveragent 4.10.6 → 4.10.7

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.7](https://github.com/appium/WebDriverAgent/compare/v4.10.6...v4.10.7) (2022-11-24)
2
+
1
3
  ## [4.10.6](https://github.com/appium/WebDriverAgent/compare/v4.10.5...v4.10.6) (2022-11-23)
2
4
 
3
5
  ## [4.10.5](https://github.com/appium/WebDriverAgent/compare/v4.10.4...v4.10.5) (2022-11-22)
@@ -48,7 +48,7 @@ static char XCUIELEMENT_CACHE_ID_KEY;
48
48
  uid = self.fb_uid;
49
49
  } else {
50
50
  id<FBXCElementSnapshot> snapshot = self.fb_cachedSnapshot ?: self.fb_takeSnapshot;
51
- uid = [FBXCElementSnapshotWrapper ensureWrapped:snapshot].wdUID;
51
+ uid = [FBXCElementSnapshotWrapper wdUIDWithSnapshot:snapshot];
52
52
  }
53
53
 
54
54
  objc_setAssociatedObject(self, &XCUIELEMENT_CACHE_ID_KEY, uid, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
@@ -34,9 +34,9 @@
34
34
 
35
35
  @implementation FBXCElementSnapshotWrapper (FBIsVisible)
36
36
 
37
- - (NSString *)fb_uniqId
37
+ + (NSString *)fb_uniqIdWithSnapshot:(id<FBXCElementSnapshot>)snapshot
38
38
  {
39
- return self.fb_uid ?: [NSString stringWithFormat:@"%p", (void *)self];
39
+ return [FBXCElementSnapshotWrapper wdUIDWithSnapshot:snapshot] ?: [NSString stringWithFormat:@"%p", (void *)snapshot];
40
40
  }
41
41
 
42
42
  - (nullable NSNumber *)fb_cachedVisibilityValue
@@ -46,14 +46,14 @@
46
46
  return nil;
47
47
  }
48
48
 
49
- NSDictionary<NSString *, NSNumber *> *result = [cache objectForKey:@(self.generation)];
49
+ NSDictionary<NSString *, NSNumber *> *result = cache[@(self.generation)];
50
50
  if (nil == result) {
51
51
  // There is no need to keep the cached data for the previous generations
52
52
  [cache removeAllObjects];
53
- [cache setObject:[NSMutableDictionary dictionary] forKey:@(self.generation)];
53
+ cache[@(self.generation)] = [NSMutableDictionary dictionary];
54
54
  return nil;
55
55
  }
56
- return [result objectForKey:self.fb_uniqId];
56
+ return result[[self.class fb_uniqIdWithSnapshot:self.snapshot]];
57
57
  }
58
58
 
59
59
  - (BOOL)fb_cacheVisibilityWithValue:(BOOL)isVisible
@@ -63,19 +63,19 @@
63
63
  if (nil == cache) {
64
64
  return isVisible;
65
65
  }
66
- NSMutableDictionary<NSString *, NSNumber *> *destination = [cache objectForKey:@(self.generation)];
66
+ NSMutableDictionary<NSString *, NSNumber *> *destination = cache[@(self.generation)];
67
67
  if (nil == destination) {
68
68
  return isVisible;
69
69
  }
70
70
 
71
71
  NSNumber *visibleObj = [NSNumber numberWithBool:isVisible];
72
- [destination setObject:visibleObj forKey:self.fb_uniqId];
72
+ destination[[self.class fb_uniqIdWithSnapshot:self.snapshot]] = visibleObj;
73
73
  if (isVisible && nil != ancestors) {
74
74
  // if an element is visible then all its ancestors must be visible as well
75
75
  for (id<FBXCElementSnapshot> ancestor in ancestors) {
76
- NSString *ancestorId = [FBXCElementSnapshotWrapper ensureWrapped:ancestor].fb_uniqId;
77
- if (nil == [destination objectForKey:ancestorId]) {
78
- [destination setObject:visibleObj forKey:ancestorId];
76
+ NSString *ancestorId = [self.class fb_uniqIdWithSnapshot:ancestor];
77
+ if (nil == destination[ancestorId]) {
78
+ destination[ancestorId] = visibleObj;
79
79
  }
80
80
  }
81
81
  }
@@ -41,8 +41,9 @@ static char XCUIELEMENT_IS_RESOLVED_NATIVELY_KEY;
41
41
  XCUIElementQuery *query = [self isKindOfClass:XCUIApplication.class]
42
42
  ? self.application.fb_query
43
43
  : [self.application.fb_query descendantsMatchingType:XCUIElementTypeAny];
44
- FBXCElementSnapshotWrapper *cachedSnapshot = [FBXCElementSnapshotWrapper ensureWrapped:self.fb_cachedSnapshot];
45
- NSString *uid = nil == cachedSnapshot ? self.fb_uid : cachedSnapshot.fb_uid;
44
+ NSString *uid = nil == self.fb_cachedSnapshot
45
+ ? self.fb_uid
46
+ : [FBXCElementSnapshotWrapper wdUIDWithSnapshot:(id)self.fb_cachedSnapshot];
46
47
  if (nil == uid) {
47
48
  return self;
48
49
  }
@@ -22,6 +22,7 @@
22
22
  #import "XCUIElement+FBClassChain.h"
23
23
  #import "XCUIElement+FBFind.h"
24
24
  #import "XCUIElement+FBIsVisible.h"
25
+ #import "XCUIElement+FBUID.h"
25
26
  #import "XCUIElement+FBUtilities.h"
26
27
  #import "XCUIElement+FBWebDriverAttributes.h"
27
28
 
@@ -88,7 +89,7 @@ static id<FBResponsePayload> FBNoSuchElementErrorResponseForRequest(FBRouteReque
88
89
  && [FBXCElementSnapshotWrapper ensureWrapped:snapshot].wdVisible;
89
90
  }];
90
91
  NSArray *cells = [element fb_filterDescendantsWithSnapshots:visibleCellSnapshots
91
- selfUID:[FBXCElementSnapshotWrapper ensureWrapped:element.lastSnapshot].wdUID
92
+ selfUID:[FBXCElementSnapshotWrapper wdUIDWithSnapshot:element.lastSnapshot]
92
93
  onlyChildren:NO];
93
94
  return FBResponseWithCachedElements(cells, request.session.elementCache, FBConfiguration.shouldUseCompactResponses);
94
95
  }
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appium-webdriveragent",
3
- "version": "4.10.6",
3
+ "version": "4.10.7",
4
4
  "description": "Package bundling WebDriverAgent",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {