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.
- package/CHANGELOG.md +6 -0
- package/WebDriverAgentLib/Categories/XCUIApplication+FBTouchAction.m +1 -1
- package/WebDriverAgentLib/Categories/XCUIApplicationProcess+FBQuiescence.m +4 -4
- package/WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m +1 -1
- package/WebDriverAgentLib/Categories/XCUIDevice+FBRotation.m +1 -1
- package/WebDriverAgentLib/Categories/XCUIElement+FBFind.m +1 -1
- package/WebDriverAgentLib/Categories/XCUIElement+FBScrolling.m +1 -1
- package/WebDriverAgentLib/Categories/XCUIElement+FBTVFocuse.m +1 -1
- package/WebDriverAgentLib/Categories/XCUIElement+FBTyping.m +5 -5
- package/WebDriverAgentLib/Categories/XCUIElement+FBUtilities.m +4 -4
- package/WebDriverAgentLib/Categories/XCUIElement+FBWebDriverAttributes.m +1 -1
- package/WebDriverAgentLib/Commands/FBElementCommands.m +3 -3
- package/WebDriverAgentLib/Commands/FBFindElementCommands.m +7 -7
- package/WebDriverAgentLib/Commands/FBSessionCommands.m +10 -10
- package/WebDriverAgentLib/FBAlert.m +7 -7
- package/WebDriverAgentLib/Info.plist +2 -2
- package/WebDriverAgentLib/Routing/FBResponsePayload.m +1 -1
- package/WebDriverAgentLib/Routing/FBSession.m +3 -3
- package/WebDriverAgentLib/Routing/FBWebServer.m +7 -7
- package/WebDriverAgentLib/Utilities/FBConfiguration.h +75 -142
- package/WebDriverAgentLib/Utilities/FBConfiguration.m +128 -374
- package/WebDriverAgentLib/Utilities/FBImageProcessor.m +6 -6
- package/WebDriverAgentLib/Utilities/FBLogger.m +2 -2
- package/WebDriverAgentLib/Utilities/FBMjpegServer.m +4 -4
- package/WebDriverAgentLib/Utilities/FBSettingsHandler.m +65 -61
- package/WebDriverAgentLib/Utilities/FBW3CActionsSynthesizer.m +1 -1
- package/WebDriverAgentLib/Utilities/FBXCTestDaemonsProxy.m +1 -1
- package/WebDriverAgentLib/Utilities/FBXCodeCompatibility.m +2 -2
- package/WebDriverAgentLib/Utilities/FBXPath.m +9 -9
- package/WebDriverAgentRunner/UITestingUITests.m +7 -7
- package/WebDriverAgentTests/IntegrationTests/FBAlertTests.m +5 -5
- package/WebDriverAgentTests/IntegrationTests/FBConfigurationTests.m +5 -5
- package/WebDriverAgentTests/IntegrationTests/FBIntegrationTestCase.m +6 -6
- package/WebDriverAgentTests/IntegrationTests/FBXPathIntegrationTests.m +3 -3
- package/WebDriverAgentTests/IntegrationTests/XCUIElementAttributesTests.m +5 -5
- package/WebDriverAgentTests/UnitTests/FBConfigurationTests.m +8 -8
- package/WebDriverAgentTests/UnitTests/FBSessionTests.m +3 -3
- package/package.json +1 -1
|
@@ -34,101 +34,98 @@ static NSString *const FBKeyboardAutocorrectionKey = @"KeyboardAutocorrection";
|
|
|
34
34
|
static NSString *const FBKeyboardPredictionKey = @"KeyboardPrediction";
|
|
35
35
|
static NSString *const axSettingsClassName = @"AXSettings";
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
static double FBMjpegScalingFactor = 100.0;
|
|
41
|
-
static BOOL FBMjpegShouldFixOrientation = NO;
|
|
42
|
-
static NSUInteger FBMjpegServerScreenshotQuality = 25;
|
|
43
|
-
static NSUInteger FBMjpegServerFramerate = 10;
|
|
44
|
-
|
|
45
|
-
// Session-specific settings
|
|
46
|
-
static BOOL FBShouldTerminateApp;
|
|
47
|
-
static NSNumber* FBMaxTypingFrequency;
|
|
48
|
-
static NSUInteger FBScreenshotQuality;
|
|
49
|
-
static BOOL FBShouldUseFirstMatch;
|
|
50
|
-
static BOOL FBShouldBoundElementsByIndex;
|
|
51
|
-
static NSString *FBAcceptAlertButtonSelector;
|
|
52
|
-
static NSString *FBDismissAlertButtonSelector;
|
|
53
|
-
static NSString *FBAutoClickAlertSelector;
|
|
54
|
-
static NSTimeInterval FBWaitForIdleTimeout;
|
|
55
|
-
static NSTimeInterval FBAnimationCoolOffTimeout;
|
|
56
|
-
static BOOL FBShouldUseCompactResponses;
|
|
57
|
-
static NSString *FBElementResponseAttributes;
|
|
58
|
-
static BOOL FBUseClearTextShortcut;
|
|
59
|
-
static BOOL FBLimitXpathContextScope = YES;
|
|
37
|
+
@interface FBConfiguration ()
|
|
38
|
+
|
|
39
|
+
@property (atomic, strong) NSNumber *maxTypingFrequencyOverride;
|
|
60
40
|
#if !TARGET_OS_TV
|
|
61
|
-
|
|
41
|
+
@property (atomic, assign) UIInterfaceOrientation screenshotOrientationStorage;
|
|
62
42
|
#endif
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
static BOOL FBShouldIncludeNativeAccessibilityElementInPageSource = NO;
|
|
66
|
-
static BOOL FBShouldIncludeMinMaxValueInPageSource = NO;
|
|
67
|
-
static BOOL FBShouldIncludeCustomActionsInPageSource = NO;
|
|
68
|
-
static BOOL FBShouldEnforceCustomSnapshots = NO;
|
|
43
|
+
|
|
44
|
+
@end
|
|
69
45
|
|
|
70
46
|
@implementation FBConfiguration
|
|
71
47
|
|
|
72
|
-
+ (
|
|
48
|
+
+ (instancetype)sharedInstance
|
|
73
49
|
{
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
50
|
+
static FBConfiguration *instance;
|
|
51
|
+
static dispatch_once_t onceToken;
|
|
52
|
+
dispatch_once(&onceToken, ^{
|
|
53
|
+
instance = [FBConfiguration new];
|
|
54
|
+
});
|
|
55
|
+
return instance;
|
|
77
56
|
}
|
|
78
57
|
|
|
79
|
-
|
|
58
|
+
- (instancetype)init
|
|
80
59
|
{
|
|
81
|
-
[
|
|
60
|
+
self = [super init];
|
|
61
|
+
if (self) {
|
|
62
|
+
// Process-level defaults that are intentionally NOT reset by -resetSessionSettings
|
|
63
|
+
self.shouldUseSingletonTestManager = YES;
|
|
64
|
+
self.mjpegScalingFactor = 100.0;
|
|
65
|
+
self.mjpegServerScreenshotQuality = 25;
|
|
66
|
+
self.mjpegServerFramerate = 10;
|
|
67
|
+
|
|
68
|
+
[self resetSessionSettings];
|
|
69
|
+
}
|
|
70
|
+
return self;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
- (NSUInteger)defaultTypingFrequency
|
|
74
|
+
{
|
|
75
|
+
NSInteger defaultFreq = [[NSUserDefaults standardUserDefaults]
|
|
76
|
+
integerForKey:@"com.apple.xctest.iOSMaximumTypingFrequency"];
|
|
77
|
+
return defaultFreq > 0 ? defaultFreq : 60;
|
|
82
78
|
}
|
|
83
79
|
|
|
84
80
|
#pragma mark Public
|
|
85
81
|
|
|
86
|
-
|
|
82
|
+
- (void)disableRemoteQueryEvaluation
|
|
87
83
|
{
|
|
88
84
|
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"XCTDisableRemoteQueryEvaluation"];
|
|
89
85
|
}
|
|
90
86
|
|
|
91
|
-
|
|
87
|
+
- (void)disableApplicationUIInterruptionsHandling
|
|
92
88
|
{
|
|
93
89
|
[XCUIApplication fb_disableUIInterruptionsHandling];
|
|
94
90
|
}
|
|
95
91
|
|
|
96
|
-
|
|
92
|
+
- (void)enableXcTestDebugLogs
|
|
97
93
|
{
|
|
98
94
|
((XCTestConfiguration *)XCTestConfiguration.activeTestConfiguration).emitOSLogs = YES;
|
|
99
95
|
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"XCTEmitOSLogs"];
|
|
100
96
|
}
|
|
101
97
|
|
|
102
|
-
|
|
98
|
+
- (void)disableAttributeKeyPathAnalysis
|
|
103
99
|
{
|
|
104
100
|
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"XCTDisableAttributeKeyPathAnalysis"];
|
|
105
101
|
}
|
|
106
102
|
|
|
107
|
-
|
|
103
|
+
- (void)disableScreenshots
|
|
108
104
|
{
|
|
109
105
|
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"DisableScreenshots"];
|
|
110
106
|
}
|
|
111
107
|
|
|
112
|
-
|
|
108
|
+
- (void)enableScreenshots
|
|
113
109
|
{
|
|
114
110
|
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"DisableScreenshots"];
|
|
115
111
|
}
|
|
116
112
|
|
|
117
|
-
|
|
113
|
+
- (void)disableScreenRecordings
|
|
118
114
|
{
|
|
119
115
|
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"DisableDiagnosticScreenRecordings"];
|
|
120
116
|
}
|
|
121
117
|
|
|
122
|
-
|
|
118
|
+
- (void)enableScreenRecordings
|
|
123
119
|
{
|
|
124
120
|
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"DisableDiagnosticScreenRecordings"];
|
|
125
121
|
}
|
|
126
122
|
|
|
127
|
-
|
|
123
|
+
- (NSRange)bindingPortRange
|
|
128
124
|
{
|
|
129
125
|
// 'WebDriverAgent --port 8080' can be passed via the arguments to the process
|
|
130
|
-
|
|
131
|
-
|
|
126
|
+
NSRange rangeFromArguments = [self.class bindingPortRangeFromArguments];
|
|
127
|
+
if (rangeFromArguments.location != NSNotFound) {
|
|
128
|
+
return rangeFromArguments;
|
|
132
129
|
}
|
|
133
130
|
|
|
134
131
|
// Existence of USE_PORT in the environment implies the port range is managed by the launching process.
|
|
@@ -140,7 +137,7 @@ static BOOL FBShouldEnforceCustomSnapshots = NO;
|
|
|
140
137
|
return NSMakeRange(DefaultStartingPort, DefaultPortRange);
|
|
141
138
|
}
|
|
142
139
|
|
|
143
|
-
|
|
140
|
+
- (NSString *)bindingIPAddress
|
|
144
141
|
{
|
|
145
142
|
// Existence of USE_IP in the environment allows specifying which interface to bind to
|
|
146
143
|
if (NSProcessInfo.processInfo.environment[@"USE_IP"] &&
|
|
@@ -151,10 +148,11 @@ static BOOL FBShouldEnforceCustomSnapshots = NO;
|
|
|
151
148
|
return nil;
|
|
152
149
|
}
|
|
153
150
|
|
|
154
|
-
|
|
151
|
+
- (NSInteger)mjpegServerPort
|
|
155
152
|
{
|
|
156
|
-
|
|
157
|
-
|
|
153
|
+
NSUInteger portFromArguments = [self.class mjpegServerPortFromArguments];
|
|
154
|
+
if (portFromArguments != NSNotFound) {
|
|
155
|
+
return portFromArguments;
|
|
158
156
|
}
|
|
159
157
|
|
|
160
158
|
if (NSProcessInfo.processInfo.environment[@"MJPEG_SERVER_PORT"] &&
|
|
@@ -165,7 +163,7 @@ static BOOL FBShouldEnforceCustomSnapshots = NO;
|
|
|
165
163
|
return DefaultMjpegServerPort;
|
|
166
164
|
}
|
|
167
165
|
|
|
168
|
-
|
|
166
|
+
- (UInt64)httpRequestBodySizeLimit
|
|
169
167
|
{
|
|
170
168
|
NSString *limit = NSProcessInfo.processInfo.environment[@"MAX_HTTP_REQUEST_BODY_SIZE"];
|
|
171
169
|
if (limit.length > 0) {
|
|
@@ -178,136 +176,29 @@ static BOOL FBShouldEnforceCustomSnapshots = NO;
|
|
|
178
176
|
return DefaultHttpRequestBodySizeLimit;
|
|
179
177
|
}
|
|
180
178
|
|
|
181
|
-
|
|
182
|
-
{
|
|
183
|
-
return FBMjpegScalingFactor;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
+ (void)setMjpegScalingFactor:(double)scalingFactor {
|
|
187
|
-
FBMjpegScalingFactor = scalingFactor;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
+ (BOOL)mjpegShouldFixOrientation
|
|
191
|
-
{
|
|
192
|
-
return FBMjpegShouldFixOrientation;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
+ (void)setMjpegShouldFixOrientation:(BOOL)enabled {
|
|
196
|
-
FBMjpegShouldFixOrientation = enabled;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
+ (BOOL)verboseLoggingEnabled
|
|
179
|
+
- (BOOL)verboseLoggingEnabled
|
|
200
180
|
{
|
|
201
181
|
return [NSProcessInfo.processInfo.environment[@"VERBOSE_LOGGING"] boolValue];
|
|
202
182
|
}
|
|
203
183
|
|
|
204
|
-
|
|
184
|
+
- (NSUInteger)maxTypingFrequency
|
|
205
185
|
{
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
+ (BOOL)shouldUseCompactResponses
|
|
210
|
-
{
|
|
211
|
-
return FBShouldUseCompactResponses;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
+ (void)setShouldTerminateApp:(BOOL)value
|
|
215
|
-
{
|
|
216
|
-
FBShouldTerminateApp = value;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
+ (BOOL)shouldTerminateApp
|
|
220
|
-
{
|
|
221
|
-
return FBShouldTerminateApp;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
+ (void)setElementResponseAttributes:(NSString *)value
|
|
225
|
-
{
|
|
226
|
-
FBElementResponseAttributes = value;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
+ (NSString *)elementResponseAttributes
|
|
230
|
-
{
|
|
231
|
-
return FBElementResponseAttributes;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
+ (void)setMaxTypingFrequency:(NSUInteger)value
|
|
235
|
-
{
|
|
236
|
-
FBMaxTypingFrequency = @(value);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
+ (NSUInteger)maxTypingFrequency
|
|
240
|
-
{
|
|
241
|
-
if (nil == FBMaxTypingFrequency) {
|
|
242
|
-
return [self defaultTypingFrequency];
|
|
186
|
+
NSNumber *override = self.maxTypingFrequencyOverride;
|
|
187
|
+
if (nil == override) {
|
|
188
|
+
return self.defaultTypingFrequency;
|
|
243
189
|
}
|
|
244
|
-
return
|
|
245
|
-
?
|
|
246
|
-
:
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
+ (void)setShouldUseSingletonTestManager:(BOOL)value
|
|
250
|
-
{
|
|
251
|
-
FBShouldUseSingletonTestManager = value;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
+ (BOOL)shouldUseSingletonTestManager
|
|
255
|
-
{
|
|
256
|
-
return FBShouldUseSingletonTestManager;
|
|
190
|
+
return override.integerValue <= 0
|
|
191
|
+
? self.defaultTypingFrequency
|
|
192
|
+
: override.integerValue;
|
|
257
193
|
}
|
|
258
194
|
|
|
259
|
-
|
|
195
|
+
- (void)setMaxTypingFrequency:(NSUInteger)value
|
|
260
196
|
{
|
|
261
|
-
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
+ (void)setMjpegServerFramerate:(NSUInteger)framerate
|
|
265
|
-
{
|
|
266
|
-
FBMjpegServerFramerate = framerate;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
+ (NSUInteger)mjpegServerScreenshotQuality
|
|
270
|
-
{
|
|
271
|
-
return FBMjpegServerScreenshotQuality;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
+ (void)setMjpegServerScreenshotQuality:(NSUInteger)quality
|
|
275
|
-
{
|
|
276
|
-
FBMjpegServerScreenshotQuality = quality;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
+ (NSUInteger)screenshotQuality
|
|
280
|
-
{
|
|
281
|
-
return FBScreenshotQuality;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
+ (void)setScreenshotQuality:(NSUInteger)quality
|
|
285
|
-
{
|
|
286
|
-
FBScreenshotQuality = quality;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
+ (NSTimeInterval)waitForIdleTimeout
|
|
290
|
-
{
|
|
291
|
-
return FBWaitForIdleTimeout;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
+ (void)setWaitForIdleTimeout:(NSTimeInterval)timeout
|
|
295
|
-
{
|
|
296
|
-
FBWaitForIdleTimeout = timeout;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
+ (NSTimeInterval)animationCoolOffTimeout
|
|
300
|
-
{
|
|
301
|
-
return FBAnimationCoolOffTimeout;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
+ (void)setAnimationCoolOffTimeout:(NSTimeInterval)timeout
|
|
305
|
-
{
|
|
306
|
-
FBAnimationCoolOffTimeout = timeout;
|
|
197
|
+
self.maxTypingFrequencyOverride = @(value);
|
|
307
198
|
}
|
|
308
199
|
|
|
309
200
|
// Works for Simulator and Real devices
|
|
310
|
-
|
|
201
|
+
- (void)configureDefaultKeyboardPreferences
|
|
311
202
|
{
|
|
312
203
|
void *handle = dlopen(controllerPrefBundlePath, RTLD_LAZY);
|
|
313
204
|
|
|
@@ -343,7 +234,7 @@ static BOOL FBShouldEnforceCustomSnapshots = NO;
|
|
|
343
234
|
dlclose(handle);
|
|
344
235
|
}
|
|
345
236
|
|
|
346
|
-
|
|
237
|
+
- (void)forceSimulatorSoftwareKeyboardPresence
|
|
347
238
|
{
|
|
348
239
|
#if TARGET_OS_SIMULATOR
|
|
349
240
|
// Force toggle software keyboard on.
|
|
@@ -359,141 +250,63 @@ static BOOL FBShouldEnforceCustomSnapshots = NO;
|
|
|
359
250
|
#endif
|
|
360
251
|
}
|
|
361
252
|
|
|
362
|
-
|
|
253
|
+
- (FBConfigurationKeyboardPreference)keyboardAutocorrection
|
|
363
254
|
{
|
|
364
255
|
return [self keyboardsPreference:FBKeyboardAutocorrectionKey];
|
|
365
256
|
}
|
|
366
257
|
|
|
367
|
-
|
|
258
|
+
- (void)setKeyboardAutocorrection:(FBConfigurationKeyboardPreference)preference
|
|
368
259
|
{
|
|
369
|
-
[self configureKeyboardsPreference:
|
|
260
|
+
[self configureKeyboardsPreference:(preference == FBConfigurationKeyboardPreferenceEnabled)
|
|
261
|
+
forPreferenceKey:FBKeyboardAutocorrectionKey];
|
|
370
262
|
}
|
|
371
263
|
|
|
372
|
-
|
|
264
|
+
- (FBConfigurationKeyboardPreference)keyboardPrediction
|
|
373
265
|
{
|
|
374
266
|
return [self keyboardsPreference:FBKeyboardPredictionKey];
|
|
375
267
|
}
|
|
376
268
|
|
|
377
|
-
|
|
269
|
+
- (void)setKeyboardPrediction:(FBConfigurationKeyboardPreference)preference
|
|
378
270
|
{
|
|
379
|
-
[self configureKeyboardsPreference:
|
|
271
|
+
[self configureKeyboardsPreference:(preference == FBConfigurationKeyboardPreferenceEnabled)
|
|
272
|
+
forPreferenceKey:FBKeyboardPredictionKey];
|
|
380
273
|
}
|
|
381
274
|
|
|
382
|
-
|
|
275
|
+
- (void)setSnapshotMaxDepth:(int)maxDepth
|
|
383
276
|
{
|
|
384
277
|
FBSetCustomParameterForElementSnapshot(FBSnapshotMaxDepthKey, @(maxDepth));
|
|
385
278
|
}
|
|
386
279
|
|
|
387
|
-
|
|
280
|
+
- (int)snapshotMaxDepth
|
|
388
281
|
{
|
|
389
282
|
return [FBGetCustomParameterForElementSnapshot(FBSnapshotMaxDepthKey) intValue];
|
|
390
283
|
}
|
|
391
284
|
|
|
392
|
-
|
|
285
|
+
- (void)setSnapshotMaxChildren:(int)maxChildren
|
|
393
286
|
{
|
|
394
287
|
FBSetCustomParameterForElementSnapshot(FBSnapshotMaxChildrenKey, @(maxChildren));
|
|
395
288
|
}
|
|
396
289
|
|
|
397
|
-
|
|
290
|
+
- (int)snapshotMaxChildren
|
|
398
291
|
{
|
|
399
292
|
return [FBGetCustomParameterForElementSnapshot(FBSnapshotMaxChildrenKey) intValue];
|
|
400
293
|
}
|
|
401
294
|
|
|
402
|
-
+ (void)setShouldRespectSystemAlerts:(BOOL)value
|
|
403
|
-
{
|
|
404
|
-
FBShouldRespectSystemAlerts = value;
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
+ (BOOL)shouldRespectSystemAlerts
|
|
408
|
-
{
|
|
409
|
-
return FBShouldRespectSystemAlerts;
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
+ (void)setUseFirstMatch:(BOOL)enabled
|
|
413
|
-
{
|
|
414
|
-
FBShouldUseFirstMatch = enabled;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
+ (BOOL)useFirstMatch
|
|
418
|
-
{
|
|
419
|
-
return FBShouldUseFirstMatch;
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
+ (void)setBoundElementsByIndex:(BOOL)enabled
|
|
423
|
-
{
|
|
424
|
-
FBShouldBoundElementsByIndex = enabled;
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
+ (BOOL)boundElementsByIndex
|
|
428
|
-
{
|
|
429
|
-
return FBShouldBoundElementsByIndex;
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
+ (void)setAcceptAlertButtonSelector:(NSString *)classChainSelector
|
|
433
|
-
{
|
|
434
|
-
FBAcceptAlertButtonSelector = classChainSelector;
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
+ (NSString *)acceptAlertButtonSelector
|
|
438
|
-
{
|
|
439
|
-
return FBAcceptAlertButtonSelector;
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
+ (void)setDismissAlertButtonSelector:(NSString *)classChainSelector
|
|
443
|
-
{
|
|
444
|
-
FBDismissAlertButtonSelector = classChainSelector;
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
+ (NSString *)dismissAlertButtonSelector
|
|
448
|
-
{
|
|
449
|
-
return FBDismissAlertButtonSelector;
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
+ (void)setAutoClickAlertSelector:(NSString *)classChainSelector
|
|
453
|
-
{
|
|
454
|
-
FBAutoClickAlertSelector = classChainSelector;
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
+ (NSString *)autoClickAlertSelector
|
|
458
|
-
{
|
|
459
|
-
return FBAutoClickAlertSelector;
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
+ (void)setUseClearTextShortcut:(BOOL)enabled
|
|
463
|
-
{
|
|
464
|
-
FBUseClearTextShortcut = enabled;
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
+ (BOOL)useClearTextShortcut
|
|
468
|
-
{
|
|
469
|
-
return FBUseClearTextShortcut;
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
+ (BOOL)limitXpathContextScope
|
|
473
|
-
{
|
|
474
|
-
return FBLimitXpathContextScope;
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
+ (void)setLimitXpathContextScope:(BOOL)enabled
|
|
478
|
-
{
|
|
479
|
-
FBLimitXpathContextScope = enabled;
|
|
480
|
-
}
|
|
481
|
-
|
|
482
295
|
#if !TARGET_OS_TV
|
|
483
|
-
|
|
296
|
+
- (BOOL)setScreenshotOrientation:(NSString *)orientation error:(NSError **)error
|
|
484
297
|
{
|
|
485
298
|
// Only UIInterfaceOrientationUnknown is over iOS 8. Others are over iOS 2.
|
|
486
299
|
// https://developer.apple.com/documentation/uikit/uiinterfaceorientation/uiinterfaceorientationunknown
|
|
487
300
|
if ([orientation.lowercaseString isEqualToString:@"portrait"]) {
|
|
488
|
-
|
|
301
|
+
self.screenshotOrientationStorage = UIInterfaceOrientationPortrait;
|
|
489
302
|
} else if ([orientation.lowercaseString isEqualToString:@"portraitupsidedown"]) {
|
|
490
|
-
|
|
303
|
+
self.screenshotOrientationStorage = UIInterfaceOrientationPortraitUpsideDown;
|
|
491
304
|
} else if ([orientation.lowercaseString isEqualToString:@"landscaperight"]) {
|
|
492
|
-
|
|
305
|
+
self.screenshotOrientationStorage = UIInterfaceOrientationLandscapeRight;
|
|
493
306
|
} else if ([orientation.lowercaseString isEqualToString:@"landscapeleft"]) {
|
|
494
|
-
|
|
307
|
+
self.screenshotOrientationStorage = UIInterfaceOrientationLandscapeLeft;
|
|
495
308
|
} else if ([orientation.lowercaseString isEqualToString:@"auto"]) {
|
|
496
|
-
|
|
309
|
+
self.screenshotOrientationStorage = UIInterfaceOrientationUnknown;
|
|
497
310
|
} else {
|
|
498
311
|
return [[FBErrorBuilder.builder withDescriptionFormat:
|
|
499
312
|
@"The orientation value '%@' is not known. Only the following orientation values are supported: " \
|
|
@@ -503,14 +316,14 @@ static BOOL FBShouldEnforceCustomSnapshots = NO;
|
|
|
503
316
|
return YES;
|
|
504
317
|
}
|
|
505
318
|
|
|
506
|
-
|
|
319
|
+
- (NSInteger)screenshotOrientation
|
|
507
320
|
{
|
|
508
|
-
return
|
|
321
|
+
return self.screenshotOrientationStorage;
|
|
509
322
|
}
|
|
510
323
|
|
|
511
|
-
|
|
324
|
+
- (NSString *)humanReadableScreenshotOrientation
|
|
512
325
|
{
|
|
513
|
-
switch (
|
|
326
|
+
switch (self.screenshotOrientationStorage) {
|
|
514
327
|
case UIInterfaceOrientationPortrait:
|
|
515
328
|
return @"portrait";
|
|
516
329
|
case UIInterfaceOrientationPortraitUpsideDown:
|
|
@@ -523,36 +336,61 @@ static BOOL FBShouldEnforceCustomSnapshots = NO;
|
|
|
523
336
|
return @"auto";
|
|
524
337
|
default: break;
|
|
525
338
|
}
|
|
339
|
+
return @"auto";
|
|
526
340
|
}
|
|
527
341
|
#endif
|
|
528
342
|
|
|
529
|
-
|
|
530
|
-
{
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
343
|
+
- (void)resetSessionSettings
|
|
344
|
+
{
|
|
345
|
+
self.shouldTerminateApp = YES;
|
|
346
|
+
self.shouldUseCompactResponses = YES;
|
|
347
|
+
self.elementResponseAttributes = @"type,label";
|
|
348
|
+
self.maxTypingFrequencyOverride = @(self.defaultTypingFrequency);
|
|
349
|
+
self.screenshotQuality = 3;
|
|
350
|
+
self.useFirstMatch = NO;
|
|
351
|
+
self.boundElementsByIndex = NO;
|
|
352
|
+
self.acceptAlertButtonSelector = @"";
|
|
353
|
+
self.dismissAlertButtonSelector = @"";
|
|
354
|
+
self.autoClickAlertSelector = @"";
|
|
355
|
+
self.waitForIdleTimeout = 10.;
|
|
356
|
+
self.animationCoolOffTimeout = 2.;
|
|
543
357
|
// 50 should be enough for the majority of the cases. The performance is acceptable for values up to 100.
|
|
544
358
|
FBSetCustomParameterForElementSnapshot(FBSnapshotMaxDepthKey, @50);
|
|
545
359
|
FBSetCustomParameterForElementSnapshot(FBSnapshotMaxChildrenKey, @INT_MAX);
|
|
546
|
-
|
|
547
|
-
|
|
360
|
+
self.useClearTextShortcut = YES;
|
|
361
|
+
self.limitXpathContextScope = YES;
|
|
548
362
|
#if !TARGET_OS_TV
|
|
549
|
-
|
|
363
|
+
self.screenshotOrientationStorage = UIInterfaceOrientationUnknown;
|
|
550
364
|
#endif
|
|
551
365
|
}
|
|
552
366
|
|
|
367
|
+
- (void)setReduceMotionEnabled:(BOOL)isEnabled
|
|
368
|
+
{
|
|
369
|
+
Class settingsClass = NSClassFromString(axSettingsClassName);
|
|
370
|
+
AXSettings *settings = (AXSettings *)[settingsClass sharedInstance];
|
|
371
|
+
|
|
372
|
+
// Below does not work on real devices because of iOS security model
|
|
373
|
+
// (lldb) po settings.reduceMotionEnabled = isEnabled
|
|
374
|
+
// 2019-08-21 22:58:19.776165+0900 WebDriverAgentRunner-Runner[322:13361] [User Defaults] Couldn't write value for key ReduceMotionEnabled in CFPrefsPlistSource<0x28111a700> (Domain: com.apple.Accessibility, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access
|
|
375
|
+
if ([settings respondsToSelector:@selector(setReduceMotionEnabled:)]) {
|
|
376
|
+
[settings setReduceMotionEnabled:isEnabled];
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
- (BOOL)reduceMotionEnabled
|
|
381
|
+
{
|
|
382
|
+
Class settingsClass = NSClassFromString(axSettingsClassName);
|
|
383
|
+
AXSettings *settings = (AXSettings *)[settingsClass sharedInstance];
|
|
384
|
+
|
|
385
|
+
if ([settings respondsToSelector:@selector(reduceMotionEnabled)]) {
|
|
386
|
+
return settings.reduceMotionEnabled;
|
|
387
|
+
}
|
|
388
|
+
return NO;
|
|
389
|
+
}
|
|
390
|
+
|
|
553
391
|
#pragma mark Private
|
|
554
392
|
|
|
555
|
-
|
|
393
|
+
- (FBConfigurationKeyboardPreference)keyboardsPreference:(nonnull NSString *)key
|
|
556
394
|
{
|
|
557
395
|
Class controllerClass = NSClassFromString(controllerClassName);
|
|
558
396
|
TIPreferencesController *controller = [controllerClass sharedPreferencesController];
|
|
@@ -578,7 +416,7 @@ static BOOL FBShouldEnforceCustomSnapshots = NO;
|
|
|
578
416
|
@throw [[FBErrorBuilder.builder withDescriptionFormat:@"No available keyboardsPreferenceKey: '%@'", key] build];
|
|
579
417
|
}
|
|
580
418
|
|
|
581
|
-
|
|
419
|
+
- (void)configureKeyboardsPreference:(BOOL)enable forPreferenceKey:(nonnull NSString *)key
|
|
582
420
|
{
|
|
583
421
|
void *handle = dlopen(controllerPrefBundlePath, RTLD_LAZY);
|
|
584
422
|
Class controllerClass = NSClassFromString(controllerClassName);
|
|
@@ -636,88 +474,4 @@ static BOOL FBShouldEnforceCustomSnapshots = NO;
|
|
|
636
474
|
return NSMakeRange(port, 1);
|
|
637
475
|
}
|
|
638
476
|
|
|
639
|
-
+ (void)setReduceMotionEnabled:(BOOL)isEnabled
|
|
640
|
-
{
|
|
641
|
-
Class settingsClass = NSClassFromString(axSettingsClassName);
|
|
642
|
-
AXSettings *settings = [settingsClass sharedInstance];
|
|
643
|
-
|
|
644
|
-
// Below does not work on real devices because of iOS security model
|
|
645
|
-
// (lldb) po settings.reduceMotionEnabled = isEnabled
|
|
646
|
-
// 2019-08-21 22:58:19.776165+0900 WebDriverAgentRunner-Runner[322:13361] [User Defaults] Couldn't write value for key ReduceMotionEnabled in CFPrefsPlistSource<0x28111a700> (Domain: com.apple.Accessibility, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access
|
|
647
|
-
if ([settings respondsToSelector:@selector(setReduceMotionEnabled:)]) {
|
|
648
|
-
[settings setReduceMotionEnabled:isEnabled];
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
+ (BOOL)reduceMotionEnabled
|
|
653
|
-
{
|
|
654
|
-
Class settingsClass = NSClassFromString(axSettingsClassName);
|
|
655
|
-
AXSettings *settings = [settingsClass sharedInstance];
|
|
656
|
-
|
|
657
|
-
if ([settings respondsToSelector:@selector(reduceMotionEnabled)]) {
|
|
658
|
-
return settings.reduceMotionEnabled;
|
|
659
|
-
}
|
|
660
|
-
return NO;
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
+ (void)setIncludeHittableInPageSource:(BOOL)enabled
|
|
664
|
-
{
|
|
665
|
-
FBShouldIncludeHittableInPageSource = enabled;
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
+ (BOOL)includeHittableInPageSource
|
|
669
|
-
{
|
|
670
|
-
return FBShouldIncludeHittableInPageSource;
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
+ (void)setIncludeNativeFrameInPageSource:(BOOL)enabled
|
|
674
|
-
{
|
|
675
|
-
FBShouldIncludeNativeFrameInPageSource = enabled;
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
+ (BOOL)includeNativeFrameInPageSource
|
|
679
|
-
{
|
|
680
|
-
return FBShouldIncludeNativeFrameInPageSource;
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
+ (void)setIncludeNativeAccessibilityElementInPageSource:(BOOL)enabled
|
|
684
|
-
{
|
|
685
|
-
FBShouldIncludeNativeAccessibilityElementInPageSource = enabled;
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
+ (BOOL)includeNativeAccessibilityElementInPageSource
|
|
689
|
-
{
|
|
690
|
-
return FBShouldIncludeNativeAccessibilityElementInPageSource;
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
+ (void)setIncludeMinMaxValueInPageSource:(BOOL)enabled
|
|
694
|
-
{
|
|
695
|
-
FBShouldIncludeMinMaxValueInPageSource = enabled;
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
+ (BOOL)includeMinMaxValueInPageSource
|
|
699
|
-
{
|
|
700
|
-
return FBShouldIncludeMinMaxValueInPageSource;
|
|
701
|
-
}
|
|
702
|
-
|
|
703
|
-
+ (void)setIncludeCustomActionsInPageSource:(BOOL)enabled
|
|
704
|
-
{
|
|
705
|
-
FBShouldIncludeCustomActionsInPageSource = enabled;
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
+ (BOOL)includeCustomActionsInPageSource
|
|
709
|
-
{
|
|
710
|
-
return FBShouldIncludeCustomActionsInPageSource;
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
+ (void)setEnforceCustomSnapshots:(BOOL)enabled
|
|
714
|
-
{
|
|
715
|
-
FBShouldEnforceCustomSnapshots = enabled;
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
+ (BOOL)enforceCustomSnapshots
|
|
719
|
-
{
|
|
720
|
-
return FBShouldEnforceCustomSnapshots;
|
|
721
|
-
}
|
|
722
|
-
|
|
723
477
|
@end
|