appium-webdriveragent 13.2.1 → 13.2.3
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 +12 -0
- package/WebDriverAgentLib/Categories/XCUIApplication+FBAlert.h +13 -1
- package/WebDriverAgentLib/Categories/XCUIApplication+FBAlert.m +13 -0
- package/WebDriverAgentLib/Commands/FBSessionCommands.m +179 -114
- package/WebDriverAgentLib/FBAlert.m +3 -0
- package/WebDriverAgentLib/Info.plist +2 -2
- package/WebDriverAgentLib/Utilities/FBAlertsMonitor.m +15 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## [13.2.3](https://github.com/appium/WebDriverAgent/compare/v13.2.2...v13.2.3) (2026-06-07)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* auto-handle iOS 18+ limited access permission prompt ([#1150](https://github.com/appium/WebDriverAgent/issues/1150)) ([98d79e7](https://github.com/appium/WebDriverAgent/commit/98d79e7c3875424cb4b5fdee55bb079286a14b05))
|
|
6
|
+
|
|
7
|
+
## [13.2.2](https://github.com/appium/WebDriverAgent/compare/v13.2.1...v13.2.2) (2026-06-06)
|
|
8
|
+
|
|
9
|
+
### Miscellaneous Chores
|
|
10
|
+
|
|
11
|
+
* Refactor session creation handler ([#1149](https://github.com/appium/WebDriverAgent/issues/1149)) ([923b523](https://github.com/appium/WebDriverAgent/commit/923b523b55f880b921de2c95a82786ce0699cb9d))
|
|
12
|
+
|
|
1
13
|
## [13.2.1](https://github.com/appium/WebDriverAgent/compare/v13.2.0...v13.2.1) (2026-06-06)
|
|
2
14
|
|
|
3
15
|
### Miscellaneous Chores
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
#import <XCTest/XCTest.h>
|
|
10
10
|
|
|
11
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
12
|
+
|
|
11
13
|
@interface XCUIApplication (FBAlert)
|
|
12
14
|
|
|
13
15
|
/* The accessiblity label used for Safari app */
|
|
@@ -18,6 +20,16 @@ extern NSString *const FB_SAFARI_APP_NAME;
|
|
|
18
20
|
|
|
19
21
|
@return Alert element instance
|
|
20
22
|
*/
|
|
21
|
-
- (XCUIElement *)fb_alertElement;
|
|
23
|
+
- (nullable XCUIElement *)fb_alertElement;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
Retrieve an alert element hosted by the iOS 18+ limited access permission prompt
|
|
27
|
+
process. See https://github.com/appium/appium/issues/20591
|
|
28
|
+
|
|
29
|
+
@return Alert element instance if the prompt is present, otherwise nil
|
|
30
|
+
*/
|
|
31
|
+
+ (nullable XCUIElement *)fb_limitedAccessPromptAlertElement;
|
|
22
32
|
|
|
23
33
|
@end
|
|
34
|
+
|
|
35
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -17,9 +17,22 @@
|
|
|
17
17
|
|
|
18
18
|
NSString *const FB_SAFARI_APP_NAME = @"Safari";
|
|
19
19
|
|
|
20
|
+
// The iOS 18+ limited access permission prompt (e.g. the "Select Contacts" view)
|
|
21
|
+
// runs in a dedicated process that is not reported by fb_activeApplications.
|
|
22
|
+
static NSString *const FB_LIMITED_ACCESS_PROMPT_BUNDLE_ID = @"com.apple.ContactsUI.LimitedAccessPromptView";
|
|
23
|
+
|
|
20
24
|
|
|
21
25
|
@implementation XCUIApplication (FBAlert)
|
|
22
26
|
|
|
27
|
+
+ (nullable XCUIElement *)fb_limitedAccessPromptAlertElement
|
|
28
|
+
{
|
|
29
|
+
XCUIApplication *promptApp = [[XCUIApplication alloc] initWithBundleIdentifier:FB_LIMITED_ACCESS_PROMPT_BUNDLE_ID];
|
|
30
|
+
if (promptApp.state < XCUIApplicationStateRunningForeground) {
|
|
31
|
+
return nil;
|
|
32
|
+
}
|
|
33
|
+
return promptApp.fb_alertElement;
|
|
34
|
+
}
|
|
35
|
+
|
|
23
36
|
- (nullable XCUIElement *)fb_alertElementFromSafariWithScrollView:(XCUIElement *)scrollView
|
|
24
37
|
viewSnapshot:(id<FBXCElementSnapshot>)viewSnapshot
|
|
25
38
|
{
|
|
@@ -90,134 +90,35 @@
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
NSDictionary<NSString *, id> *capabilities;
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
if (nil == (capabilities = FBParseCapabilities((NSDictionary *)request.arguments[@"capabilities"], &error))) {
|
|
99
|
-
return FBResponseWithStatus([FBCommandStatus sessionNotCreatedError:error.localizedDescription traceback:nil]);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
[FBConfiguration resetSessionSettings];
|
|
103
|
-
if (capabilities[FB_SETTING_USE_COMPACT_RESPONSES]) {
|
|
104
|
-
[FBConfiguration setShouldUseCompactResponses:[capabilities[FB_SETTING_USE_COMPACT_RESPONSES] boolValue]];
|
|
105
|
-
}
|
|
106
|
-
NSString *elementResponseAttributes = capabilities[FB_SETTING_ELEMENT_RESPONSE_ATTRIBUTES];
|
|
107
|
-
if (elementResponseAttributes) {
|
|
108
|
-
[FBConfiguration setElementResponseAttributes:elementResponseAttributes];
|
|
109
|
-
}
|
|
110
|
-
if (capabilities[FB_CAP_MAX_TYPING_FREQUENCY]) {
|
|
111
|
-
[FBConfiguration setMaxTypingFrequency:[capabilities[FB_CAP_MAX_TYPING_FREQUENCY] unsignedIntegerValue]];
|
|
112
|
-
}
|
|
113
|
-
if (capabilities[FB_CAP_USE_SINGLETON_TEST_MANAGER]) {
|
|
114
|
-
[FBConfiguration setShouldUseSingletonTestManager:[capabilities[FB_CAP_USE_SINGLETON_TEST_MANAGER] boolValue]];
|
|
115
|
-
}
|
|
116
|
-
if (capabilities[FB_CAP_DISABLE_AUTOMATIC_SCREENSHOTS]) {
|
|
117
|
-
if ([capabilities[FB_CAP_DISABLE_AUTOMATIC_SCREENSHOTS] boolValue]) {
|
|
118
|
-
[FBConfiguration disableScreenshots];
|
|
119
|
-
} else {
|
|
120
|
-
[FBConfiguration enableScreenshots];
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
if (capabilities[FB_CAP_SHOULD_TERMINATE_APP]) {
|
|
124
|
-
[FBConfiguration setShouldTerminateApp:[capabilities[FB_CAP_SHOULD_TERMINATE_APP] boolValue]];
|
|
125
|
-
}
|
|
126
|
-
NSNumber *delay = capabilities[FB_CAP_EVENT_LOOP_IDLE_DELAY_SEC];
|
|
127
|
-
if ([delay doubleValue] > 0.0) {
|
|
128
|
-
[XCUIApplicationProcessDelay setEventLoopHasIdledDelay:[delay doubleValue]];
|
|
129
|
-
} else {
|
|
130
|
-
[XCUIApplicationProcessDelay disableEventLoopDelay];
|
|
93
|
+
id<FBResponsePayload> errorResponse = [self capabilitiesFromCreateSessionRequest:request
|
|
94
|
+
capabilitiesOut:&capabilities];
|
|
95
|
+
if (nil != errorResponse) {
|
|
96
|
+
return errorResponse;
|
|
131
97
|
}
|
|
132
98
|
|
|
133
|
-
|
|
134
|
-
FBConfiguration.waitForIdleTimeout = [capabilities[FB_SETTING_WAIT_FOR_IDLE_TIMEOUT] doubleValue];
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if (nil == capabilities[FB_CAP_FORCE_SIMULATOR_SOFTWARE_KEYBOARD_PRESENCE] ||
|
|
138
|
-
[capabilities[FB_CAP_FORCE_SIMULATOR_SOFTWARE_KEYBOARD_PRESENCE] boolValue]) {
|
|
139
|
-
[FBConfiguration forceSimulatorSoftwareKeyboardPresence];
|
|
140
|
-
}
|
|
99
|
+
[self applyConfigurationFromCapabilities:capabilities];
|
|
141
100
|
|
|
142
101
|
NSString *bundleID = capabilities[FB_CAP_BUNDLE_ID];
|
|
143
102
|
NSString *initialUrl = capabilities[FB_CAP_INITIAL_URL];
|
|
144
103
|
XCUIApplication *app = nil;
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
XCUIApplicationState appState = app.state;
|
|
152
|
-
BOOL isAppRunning = appState >= XCUIApplicationStateRunningBackground;
|
|
153
|
-
if (!isAppRunning || (isAppRunning && forceAppLaunch)) {
|
|
154
|
-
app.fb_shouldWaitForQuiescence = nil == capabilities[FB_CAP_SHOULD_WAIT_FOR_QUIESCENCE]
|
|
155
|
-
|| [capabilities[FB_CAP_SHOULD_WAIT_FOR_QUIESCENCE] boolValue];
|
|
156
|
-
app.launchArguments = (NSArray<NSString *> *)capabilities[FB_CAP_ARGUMENTS] ?: @[];
|
|
157
|
-
app.launchEnvironment = (NSDictionary <NSString *, NSString *> *)capabilities[FB_CAP_ENVIRNOMENT] ?: @{};
|
|
158
|
-
if (nil != initialUrl) {
|
|
159
|
-
if (app.running) {
|
|
160
|
-
[app terminate];
|
|
161
|
-
}
|
|
162
|
-
id<FBResponsePayload> errorResponse = [self openDeepLink:initialUrl
|
|
163
|
-
withApplication:bundleID
|
|
164
|
-
timeout:capabilities[FB_CAP_APP_LAUNCH_STATE_TIMEOUT_SEC]];
|
|
165
|
-
if (nil != errorResponse) {
|
|
166
|
-
return errorResponse;
|
|
167
|
-
}
|
|
168
|
-
} else {
|
|
169
|
-
NSTimeInterval defaultTimeout = _XCTApplicationStateTimeout();
|
|
170
|
-
if (nil != capabilities[FB_CAP_APP_LAUNCH_STATE_TIMEOUT_SEC]) {
|
|
171
|
-
_XCTSetApplicationStateTimeout([capabilities[FB_CAP_APP_LAUNCH_STATE_TIMEOUT_SEC] doubleValue]);
|
|
172
|
-
}
|
|
173
|
-
@try {
|
|
174
|
-
[app launch];
|
|
175
|
-
} @catch (NSException *e) {
|
|
176
|
-
return FBResponseWithStatus([FBCommandStatus sessionNotCreatedError:e.reason traceback:nil]);
|
|
177
|
-
} @finally {
|
|
178
|
-
if (nil != capabilities[FB_CAP_APP_LAUNCH_STATE_TIMEOUT_SEC]) {
|
|
179
|
-
_XCTSetApplicationStateTimeout(defaultTimeout);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
if (!app.running) {
|
|
184
|
-
NSString *errorMsg = [NSString stringWithFormat:@"Cannot launch %@ application. Make sure the correct bundle identifier has been provided in capabilities and check the device log for possible crash report occurrences", bundleID];
|
|
185
|
-
return FBResponseWithStatus([FBCommandStatus sessionNotCreatedError:errorMsg
|
|
186
|
-
traceback:nil]);
|
|
187
|
-
}
|
|
188
|
-
} else if (appState == XCUIApplicationStateRunningBackground && !forceAppLaunch) {
|
|
189
|
-
if (nil != initialUrl) {
|
|
190
|
-
id<FBResponsePayload> errorResponse = [self openDeepLink:initialUrl
|
|
191
|
-
withApplication:bundleID
|
|
192
|
-
timeout:nil];
|
|
193
|
-
if (nil != errorResponse) {
|
|
194
|
-
return errorResponse;
|
|
195
|
-
}
|
|
196
|
-
} else {
|
|
197
|
-
[app activate];
|
|
198
|
-
}
|
|
199
|
-
}
|
|
104
|
+
errorResponse = [self prepareApplicationForSessionWithBundleID:bundleID
|
|
105
|
+
initialUrl:initialUrl
|
|
106
|
+
capabilities:capabilities
|
|
107
|
+
application:&app];
|
|
108
|
+
if (nil != errorResponse) {
|
|
109
|
+
return errorResponse;
|
|
200
110
|
}
|
|
201
111
|
|
|
202
112
|
if (nil != initialUrl && nil == bundleID) {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
113
|
+
errorResponse = [self openDeepLink:initialUrl
|
|
114
|
+
withApplication:nil
|
|
115
|
+
timeout:capabilities[FB_CAP_APP_LAUNCH_STATE_TIMEOUT_SEC]];
|
|
206
116
|
if (nil != errorResponse) {
|
|
207
117
|
return errorResponse;
|
|
208
118
|
}
|
|
209
119
|
}
|
|
210
120
|
|
|
211
|
-
|
|
212
|
-
[FBSession initWithApplication:app
|
|
213
|
-
defaultAlertAction:(id)capabilities[FB_SETTING_DEFAULT_ALERT_ACTION]];
|
|
214
|
-
} else {
|
|
215
|
-
[FBSession initWithApplication:app];
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
if (nil != capabilities[FB_CAP_USE_NATIVE_CACHING_STRATEGY]) {
|
|
219
|
-
FBSession.activeSession.useNativeCachingStrategy = [capabilities[FB_CAP_USE_NATIVE_CACHING_STRATEGY] boolValue];
|
|
220
|
-
}
|
|
121
|
+
[self initializeSessionWithApplication:app capabilities:capabilities];
|
|
221
122
|
|
|
222
123
|
return FBResponseWithObject(FBSessionCommands.sessionInformation);
|
|
223
124
|
}
|
|
@@ -343,6 +244,170 @@
|
|
|
343
244
|
}
|
|
344
245
|
|
|
345
246
|
|
|
247
|
+
#pragma mark - Session Creation Helpers
|
|
248
|
+
|
|
249
|
+
+ (nullable id<FBResponsePayload>)capabilitiesFromCreateSessionRequest:(FBRouteRequest *)request
|
|
250
|
+
capabilitiesOut:(NSDictionary<NSString *, id> *_Nonnull *_Nonnull)capabilitiesOut
|
|
251
|
+
{
|
|
252
|
+
if (![request.arguments[@"capabilities"] isKindOfClass:NSDictionary.class]) {
|
|
253
|
+
return FBResponseWithStatus([FBCommandStatus sessionNotCreatedError:@"'capabilities' is mandatory to create a new session"
|
|
254
|
+
traceback:nil]);
|
|
255
|
+
}
|
|
256
|
+
NSError *error;
|
|
257
|
+
NSDictionary<NSString *, id> *capabilities = FBParseCapabilities((NSDictionary *)request.arguments[@"capabilities"], &error);
|
|
258
|
+
if (nil == capabilities) {
|
|
259
|
+
return FBResponseWithStatus([FBCommandStatus sessionNotCreatedError:error.localizedDescription traceback:nil]);
|
|
260
|
+
}
|
|
261
|
+
*capabilitiesOut = capabilities;
|
|
262
|
+
return nil;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
+ (void)applyConfigurationFromCapabilities:(NSDictionary<NSString *, id> *)capabilities
|
|
266
|
+
{
|
|
267
|
+
[FBConfiguration resetSessionSettings];
|
|
268
|
+
if (capabilities[FB_SETTING_USE_COMPACT_RESPONSES]) {
|
|
269
|
+
[FBConfiguration setShouldUseCompactResponses:[capabilities[FB_SETTING_USE_COMPACT_RESPONSES] boolValue]];
|
|
270
|
+
}
|
|
271
|
+
NSString *elementResponseAttributes = capabilities[FB_SETTING_ELEMENT_RESPONSE_ATTRIBUTES];
|
|
272
|
+
if (elementResponseAttributes) {
|
|
273
|
+
[FBConfiguration setElementResponseAttributes:elementResponseAttributes];
|
|
274
|
+
}
|
|
275
|
+
if (capabilities[FB_CAP_MAX_TYPING_FREQUENCY]) {
|
|
276
|
+
[FBConfiguration setMaxTypingFrequency:[capabilities[FB_CAP_MAX_TYPING_FREQUENCY] unsignedIntegerValue]];
|
|
277
|
+
}
|
|
278
|
+
if (capabilities[FB_CAP_USE_SINGLETON_TEST_MANAGER]) {
|
|
279
|
+
[FBConfiguration setShouldUseSingletonTestManager:[capabilities[FB_CAP_USE_SINGLETON_TEST_MANAGER] boolValue]];
|
|
280
|
+
}
|
|
281
|
+
if (capabilities[FB_CAP_DISABLE_AUTOMATIC_SCREENSHOTS]) {
|
|
282
|
+
if ([capabilities[FB_CAP_DISABLE_AUTOMATIC_SCREENSHOTS] boolValue]) {
|
|
283
|
+
[FBConfiguration disableScreenshots];
|
|
284
|
+
} else {
|
|
285
|
+
[FBConfiguration enableScreenshots];
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
if (capabilities[FB_CAP_SHOULD_TERMINATE_APP]) {
|
|
289
|
+
[FBConfiguration setShouldTerminateApp:[capabilities[FB_CAP_SHOULD_TERMINATE_APP] boolValue]];
|
|
290
|
+
}
|
|
291
|
+
NSNumber *delay = capabilities[FB_CAP_EVENT_LOOP_IDLE_DELAY_SEC];
|
|
292
|
+
if ([delay doubleValue] > 0.0) {
|
|
293
|
+
[XCUIApplicationProcessDelay setEventLoopHasIdledDelay:[delay doubleValue]];
|
|
294
|
+
} else {
|
|
295
|
+
[XCUIApplicationProcessDelay disableEventLoopDelay];
|
|
296
|
+
}
|
|
297
|
+
if (nil != capabilities[FB_SETTING_WAIT_FOR_IDLE_TIMEOUT]) {
|
|
298
|
+
FBConfiguration.waitForIdleTimeout = [capabilities[FB_SETTING_WAIT_FOR_IDLE_TIMEOUT] doubleValue];
|
|
299
|
+
}
|
|
300
|
+
if (nil == capabilities[FB_CAP_FORCE_SIMULATOR_SOFTWARE_KEYBOARD_PRESENCE] ||
|
|
301
|
+
[capabilities[FB_CAP_FORCE_SIMULATOR_SOFTWARE_KEYBOARD_PRESENCE] boolValue]) {
|
|
302
|
+
[FBConfiguration forceSimulatorSoftwareKeyboardPresence];
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
+ (nullable id<FBResponsePayload>)prepareApplicationForSessionWithBundleID:(nullable NSString *)bundleID
|
|
307
|
+
initialUrl:(nullable NSString *)initialUrl
|
|
308
|
+
capabilities:(NSDictionary<NSString *, id> *)capabilities
|
|
309
|
+
application:(XCUIApplication *_Nullable *_Nonnull)applicationOut
|
|
310
|
+
{
|
|
311
|
+
if (nil == bundleID) {
|
|
312
|
+
*applicationOut = nil;
|
|
313
|
+
return nil;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
XCUIApplication *app = [[XCUIApplication alloc] initWithBundleIdentifier:bundleID];
|
|
317
|
+
BOOL forceAppLaunch = nil == capabilities[FB_CAP_FORCE_APP_LAUNCH]
|
|
318
|
+
|| [capabilities[FB_CAP_FORCE_APP_LAUNCH] boolValue];
|
|
319
|
+
XCUIApplicationState appState = app.state;
|
|
320
|
+
BOOL isAppRunning = appState >= XCUIApplicationStateRunningBackground;
|
|
321
|
+
|
|
322
|
+
if (!isAppRunning || (isAppRunning && forceAppLaunch)) {
|
|
323
|
+
id<FBResponsePayload> errorResponse = [self launchApplication:app
|
|
324
|
+
bundleID:bundleID
|
|
325
|
+
initialUrl:initialUrl
|
|
326
|
+
capabilities:capabilities];
|
|
327
|
+
if (nil != errorResponse) {
|
|
328
|
+
return errorResponse;
|
|
329
|
+
}
|
|
330
|
+
} else if (appState == XCUIApplicationStateRunningBackground && !forceAppLaunch) {
|
|
331
|
+
id<FBResponsePayload> errorResponse = [self activateBackgroundApplication:app
|
|
332
|
+
bundleID:bundleID
|
|
333
|
+
initialUrl:initialUrl];
|
|
334
|
+
if (nil != errorResponse) {
|
|
335
|
+
return errorResponse;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
*applicationOut = app;
|
|
340
|
+
return nil;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
+ (nullable id<FBResponsePayload>)launchApplication:(XCUIApplication *)app
|
|
344
|
+
bundleID:(NSString *)bundleID
|
|
345
|
+
initialUrl:(nullable NSString *)initialUrl
|
|
346
|
+
capabilities:(NSDictionary<NSString *, id> *)capabilities
|
|
347
|
+
{
|
|
348
|
+
app.fb_shouldWaitForQuiescence = nil == capabilities[FB_CAP_SHOULD_WAIT_FOR_QUIESCENCE]
|
|
349
|
+
|| [capabilities[FB_CAP_SHOULD_WAIT_FOR_QUIESCENCE] boolValue];
|
|
350
|
+
app.launchArguments = (NSArray<NSString *> *)capabilities[FB_CAP_ARGUMENTS] ?: @[];
|
|
351
|
+
app.launchEnvironment = (NSDictionary<NSString *, NSString *> *)capabilities[FB_CAP_ENVIRNOMENT] ?: @{};
|
|
352
|
+
|
|
353
|
+
if (nil != initialUrl) {
|
|
354
|
+
if (app.running) {
|
|
355
|
+
[app terminate];
|
|
356
|
+
}
|
|
357
|
+
id<FBResponsePayload> errorResponse = [self openDeepLink:initialUrl
|
|
358
|
+
withApplication:bundleID
|
|
359
|
+
timeout:capabilities[FB_CAP_APP_LAUNCH_STATE_TIMEOUT_SEC]];
|
|
360
|
+
if (nil != errorResponse) {
|
|
361
|
+
return errorResponse;
|
|
362
|
+
}
|
|
363
|
+
} else {
|
|
364
|
+
NSTimeInterval defaultTimeout = _XCTApplicationStateTimeout();
|
|
365
|
+
if (nil != capabilities[FB_CAP_APP_LAUNCH_STATE_TIMEOUT_SEC]) {
|
|
366
|
+
_XCTSetApplicationStateTimeout([capabilities[FB_CAP_APP_LAUNCH_STATE_TIMEOUT_SEC] doubleValue]);
|
|
367
|
+
}
|
|
368
|
+
@try {
|
|
369
|
+
[app launch];
|
|
370
|
+
} @catch (NSException *e) {
|
|
371
|
+
return FBResponseWithStatus([FBCommandStatus sessionNotCreatedError:e.reason traceback:nil]);
|
|
372
|
+
} @finally {
|
|
373
|
+
if (nil != capabilities[FB_CAP_APP_LAUNCH_STATE_TIMEOUT_SEC]) {
|
|
374
|
+
_XCTSetApplicationStateTimeout(defaultTimeout);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
if (!app.running) {
|
|
380
|
+
NSString *errorMsg = [NSString stringWithFormat:@"Cannot launch %@ application. Make sure the correct bundle identifier has been provided in capabilities and check the device log for possible crash report occurrences", bundleID];
|
|
381
|
+
return FBResponseWithStatus([FBCommandStatus sessionNotCreatedError:errorMsg traceback:nil]);
|
|
382
|
+
}
|
|
383
|
+
return nil;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
+ (nullable id<FBResponsePayload>)activateBackgroundApplication:(XCUIApplication *)app
|
|
387
|
+
bundleID:(NSString *)bundleID
|
|
388
|
+
initialUrl:(nullable NSString *)initialUrl
|
|
389
|
+
{
|
|
390
|
+
if (nil != initialUrl) {
|
|
391
|
+
return [self openDeepLink:initialUrl withApplication:bundleID timeout:nil];
|
|
392
|
+
}
|
|
393
|
+
[app activate];
|
|
394
|
+
return nil;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
+ (void)initializeSessionWithApplication:(nullable XCUIApplication *)app
|
|
398
|
+
capabilities:(NSDictionary<NSString *, id> *)capabilities
|
|
399
|
+
{
|
|
400
|
+
if (capabilities[FB_SETTING_DEFAULT_ALERT_ACTION]) {
|
|
401
|
+
[FBSession initWithApplication:app
|
|
402
|
+
defaultAlertAction:(id)capabilities[FB_SETTING_DEFAULT_ALERT_ACTION]];
|
|
403
|
+
} else {
|
|
404
|
+
[FBSession initWithApplication:app];
|
|
405
|
+
}
|
|
406
|
+
if (nil != capabilities[FB_CAP_USE_NATIVE_CACHING_STRATEGY]) {
|
|
407
|
+
FBSession.activeSession.useNativeCachingStrategy = [capabilities[FB_CAP_USE_NATIVE_CACHING_STRATEGY] boolValue];
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
|
|
346
411
|
#pragma mark - Helpers
|
|
347
412
|
|
|
348
413
|
+ (NSString *)buildTimestamp
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
<key>CFBundlePackageType</key>
|
|
16
16
|
<string>FMWK</string>
|
|
17
17
|
<key>CFBundleShortVersionString</key>
|
|
18
|
-
<string>13.2.
|
|
18
|
+
<string>13.2.3</string>
|
|
19
19
|
<key>CFBundleSignature</key>
|
|
20
20
|
<string>????</string>
|
|
21
21
|
<key>CFBundleVersion</key>
|
|
22
|
-
<string>13.2.
|
|
22
|
+
<string>13.2.3</string>
|
|
23
23
|
<key>NSPrincipalClass</key>
|
|
24
24
|
<string/>
|
|
25
25
|
</dict>
|
|
@@ -48,22 +48,36 @@ static const NSTimeInterval FB_MONTORING_INTERVAL = 2.0;
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
51
|
+
id<FBAlertsMonitorDelegate> delegate = self.delegate;
|
|
51
52
|
NSArray<XCUIApplication *> *activeApps = XCUIApplication.fb_activeApplications;
|
|
53
|
+
BOOL didDetectAlert = NO;
|
|
52
54
|
for (XCUIApplication *activeApp in activeApps) {
|
|
53
55
|
XCUIElement *alertElement = nil;
|
|
54
56
|
@try {
|
|
55
57
|
alertElement = activeApp.fb_alertElement;
|
|
56
58
|
if (nil != alertElement) {
|
|
57
|
-
[
|
|
59
|
+
[delegate didDetectAlert:[FBAlert alertWithElement:alertElement]];
|
|
58
60
|
}
|
|
59
61
|
} @catch (NSException *e) {
|
|
60
62
|
[FBLogger logFmt:@"Got an unexpected exception while monitoring alerts: %@\n%@", e.reason, e.callStackSymbols];
|
|
61
63
|
}
|
|
62
64
|
if (nil != alertElement) {
|
|
65
|
+
didDetectAlert = YES;
|
|
63
66
|
break;
|
|
64
67
|
}
|
|
65
68
|
}
|
|
66
69
|
|
|
70
|
+
if (!didDetectAlert) {
|
|
71
|
+
@try {
|
|
72
|
+
XCUIElement *alertElement = [XCUIApplication fb_limitedAccessPromptAlertElement];
|
|
73
|
+
if (nil != alertElement) {
|
|
74
|
+
[delegate didDetectAlert:[FBAlert alertWithElement:alertElement]];
|
|
75
|
+
}
|
|
76
|
+
} @catch (NSException *e) {
|
|
77
|
+
[FBLogger logFmt:@"Got an unexpected exception while monitoring alerts: %@\n%@", e.reason, e.callStackSymbols];
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
67
81
|
if (self.isMonitoring) {
|
|
68
82
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, delta), dispatch_get_main_queue(), ^{
|
|
69
83
|
[self scheduleNextTick];
|