4444
4545@implementation XCUIElement (FBUtilities)
4646
47- - (id <FBXCElementSnapshot>)fb_takeSnapshot : (BOOL )isCustom maxDepth : (nullable NSNumber *) maxDepth
47+ - (id <FBXCElementSnapshot>)fb_takeSnapshot : (BOOL )isCustom
4848{
4949 __block id <FBXCElementSnapshot> snapshot = nil ;
5050 @autoreleasepool {
5151 NSError *error = nil ;
52- if (isCustom) {
53- int previousMaxDepth = FBConfiguration.snapshotMaxDepth ;
54- if (nil != maxDepth) {
55- FBConfiguration.snapshotMaxDepth = maxDepth.unsignedIntValue ;
56- }
57- snapshot = [self .fb_query fb_uniqueSnapshotWithError: &error];
58- if (nil != maxDepth) {
59- FBConfiguration.snapshotMaxDepth = previousMaxDepth;
60- }
61- } else {
62- snapshot = (id <FBXCElementSnapshot>)[self snapshotWithError: &error];
63- }
52+ snapshot = isCustom
53+ ? [self .fb_query fb_uniqueSnapshotWithError: &error]
54+ : (id <FBXCElementSnapshot>)[self snapshotWithError: &error];
6455 if (nil == snapshot) {
6556 NSString *hintText = @" Make sure the application UI has the expected state" ;
6657 if (nil != error && [error.localizedDescription containsString: @" Identity Binding" ]) {
@@ -80,17 +71,12 @@ @implementation XCUIElement (FBUtilities)
8071
8172- (id <FBXCElementSnapshot>)fb_standardSnapshot
8273{
83- return [self fb_takeSnapshot: NO maxDepth: nil ];
74+ return [self fb_takeSnapshot: NO ];
8475}
8576
8677- (id <FBXCElementSnapshot>)fb_customSnapshot
8778{
88- return [self fb_takeSnapshot: YES maxDepth: nil ];
89- }
90-
91- - (id <FBXCElementSnapshot>)fb_customSnapshotWithMaxDepth : (NSUInteger )maxDepth
92- {
93- return [self fb_takeSnapshot: YES maxDepth: @(maxDepth)];
79+ return [self fb_takeSnapshot: YES ];
9480}
9581
9682- (id <FBXCElementSnapshot>)fb_cachedSnapshot
0 commit comments