appium-webdriveragent 16.1.7 → 16.2.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.
Files changed (38) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/WebDriverAgentLib/Categories/XCUIApplication+FBTouchAction.m +1 -1
  3. package/WebDriverAgentLib/Categories/XCUIApplicationProcess+FBQuiescence.m +4 -4
  4. package/WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m +1 -1
  5. package/WebDriverAgentLib/Categories/XCUIDevice+FBRotation.m +1 -1
  6. package/WebDriverAgentLib/Categories/XCUIElement+FBFind.m +1 -1
  7. package/WebDriverAgentLib/Categories/XCUIElement+FBScrolling.m +1 -1
  8. package/WebDriverAgentLib/Categories/XCUIElement+FBTVFocuse.m +1 -1
  9. package/WebDriverAgentLib/Categories/XCUIElement+FBTyping.m +5 -5
  10. package/WebDriverAgentLib/Categories/XCUIElement+FBUtilities.m +4 -4
  11. package/WebDriverAgentLib/Categories/XCUIElement+FBWebDriverAttributes.m +1 -1
  12. package/WebDriverAgentLib/Commands/FBElementCommands.m +3 -3
  13. package/WebDriverAgentLib/Commands/FBFindElementCommands.m +7 -7
  14. package/WebDriverAgentLib/Commands/FBSessionCommands.m +10 -10
  15. package/WebDriverAgentLib/FBAlert.m +7 -7
  16. package/WebDriverAgentLib/Info.plist +2 -2
  17. package/WebDriverAgentLib/Routing/FBResponsePayload.m +1 -1
  18. package/WebDriverAgentLib/Routing/FBSession.m +3 -3
  19. package/WebDriverAgentLib/Routing/FBWebServer.m +7 -7
  20. package/WebDriverAgentLib/Utilities/FBConfiguration.h +75 -142
  21. package/WebDriverAgentLib/Utilities/FBConfiguration.m +128 -374
  22. package/WebDriverAgentLib/Utilities/FBImageProcessor.m +6 -6
  23. package/WebDriverAgentLib/Utilities/FBLogger.m +2 -2
  24. package/WebDriverAgentLib/Utilities/FBMjpegServer.m +4 -4
  25. package/WebDriverAgentLib/Utilities/FBSettingsHandler.m +65 -61
  26. package/WebDriverAgentLib/Utilities/FBW3CActionsSynthesizer.m +1 -1
  27. package/WebDriverAgentLib/Utilities/FBXCTestDaemonsProxy.m +1 -1
  28. package/WebDriverAgentLib/Utilities/FBXCodeCompatibility.m +2 -2
  29. package/WebDriverAgentLib/Utilities/FBXPath.m +9 -9
  30. package/WebDriverAgentRunner/UITestingUITests.m +7 -7
  31. package/WebDriverAgentTests/IntegrationTests/FBAlertTests.m +5 -5
  32. package/WebDriverAgentTests/IntegrationTests/FBConfigurationTests.m +5 -5
  33. package/WebDriverAgentTests/IntegrationTests/FBIntegrationTestCase.m +6 -6
  34. package/WebDriverAgentTests/IntegrationTests/FBXPathIntegrationTests.m +3 -3
  35. package/WebDriverAgentTests/IntegrationTests/XCUIElementAttributesTests.m +5 -5
  36. package/WebDriverAgentTests/UnitTests/FBConfigurationTests.m +8 -8
  37. package/WebDriverAgentTests/UnitTests/FBSessionTests.m +3 -3
  38. package/package.json +1 -1
@@ -83,14 +83,14 @@ const CGFloat FBMaxCompressionQuality = 1.0f;
83
83
  // We do not want this value to be too high because then we get images larger in size than original ones
84
84
  // Although, we also don't want to lose too much of the quality on recompression
85
85
  CGFloat recompressionQuality = MAX(0.9,
86
- MIN(FBMaxCompressionQuality, (double)FBConfiguration.mjpegServerScreenshotQuality / 100.0));
86
+ MIN(FBMaxCompressionQuality, (double)FBConfiguration.sharedInstance.mjpegServerScreenshotQuality / 100.0));
87
87
  NSData *thumbnailData = [self.class fixedImageDataWithImageData:nextImageData
88
88
  scalingFactor:scalingFactor
89
89
  uti:UTTypeJPEG
90
90
  compressionQuality:recompressionQuality
91
91
  // iOS always returns screenshots in portrait orientation, but puts the real value into the metadata
92
92
  // Use it with care. See https://github.com/appium/WebDriverAgent/pull/812
93
- fixOrientation:FBConfiguration.mjpegShouldFixOrientation
93
+ fixOrientation:FBConfiguration.sharedInstance.mjpegShouldFixOrientation
94
94
  desiredOrientation:nil];
95
95
  NSData *processedImageData = thumbnailData ?: nextImageData;
96
96
  for (void (^handler)(NSData *) in handlers) {
@@ -168,13 +168,13 @@ const CGFloat FBMaxCompressionQuality = 1.0f;
168
168
  {
169
169
  NSNumber *orientation = nil;
170
170
  #if !TARGET_OS_TV
171
- if (FBConfiguration.screenshotOrientation == UIInterfaceOrientationPortrait) {
171
+ if (FBConfiguration.sharedInstance.screenshotOrientation == UIInterfaceOrientationPortrait) {
172
172
  orientation = @(UIImageOrientationUp);
173
- } else if (FBConfiguration.screenshotOrientation == UIInterfaceOrientationPortraitUpsideDown) {
173
+ } else if (FBConfiguration.sharedInstance.screenshotOrientation == UIInterfaceOrientationPortraitUpsideDown) {
174
174
  orientation = @(UIImageOrientationDown);
175
- } else if (FBConfiguration.screenshotOrientation == UIInterfaceOrientationLandscapeLeft) {
175
+ } else if (FBConfiguration.sharedInstance.screenshotOrientation == UIInterfaceOrientationLandscapeLeft) {
176
176
  orientation = @(UIImageOrientationRight);
177
- } else if (FBConfiguration.screenshotOrientation == UIInterfaceOrientationLandscapeRight) {
177
+ } else if (FBConfiguration.sharedInstance.screenshotOrientation == UIInterfaceOrientationLandscapeRight) {
178
178
  orientation = @(UIImageOrientationLeft);
179
179
  }
180
180
  #endif
@@ -27,7 +27,7 @@
27
27
 
28
28
  + (void)verboseLog:(NSString *)message
29
29
  {
30
- if (!FBConfiguration.verboseLoggingEnabled) {
30
+ if (!FBConfiguration.sharedInstance.verboseLoggingEnabled) {
31
31
  return;
32
32
  }
33
33
  [self log:message];
@@ -35,7 +35,7 @@
35
35
 
36
36
  + (void)verboseLogFmt:(NSString *)format, ...
37
37
  {
38
- if (!FBConfiguration.verboseLoggingEnabled) {
38
+ if (!FBConfiguration.sharedInstance.verboseLoggingEnabled) {
39
39
  return;
40
40
  }
41
41
  va_list args;
@@ -94,7 +94,7 @@ static NSUInteger FBNormalizedMjpegFramerate(NSUInteger framerate)
94
94
  if (!self.isStreaming) {
95
95
  return;
96
96
  }
97
- NSUInteger framerate = FBNormalizedMjpegFramerate(FBConfiguration.mjpegServerFramerate);
97
+ NSUInteger framerate = FBNormalizedMjpegFramerate(FBConfiguration.sharedInstance.mjpegServerFramerate);
98
98
  uint64_t timerInterval = (uint64_t)(1.0 / (double)framerate * NSEC_PER_SEC);
99
99
  uint64_t timeStarted = clock_gettime_nsec_np(CLOCK_MONOTONIC_RAW);
100
100
  @synchronized (self.listeningClients) {
@@ -106,7 +106,7 @@ static NSUInteger FBNormalizedMjpegFramerate(NSUInteger framerate)
106
106
 
107
107
  NSError *error;
108
108
  CGFloat compressionQuality = MAX(FBMinCompressionQuality,
109
- MIN(FBMaxCompressionQuality, (double)FBConfiguration.mjpegServerScreenshotQuality / 100.0));
109
+ MIN(FBMaxCompressionQuality, (double)FBConfiguration.sharedInstance.mjpegServerScreenshotQuality / 100.0));
110
110
  NSData *screenshotData = [FBScreenshot takeInOriginalResolutionWithScreenID:self.mainScreenID
111
111
  compressionQuality:compressionQuality
112
112
  uti:UTTypeJPEG
@@ -124,7 +124,7 @@ static NSUInteger FBNormalizedMjpegFramerate(NSUInteger framerate)
124
124
 
125
125
  self.consecutiveScreenshotFailures = 0;
126
126
 
127
- CGFloat scalingFactor = FBConfiguration.mjpegScalingFactor / 100.0;
127
+ CGFloat scalingFactor = FBConfiguration.sharedInstance.mjpegScalingFactor / 100.0;
128
128
  __weak typeof(self) weakSelf = self;
129
129
  [self.imageProcessor submitImageData:screenshotData
130
130
  scalingFactor:scalingFactor
@@ -154,7 +154,7 @@ static NSUInteger FBNormalizedMjpegFramerate(NSUInteger framerate)
154
154
  }
155
155
  self.sentFramesCount++;
156
156
  self.sentBytesCount += chunk.length * clientCount;
157
- NSUInteger framerate = FBNormalizedMjpegFramerate(FBConfiguration.mjpegServerFramerate);
157
+ NSUInteger framerate = FBNormalizedMjpegFramerate(FBConfiguration.sharedInstance.mjpegServerFramerate);
158
158
  if (0 == self.sentFramesCount % framerate) {
159
159
  [FBLogger verboseLog:[NSString stringWithFormat:@"MJPEG stats: clients=%@ sentFrames=%@ sentBytes=%@",
160
160
  @(clientCount),
@@ -47,63 +47,67 @@ static NSSet<NSString *> *FBNilClearableSettingKeys(void)
47
47
  dispatch_once(&onceToken, ^{
48
48
  NSMutableDictionary<NSString *, FBSettingApplyBlock> *map = [NSMutableDictionary dictionary];
49
49
  map[FB_SETTING_USE_COMPACT_RESPONSES] = ^FBCommandStatus *(FBSession *session, id value) {
50
- [FBConfiguration setShouldUseCompactResponses:[value boolValue]];
50
+ FBConfiguration.sharedInstance.shouldUseCompactResponses = [value boolValue];
51
51
  return nil;
52
52
  };
53
53
  map[FB_SETTING_ELEMENT_RESPONSE_ATTRIBUTES] = ^FBCommandStatus *(FBSession *session, id value) {
54
- [FBConfiguration setElementResponseAttributes:(NSString *)value];
54
+ FBConfiguration.sharedInstance.elementResponseAttributes = (NSString *)value;
55
55
  return nil;
56
56
  };
57
57
  map[FB_SETTING_MJPEG_SERVER_SCREENSHOT_QUALITY] = ^FBCommandStatus *(FBSession *session, id value) {
58
- [FBConfiguration setMjpegServerScreenshotQuality:[value unsignedIntegerValue]];
58
+ FBConfiguration.sharedInstance.mjpegServerScreenshotQuality = [value unsignedIntegerValue];
59
59
  return nil;
60
60
  };
61
61
  map[FB_SETTING_MJPEG_SERVER_FRAMERATE] = ^FBCommandStatus *(FBSession *session, id value) {
62
- [FBConfiguration setMjpegServerFramerate:[value unsignedIntegerValue]];
62
+ FBConfiguration.sharedInstance.mjpegServerFramerate = [value unsignedIntegerValue];
63
63
  return nil;
64
64
  };
65
65
  map[FB_SETTING_SCREENSHOT_QUALITY] = ^FBCommandStatus *(FBSession *session, id value) {
66
- [FBConfiguration setScreenshotQuality:[value unsignedIntegerValue]];
66
+ FBConfiguration.sharedInstance.screenshotQuality = [value unsignedIntegerValue];
67
67
  return nil;
68
68
  };
69
69
  map[FB_SETTING_MJPEG_SCALING_FACTOR] = ^FBCommandStatus *(FBSession *session, id value) {
70
- [FBConfiguration setMjpegScalingFactor:[value floatValue]];
70
+ FBConfiguration.sharedInstance.mjpegScalingFactor = [value floatValue];
71
71
  return nil;
72
72
  };
73
73
  map[FB_SETTING_MJPEG_FIX_ORIENTATION] = ^FBCommandStatus *(FBSession *session, id value) {
74
- [FBConfiguration setMjpegShouldFixOrientation:[value boolValue]];
74
+ FBConfiguration.sharedInstance.mjpegShouldFixOrientation = [value boolValue];
75
75
  return nil;
76
76
  };
77
77
  map[FB_SETTING_KEYBOARD_AUTOCORRECTION] = ^FBCommandStatus *(FBSession *session, id value) {
78
- [FBConfiguration setKeyboardAutocorrection:[value boolValue]];
78
+ FBConfiguration.sharedInstance.keyboardAutocorrection = [value boolValue]
79
+ ? FBConfigurationKeyboardPreferenceEnabled
80
+ : FBConfigurationKeyboardPreferenceDisabled;
79
81
  return nil;
80
82
  };
81
83
  map[FB_SETTING_KEYBOARD_PREDICTION] = ^FBCommandStatus *(FBSession *session, id value) {
82
- [FBConfiguration setKeyboardPrediction:[value boolValue]];
84
+ FBConfiguration.sharedInstance.keyboardPrediction = [value boolValue]
85
+ ? FBConfigurationKeyboardPreferenceEnabled
86
+ : FBConfigurationKeyboardPreferenceDisabled;
83
87
  return nil;
84
88
  };
85
89
  map[FB_SETTING_RESPECT_SYSTEM_ALERTS] = ^FBCommandStatus *(FBSession *session, id value) {
86
- [FBConfiguration setShouldRespectSystemAlerts:[value boolValue]];
90
+ FBConfiguration.sharedInstance.shouldRespectSystemAlerts = [value boolValue];
87
91
  return nil;
88
92
  };
89
93
  map[FB_SETTING_SNAPSHOT_MAX_DEPTH] = ^FBCommandStatus *(FBSession *session, id value) {
90
- [FBConfiguration setSnapshotMaxDepth:[value intValue]];
94
+ FBConfiguration.sharedInstance.snapshotMaxDepth = [value intValue];
91
95
  return nil;
92
96
  };
93
97
  map[FB_SETTING_SNAPSHOT_MAX_CHILDREN] = ^FBCommandStatus *(FBSession *session, id value) {
94
- [FBConfiguration setSnapshotMaxChildren:[value intValue]];
98
+ FBConfiguration.sharedInstance.snapshotMaxChildren = [value intValue];
95
99
  return nil;
96
100
  };
97
101
  map[FB_SETTING_USE_FIRST_MATCH] = ^FBCommandStatus *(FBSession *session, id value) {
98
- [FBConfiguration setUseFirstMatch:[value boolValue]];
102
+ FBConfiguration.sharedInstance.useFirstMatch = [value boolValue];
99
103
  return nil;
100
104
  };
101
105
  map[FB_SETTING_BOUND_ELEMENTS_BY_INDEX] = ^FBCommandStatus *(FBSession *session, id value) {
102
- [FBConfiguration setBoundElementsByIndex:[value boolValue]];
106
+ FBConfiguration.sharedInstance.boundElementsByIndex = [value boolValue];
103
107
  return nil;
104
108
  };
105
109
  map[FB_SETTING_REDUCE_MOTION] = ^FBCommandStatus *(FBSession *session, id value) {
106
- [FBConfiguration setReduceMotionEnabled:[value boolValue]];
110
+ FBConfiguration.sharedInstance.reduceMotionEnabled = [value boolValue];
107
111
  return nil;
108
112
  };
109
113
  map[FB_SETTING_DEFAULT_ACTIVE_APPLICATION] = ^FBCommandStatus *(FBSession *session, id value) {
@@ -120,22 +124,22 @@ static NSSet<NSString *> *FBNilClearableSettingKeys(void)
120
124
  return nil;
121
125
  };
122
126
  map[FB_SETTING_ACCEPT_ALERT_BUTTON_SELECTOR] = ^FBCommandStatus *(FBSession *session, id value) {
123
- [FBConfiguration setAcceptAlertButtonSelector:(NSString *)value];
127
+ FBConfiguration.sharedInstance.acceptAlertButtonSelector = (NSString *)value;
124
128
  return nil;
125
129
  };
126
130
  map[FB_SETTING_DISMISS_ALERT_BUTTON_SELECTOR] = ^FBCommandStatus *(FBSession *session, id value) {
127
- [FBConfiguration setDismissAlertButtonSelector:(NSString *)value];
131
+ FBConfiguration.sharedInstance.dismissAlertButtonSelector = (NSString *)value;
128
132
  return nil;
129
133
  };
130
134
  map[FB_SETTING_AUTO_CLICK_ALERT_SELECTOR] = ^FBCommandStatus *(FBSession *session, id value) {
131
135
  return [self configureAutoClickAlertWithSelector:(NSString *)value forSession:session];
132
136
  };
133
137
  map[FB_SETTING_WAIT_FOR_IDLE_TIMEOUT] = ^FBCommandStatus *(FBSession *session, id value) {
134
- [FBConfiguration setWaitForIdleTimeout:[value doubleValue]];
138
+ FBConfiguration.sharedInstance.waitForIdleTimeout = [value doubleValue];
135
139
  return nil;
136
140
  };
137
141
  map[FB_SETTING_ANIMATION_COOL_OFF_TIMEOUT] = ^FBCommandStatus *(FBSession *session, id value) {
138
- [FBConfiguration setAnimationCoolOffTimeout:[value doubleValue]];
142
+ FBConfiguration.sharedInstance.animationCoolOffTimeout = [value doubleValue];
139
143
  return nil;
140
144
  };
141
145
  map[FB_SETTING_DEFAULT_ALERT_ACTION] = ^FBCommandStatus *(FBSession *session, id value) {
@@ -147,45 +151,45 @@ static NSSet<NSString *> *FBNilClearableSettingKeys(void)
147
151
  return nil;
148
152
  };
149
153
  map[FB_SETTING_MAX_TYPING_FREQUENCY] = ^FBCommandStatus *(FBSession *session, id value) {
150
- [FBConfiguration setMaxTypingFrequency:[value unsignedIntegerValue]];
154
+ FBConfiguration.sharedInstance.maxTypingFrequency = [value unsignedIntegerValue];
151
155
  return nil;
152
156
  };
153
157
  map[FB_SETTING_USE_CLEAR_TEXT_SHORTCUT] = ^FBCommandStatus *(FBSession *session, id value) {
154
- [FBConfiguration setUseClearTextShortcut:[value boolValue]];
158
+ FBConfiguration.sharedInstance.useClearTextShortcut = [value boolValue];
155
159
  return nil;
156
160
  };
157
161
  map[FB_SETTING_INCLUDE_HITTABLE_IN_PAGE_SOURCE] = ^FBCommandStatus *(FBSession *session, id value) {
158
- [FBConfiguration setIncludeHittableInPageSource:[value boolValue]];
162
+ FBConfiguration.sharedInstance.includeHittableInPageSource = [value boolValue];
159
163
  return nil;
160
164
  };
161
165
  map[FB_SETTING_INCLUDE_NATIVE_FRAME_IN_PAGE_SOURCE] = ^FBCommandStatus *(FBSession *session, id value) {
162
- [FBConfiguration setIncludeNativeFrameInPageSource:[value boolValue]];
166
+ FBConfiguration.sharedInstance.includeNativeFrameInPageSource = [value boolValue];
163
167
  return nil;
164
168
  };
165
169
  map[FB_SETTING_INCLUDE_NATIVE_ACCESSIBILITY_ELEMENT_IN_PAGE_SOURCE] = ^FBCommandStatus *(FBSession *session, id value) {
166
- [FBConfiguration setIncludeNativeAccessibilityElementInPageSource:[value boolValue]];
170
+ FBConfiguration.sharedInstance.includeNativeAccessibilityElementInPageSource = [value boolValue];
167
171
  return nil;
168
172
  };
169
173
  map[FB_SETTING_INCLUDE_MIN_MAX_VALUE_IN_PAGE_SOURCE] = ^FBCommandStatus *(FBSession *session, id value) {
170
- [FBConfiguration setIncludeMinMaxValueInPageSource:[value boolValue]];
174
+ FBConfiguration.sharedInstance.includeMinMaxValueInPageSource = [value boolValue];
171
175
  return nil;
172
176
  };
173
177
  map[FB_SETTING_INCLUDE_CUSTOM_ACTIONS_IN_PAGE_SOURCE] = ^FBCommandStatus *(FBSession *session, id value) {
174
- [FBConfiguration setIncludeCustomActionsInPageSource:[value boolValue]];
178
+ FBConfiguration.sharedInstance.includeCustomActionsInPageSource = [value boolValue];
175
179
  return nil;
176
180
  };
177
181
  map[FB_SETTING_ENFORCE_CUSTOM_SNAPSHOTS] = ^FBCommandStatus *(FBSession *session, id value) {
178
- [FBConfiguration setEnforceCustomSnapshots:[value boolValue]];
182
+ FBConfiguration.sharedInstance.enforceCustomSnapshots = [value boolValue];
179
183
  return nil;
180
184
  };
181
185
  map[FB_SETTING_LIMIT_XPATH_CONTEXT_SCOPE] = ^FBCommandStatus *(FBSession *session, id value) {
182
- [FBConfiguration setLimitXpathContextScope:[value boolValue]];
186
+ FBConfiguration.sharedInstance.limitXpathContextScope = [value boolValue];
183
187
  return nil;
184
188
  };
185
189
  #if !TARGET_OS_TV
186
190
  map[FB_SETTING_SCREENSHOT_ORIENTATION] = ^FBCommandStatus *(FBSession *session, id value) {
187
191
  NSError *error;
188
- if (![FBConfiguration setScreenshotOrientation:(NSString *)value error:&error]) {
192
+ if (![FBConfiguration.sharedInstance setScreenshotOrientation:(NSString *)value error:&error]) {
189
193
  return [FBCommandStatus invalidArgumentErrorWithMessage:error.localizedDescription
190
194
  traceback:nil];
191
195
  }
@@ -204,52 +208,52 @@ static NSSet<NSString *> *FBNilClearableSettingKeys(void)
204
208
  dispatch_once(&onceToken, ^{
205
209
  NSMutableDictionary<NSString *, FBSettingGetBlock> *map = [NSMutableDictionary dictionary];
206
210
  map[FB_SETTING_USE_COMPACT_RESPONSES] = ^id(FBSession *session) {
207
- return @([FBConfiguration shouldUseCompactResponses]);
211
+ return @(FBConfiguration.sharedInstance.shouldUseCompactResponses);
208
212
  };
209
213
  map[FB_SETTING_ELEMENT_RESPONSE_ATTRIBUTES] = ^id(FBSession *session) {
210
- return [FBConfiguration elementResponseAttributes];
214
+ return FBConfiguration.sharedInstance.elementResponseAttributes;
211
215
  };
212
216
  map[FB_SETTING_MJPEG_SERVER_SCREENSHOT_QUALITY] = ^id(FBSession *session) {
213
- return @([FBConfiguration mjpegServerScreenshotQuality]);
217
+ return @(FBConfiguration.sharedInstance.mjpegServerScreenshotQuality);
214
218
  };
215
219
  map[FB_SETTING_MJPEG_SERVER_FRAMERATE] = ^id(FBSession *session) {
216
- return @([FBConfiguration mjpegServerFramerate]);
220
+ return @(FBConfiguration.sharedInstance.mjpegServerFramerate);
217
221
  };
218
222
  map[FB_SETTING_MJPEG_SCALING_FACTOR] = ^id(FBSession *session) {
219
- return @([FBConfiguration mjpegScalingFactor]);
223
+ return @(FBConfiguration.sharedInstance.mjpegScalingFactor);
220
224
  };
221
225
  map[FB_SETTING_MJPEG_FIX_ORIENTATION] = ^id(FBSession *session) {
222
- return @([FBConfiguration mjpegShouldFixOrientation]);
226
+ return @(FBConfiguration.sharedInstance.mjpegShouldFixOrientation);
223
227
  };
224
228
  map[FB_SETTING_SCREENSHOT_QUALITY] = ^id(FBSession *session) {
225
- return @([FBConfiguration screenshotQuality]);
229
+ return @(FBConfiguration.sharedInstance.screenshotQuality);
226
230
  };
227
231
  map[FB_SETTING_KEYBOARD_AUTOCORRECTION] = ^id(FBSession *session) {
228
- return @([FBConfiguration keyboardAutocorrection]);
232
+ return @(FBConfiguration.sharedInstance.keyboardAutocorrection);
229
233
  };
230
234
  map[FB_SETTING_KEYBOARD_PREDICTION] = ^id(FBSession *session) {
231
- return @([FBConfiguration keyboardPrediction]);
235
+ return @(FBConfiguration.sharedInstance.keyboardPrediction);
232
236
  };
233
237
  map[FB_SETTING_SNAPSHOT_MAX_DEPTH] = ^id(FBSession *session) {
234
- return @([FBConfiguration snapshotMaxDepth]);
238
+ return @(FBConfiguration.sharedInstance.snapshotMaxDepth);
235
239
  };
236
240
  map[FB_SETTING_SNAPSHOT_MAX_CHILDREN] = ^id(FBSession *session) {
237
- return @([FBConfiguration snapshotMaxChildren]);
241
+ return @(FBConfiguration.sharedInstance.snapshotMaxChildren);
238
242
  };
239
243
  map[FB_SETTING_USE_FIRST_MATCH] = ^id(FBSession *session) {
240
- return @([FBConfiguration useFirstMatch]);
244
+ return @(FBConfiguration.sharedInstance.useFirstMatch);
241
245
  };
242
246
  map[FB_SETTING_WAIT_FOR_IDLE_TIMEOUT] = ^id(FBSession *session) {
243
- return @([FBConfiguration waitForIdleTimeout]);
247
+ return @(FBConfiguration.sharedInstance.waitForIdleTimeout);
244
248
  };
245
249
  map[FB_SETTING_ANIMATION_COOL_OFF_TIMEOUT] = ^id(FBSession *session) {
246
- return @([FBConfiguration animationCoolOffTimeout]);
250
+ return @(FBConfiguration.sharedInstance.animationCoolOffTimeout);
247
251
  };
248
252
  map[FB_SETTING_BOUND_ELEMENTS_BY_INDEX] = ^id(FBSession *session) {
249
- return @([FBConfiguration boundElementsByIndex]);
253
+ return @(FBConfiguration.sharedInstance.boundElementsByIndex);
250
254
  };
251
255
  map[FB_SETTING_REDUCE_MOTION] = ^id(FBSession *session) {
252
- return @([FBConfiguration reduceMotionEnabled]);
256
+ return @(FBConfiguration.sharedInstance.reduceMotionEnabled);
253
257
  };
254
258
  map[FB_SETTING_DEFAULT_ACTIVE_APPLICATION] = ^id(FBSession *session) {
255
259
  return session.defaultActiveApplication;
@@ -258,50 +262,50 @@ static NSSet<NSString *> *FBNilClearableSettingKeys(void)
258
262
  return FBActiveAppDetectionPoint.sharedInstance.stringCoordinates;
259
263
  };
260
264
  map[FB_SETTING_ACCEPT_ALERT_BUTTON_SELECTOR] = ^id(FBSession *session) {
261
- return FBConfiguration.acceptAlertButtonSelector;
265
+ return FBConfiguration.sharedInstance.acceptAlertButtonSelector;
262
266
  };
263
267
  map[FB_SETTING_DISMISS_ALERT_BUTTON_SELECTOR] = ^id(FBSession *session) {
264
- return FBConfiguration.dismissAlertButtonSelector;
268
+ return FBConfiguration.sharedInstance.dismissAlertButtonSelector;
265
269
  };
266
270
  map[FB_SETTING_AUTO_CLICK_ALERT_SELECTOR] = ^id(FBSession *session) {
267
- return FBConfiguration.autoClickAlertSelector;
271
+ return FBConfiguration.sharedInstance.autoClickAlertSelector;
268
272
  };
269
273
  map[FB_SETTING_DEFAULT_ALERT_ACTION] = ^id(FBSession *session) {
270
274
  return session.defaultAlertAction ?: @"";
271
275
  };
272
276
  map[FB_SETTING_MAX_TYPING_FREQUENCY] = ^id(FBSession *session) {
273
- return @([FBConfiguration maxTypingFrequency]);
277
+ return @(FBConfiguration.sharedInstance.maxTypingFrequency);
274
278
  };
275
279
  map[FB_SETTING_RESPECT_SYSTEM_ALERTS] = ^id(FBSession *session) {
276
- return @([FBConfiguration shouldRespectSystemAlerts]);
280
+ return @(FBConfiguration.sharedInstance.shouldRespectSystemAlerts);
277
281
  };
278
282
  map[FB_SETTING_USE_CLEAR_TEXT_SHORTCUT] = ^id(FBSession *session) {
279
- return @([FBConfiguration useClearTextShortcut]);
283
+ return @(FBConfiguration.sharedInstance.useClearTextShortcut);
280
284
  };
281
285
  map[FB_SETTING_INCLUDE_HITTABLE_IN_PAGE_SOURCE] = ^id(FBSession *session) {
282
- return @([FBConfiguration includeHittableInPageSource]);
286
+ return @(FBConfiguration.sharedInstance.includeHittableInPageSource);
283
287
  };
284
288
  map[FB_SETTING_INCLUDE_NATIVE_FRAME_IN_PAGE_SOURCE] = ^id(FBSession *session) {
285
- return @([FBConfiguration includeNativeFrameInPageSource]);
289
+ return @(FBConfiguration.sharedInstance.includeNativeFrameInPageSource);
286
290
  };
287
291
  map[FB_SETTING_INCLUDE_NATIVE_ACCESSIBILITY_ELEMENT_IN_PAGE_SOURCE] = ^id(FBSession *session) {
288
- return @([FBConfiguration includeNativeAccessibilityElementInPageSource]);
292
+ return @(FBConfiguration.sharedInstance.includeNativeAccessibilityElementInPageSource);
289
293
  };
290
294
  map[FB_SETTING_INCLUDE_MIN_MAX_VALUE_IN_PAGE_SOURCE] = ^id(FBSession *session) {
291
- return @([FBConfiguration includeMinMaxValueInPageSource]);
295
+ return @(FBConfiguration.sharedInstance.includeMinMaxValueInPageSource);
292
296
  };
293
297
  map[FB_SETTING_INCLUDE_CUSTOM_ACTIONS_IN_PAGE_SOURCE] = ^id(FBSession *session) {
294
- return @([FBConfiguration includeCustomActionsInPageSource]);
298
+ return @(FBConfiguration.sharedInstance.includeCustomActionsInPageSource);
295
299
  };
296
300
  map[FB_SETTING_ENFORCE_CUSTOM_SNAPSHOTS] = ^id(FBSession *session) {
297
- return @([FBConfiguration enforceCustomSnapshots]);
301
+ return @(FBConfiguration.sharedInstance.enforceCustomSnapshots);
298
302
  };
299
303
  map[FB_SETTING_LIMIT_XPATH_CONTEXT_SCOPE] = ^id(FBSession *session) {
300
- return @([FBConfiguration limitXpathContextScope]);
304
+ return @(FBConfiguration.sharedInstance.limitXpathContextScope);
301
305
  };
302
306
  #if !TARGET_OS_TV
303
307
  map[FB_SETTING_SCREENSHOT_ORIENTATION] = ^id(FBSession *session) {
304
- return [FBConfiguration humanReadableScreenshotOrientation];
308
+ return FBConfiguration.sharedInstance.humanReadableScreenshotOrientation;
305
309
  };
306
310
  #endif
307
311
  gettersMap = map.copy;
@@ -344,7 +348,7 @@ static NSSet<NSString *> *FBNilClearableSettingKeys(void)
344
348
  forSession:(FBSession *)session
345
349
  {
346
350
  if (0 == [selector length]) {
347
- [FBConfiguration setAutoClickAlertSelector:selector];
351
+ FBConfiguration.sharedInstance.autoClickAlertSelector = selector;
348
352
  [session disableAlertsMonitor];
349
353
  return [FBCommandStatus ok];
350
354
  }
@@ -355,7 +359,7 @@ static NSSet<NSString *> *FBNilClearableSettingKeys(void)
355
359
  return [FBCommandStatus invalidSelectorErrorWithMessage:error.localizedDescription
356
360
  traceback:nil];
357
361
  }
358
- [FBConfiguration setAutoClickAlertSelector:selector];
362
+ FBConfiguration.sharedInstance.autoClickAlertSelector = selector;
359
363
  [session enableAlertsMonitor];
360
364
  return [FBCommandStatus ok];
361
365
  }
@@ -472,7 +472,7 @@ static NSString *const FB_KEY_ACTIONS = @"actions";
472
472
  XCPointerEventPath *resultPath = [[XCPointerEventPath alloc] initForTextInput];
473
473
  [resultPath typeText:text
474
474
  atOffset:offset
475
- typingSpeed:FBConfiguration.maxTypingFrequency
475
+ typingSpeed:FBConfiguration.sharedInstance.maxTypingFrequency
476
476
  shouldRedact:YES];
477
477
  return @[resultPath];
478
478
  }
@@ -83,7 +83,7 @@ static void swizzledLaunchApp(id self, SEL _cmd, NSString *path, NSString *bundl
83
83
  + (id<XCTMessagingChannel_RunnerToDaemon>)testRunnerProxy
84
84
  {
85
85
  static id<XCTMessagingChannel_RunnerToDaemon> proxy = nil;
86
- if ([FBConfiguration shouldUseSingletonTestManager]) {
86
+ if (FBConfiguration.sharedInstance.shouldUseSingletonTestManager) {
87
87
  static dispatch_once_t onceToken;
88
88
  dispatch_once(&onceToken, ^{
89
89
  [FBLogger logFmt:@"Using singleton test manager"];
@@ -37,7 +37,7 @@
37
37
 
38
38
  - (XCUIElement *)fb_firstMatch
39
39
  {
40
- if (FBConfiguration.useFirstMatch) {
40
+ if (FBConfiguration.sharedInstance.useFirstMatch) {
41
41
  XCUIElement* match = self.firstMatch;
42
42
  return [match exists] ? match : nil;
43
43
  }
@@ -46,7 +46,7 @@
46
46
 
47
47
  - (NSArray<XCUIElement *> *)fb_allMatches
48
48
  {
49
- return FBConfiguration.boundElementsByIndex
49
+ return FBConfiguration.sharedInstance.boundElementsByIndex
50
50
  ? self.allElementsBoundByIndex
51
51
  : self.allElementsBoundByAccessibilityElement;
52
52
  }
@@ -195,7 +195,7 @@ static NSString *const topNodeIndexPath = @"top";
195
195
  // If 'includeHittableInPageSource' setting is enabled, then use native snapshots
196
196
  // to calculate a more accurate value for the 'hittable' attribute.
197
197
  rc = [self xmlRepresentationWithRootElement:[self snapshotWithRoot:root
198
- useNative:FBConfiguration.includeHittableInPageSource]
198
+ useNative:FBConfiguration.sharedInstance.includeHittableInPageSource]
199
199
  writer:writer
200
200
  elementStore:nil
201
201
  query:nil
@@ -252,7 +252,7 @@ static NSString *const topNodeIndexPath = @"top";
252
252
  [FBLogger logFmt:@"Failed to invoke libxml2>xmlTextWriterStartDocument. Error code: %d", rc];
253
253
  } else {
254
254
  [self waitUntilStableWithElement:root];
255
- if (FBConfiguration.limitXpathContextScope) {
255
+ if (FBConfiguration.sharedInstance.limitXpathContextScope) {
256
256
  lookupScopeSnapshot = [self snapshotWithRoot:root useNative:useNativeSnapshot];
257
257
  } else {
258
258
  if ([root isKindOfClass:XCUIElement.class]) {
@@ -404,25 +404,25 @@ static NSString *const topNodeIndexPath = @"top";
404
404
  NSMutableSet<Class> *includedAttributes;
405
405
  if (nil == query) {
406
406
  includedAttributes = [NSMutableSet setWithArray:FBElementAttribute.supportedAttributes];
407
- if (!FBConfiguration.includeHittableInPageSource) {
407
+ if (!FBConfiguration.sharedInstance.includeHittableInPageSource) {
408
408
  // The hittable attribute is expensive to calculate for each snapshot item
409
409
  // thus we only include it when requested explicitly
410
410
  [includedAttributes removeObject:FBHittableAttribute.class];
411
411
  }
412
- if (!FBConfiguration.includeNativeFrameInPageSource) {
412
+ if (!FBConfiguration.sharedInstance.includeNativeFrameInPageSource) {
413
413
  // Include nativeFrame only when requested
414
414
  [includedAttributes removeObject:FBNativeFrameAttribute.class];
415
415
  }
416
- if (!FBConfiguration.includeNativeAccessibilityElementInPageSource) {
416
+ if (!FBConfiguration.sharedInstance.includeNativeAccessibilityElementInPageSource) {
417
417
  // Include the raw native accessibility flag only when requested
418
418
  [includedAttributes removeObject:FBNativeAccessibilityElementAttribute.class];
419
419
  }
420
- if (!FBConfiguration.includeMinMaxValueInPageSource) {
420
+ if (!FBConfiguration.sharedInstance.includeMinMaxValueInPageSource) {
421
421
  // minValue/maxValue are retrieved from private APIs and may be slow on deep trees
422
422
  [includedAttributes removeObject:FBMinValueAttribute.class];
423
423
  [includedAttributes removeObject:FBMaxValueAttribute.class];
424
424
  }
425
- if (!FBConfiguration.includeCustomActionsInPageSource) {
425
+ if (!FBConfiguration.sharedInstance.includeCustomActionsInPageSource) {
426
426
  // customActions are retrieved from accessibility attributes and may be slow on deep trees
427
427
  [includedAttributes removeObject:FBCustomActionsAttribute.class];
428
428
  }
@@ -620,7 +620,7 @@ static NSString *const topNodeIndexPath = @"top";
620
620
  return [(XCUIElement *)root fb_nativeSnapshot];
621
621
  }
622
622
  // https://github.com/appium/WebDriverAgent/issues/1085
623
- return [root isKindOfClass:XCUIApplication.class] && !FBConfiguration.enforceCustomSnapshots
623
+ return [root isKindOfClass:XCUIApplication.class] && !FBConfiguration.sharedInstance.enforceCustomSnapshots
624
624
  ? [(XCUIElement *)root fb_standardSnapshot]
625
625
  : [(XCUIElement *)root fb_customSnapshot];
626
626
  }
@@ -630,7 +630,7 @@ static NSString *const topNodeIndexPath = @"top";
630
630
  if ([root isKindOfClass:XCUIElement.class]) {
631
631
  // If the app is not idle state while we retrieve the visiblity state
632
632
  // then the snapshot retrieval operation might freeze and time out
633
- [[(XCUIElement *)root application] fb_waitUntilStableWithTimeout:FBConfiguration.animationCoolOffTimeout];
633
+ [[(XCUIElement *)root application] fb_waitUntilStableWithTimeout:FBConfiguration.sharedInstance.animationCoolOffTimeout];
634
634
  }
635
635
  }
636
636
 
@@ -22,18 +22,18 @@
22
22
  + (void)setUp
23
23
  {
24
24
  [FBDebugLogDelegateDecorator decorateXCTestLogger];
25
- [FBConfiguration disableRemoteQueryEvaluation];
26
- [FBConfiguration configureDefaultKeyboardPreferences];
27
- [FBConfiguration disableApplicationUIInterruptionsHandling];
25
+ [FBConfiguration.sharedInstance disableRemoteQueryEvaluation];
26
+ [FBConfiguration.sharedInstance configureDefaultKeyboardPreferences];
27
+ [FBConfiguration.sharedInstance disableApplicationUIInterruptionsHandling];
28
28
  if (NSProcessInfo.processInfo.environment[@"ENABLE_AUTOMATIC_SCREEN_RECORDINGS"]) {
29
- [FBConfiguration enableScreenRecordings];
29
+ [FBConfiguration.sharedInstance enableScreenRecordings];
30
30
  } else {
31
- [FBConfiguration disableScreenRecordings];
31
+ [FBConfiguration.sharedInstance disableScreenRecordings];
32
32
  }
33
33
  if (NSProcessInfo.processInfo.environment[@"ENABLE_AUTOMATIC_SCREENSHOTS"]) {
34
- [FBConfiguration enableScreenshots];
34
+ [FBConfiguration.sharedInstance enableScreenshots];
35
35
  } else {
36
- [FBConfiguration disableScreenshots];
36
+ [FBConfiguration.sharedInstance disableScreenshots];
37
37
  }
38
38
  [super setUp];
39
39
  }
@@ -27,7 +27,7 @@
27
27
  [self resetPermissions];
28
28
  [self launchApplication];
29
29
  [self goToAlertsPage];
30
- [FBConfiguration disableApplicationUIInterruptionsHandling];
30
+ [FBConfiguration.sharedInstance disableApplicationUIInterruptionsHandling];
31
31
  }
32
32
 
33
33
  - (void)resetPermissions
@@ -113,12 +113,12 @@
113
113
  - (void)testAcceptingAlertWithCustomLocator
114
114
  {
115
115
  [self showApplicationAlert];
116
- [FBConfiguration setAcceptAlertButtonSelector:@"**/XCUIElementTypeButton[-1]"];
116
+ FBConfiguration.sharedInstance.acceptAlertButtonSelector = @"**/XCUIElementTypeButton[-1]";
117
117
  @try {
118
118
  XCTAssertNoThrow([[FBAlert alertWithApplication:self.testedApplication] accept]);
119
119
  FBAssertWaitTillBecomesTrue(self.testedApplication.alerts.count == 0);
120
120
  } @finally {
121
- [FBConfiguration setAcceptAlertButtonSelector:@""];
121
+ FBConfiguration.sharedInstance.acceptAlertButtonSelector = @"";
122
122
  }
123
123
  }
124
124
 
@@ -132,12 +132,12 @@
132
132
  - (void)testDismissingAlertWithCustomLocator
133
133
  {
134
134
  [self showApplicationAlert];
135
- [FBConfiguration setDismissAlertButtonSelector:@"**/XCUIElementTypeButton[-1]"];
135
+ FBConfiguration.sharedInstance.dismissAlertButtonSelector = @"**/XCUIElementTypeButton[-1]";
136
136
  @try {
137
137
  XCTAssertNoThrow([[FBAlert alertWithApplication:self.testedApplication] dismiss]);
138
138
  FBAssertWaitTillBecomesTrue(self.testedApplication.alerts.count == 0);
139
139
  } @finally {
140
- [FBConfiguration setDismissAlertButtonSelector:@""];
140
+ FBConfiguration.sharedInstance.dismissAlertButtonSelector = @"";
141
141
  }
142
142
  }
143
143
 
@@ -26,13 +26,13 @@
26
26
 
27
27
  - (void)testReduceMotion
28
28
  {
29
- BOOL defaultReduceMotionEnabled = [FBConfiguration reduceMotionEnabled];
29
+ BOOL defaultReduceMotionEnabled = FBConfiguration.sharedInstance.reduceMotionEnabled;
30
30
 
31
- [FBConfiguration setReduceMotionEnabled:YES];
32
- XCTAssertTrue([FBConfiguration reduceMotionEnabled]);
31
+ FBConfiguration.sharedInstance.reduceMotionEnabled = YES;
32
+ XCTAssertTrue(FBConfiguration.sharedInstance.reduceMotionEnabled);
33
33
 
34
- [FBConfiguration setReduceMotionEnabled:defaultReduceMotionEnabled];
35
- XCTAssertEqual([FBConfiguration reduceMotionEnabled], defaultReduceMotionEnabled);
34
+ FBConfiguration.sharedInstance.reduceMotionEnabled = defaultReduceMotionEnabled;
35
+ XCTAssertEqual(FBConfiguration.sharedInstance.reduceMotionEnabled, defaultReduceMotionEnabled);
36
36
  }
37
37
 
38
38
  @end
@@ -46,13 +46,13 @@ NSArray<NSString *> *const FBMainViewButtonLabels = @[
46
46
  - (void)setUp
47
47
  {
48
48
  // Enable it to get extended XCTest logs printed into the console
49
- // [FBConfiguration enableXcTestDebugLogs];
49
+ // [FBConfiguration.sharedInstance enableXcTestDebugLogs];
50
50
  [super setUp];
51
- [FBConfiguration disableRemoteQueryEvaluation];
52
- [FBConfiguration disableAttributeKeyPathAnalysis];
53
- [FBConfiguration configureDefaultKeyboardPreferences];
54
- [FBConfiguration disableApplicationUIInterruptionsHandling];
55
- [FBConfiguration disableScreenshots];
51
+ [FBConfiguration.sharedInstance disableRemoteQueryEvaluation];
52
+ [FBConfiguration.sharedInstance disableAttributeKeyPathAnalysis];
53
+ [FBConfiguration.sharedInstance configureDefaultKeyboardPreferences];
54
+ [FBConfiguration.sharedInstance disableApplicationUIInterruptionsHandling];
55
+ [FBConfiguration.sharedInstance disableScreenshots];
56
56
  self.continueAfterFailure = NO;
57
57
  self.springboard = XCUIApplication.fb_systemApplication;
58
58
  self.testedApplication = [XCUIApplication new];
@@ -139,8 +139,8 @@
139
139
  - (void)testFindMatchesWithoutContextScopeLimit
140
140
  {
141
141
  XCUIElement *button = self.testedApplication.buttons.firstMatch;
142
- BOOL previousValue = FBConfiguration.limitXpathContextScope;
143
- FBConfiguration.limitXpathContextScope = NO;
142
+ BOOL previousValue = FBConfiguration.sharedInstance.limitXpathContextScope;
143
+ FBConfiguration.sharedInstance.limitXpathContextScope = NO;
144
144
  @try {
145
145
  NSArray *parentSnapshots = [FBXPath matchesWithRootElement:button forQuery:@".."];
146
146
  XCTAssertEqual(parentSnapshots.count, 1);
@@ -167,7 +167,7 @@
167
167
  @"XCUIElementTypeButton"
168
168
  );
169
169
  } @finally {
170
- FBConfiguration.limitXpathContextScope = previousValue;
170
+ FBConfiguration.sharedInstance.limitXpathContextScope = previousValue;
171
171
  }
172
172
  }
173
173