Skip to content

Commit 33ccba1

Browse files
chore: Remove the redundant check after activating the system app (#1043)
1 parent 89a5b25 commit 33ccba1

3 files changed

Lines changed: 6 additions & 12 deletions

File tree

WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -621,23 +621,17 @@ + (BOOL)fb_switchToSystemApplicationWithError:(NSError **)error
621621
{
622622
XCUIApplication *systemApp = self.fb_systemApplication;
623623
@try {
624-
if (!systemApp.running) {
625-
[systemApp launch];
626-
} else {
624+
if (systemApp.running) {
627625
[systemApp activate];
626+
} else {
627+
[systemApp launch];
628628
}
629629
} @catch (NSException *e) {
630630
return [[[FBErrorBuilder alloc]
631631
withDescription:nil == e ? @"Cannot open the home screen" : e.reason]
632632
buildError:error];
633633
}
634-
return [[[[FBRunLoopSpinner new]
635-
timeout:5]
636-
timeoutErrorMessage:@"Timeout waiting until the home screen is visible"]
637-
spinUntilTrue:^BOOL{
638-
return [systemApp fb_isSameAppAs:self.fb_activeApplication];
639-
}
640-
error:error];
634+
return YES;
641635
}
642636

643637
- (BOOL)fb_isSameAppAs:(nullable XCUIApplication *)otherApp

WebDriverAgentLib/Utilities/FBScreenshot.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
NSString *formatTimeInterval(NSTimeInterval interval) {
3030
NSUInteger milliseconds = (NSUInteger)(interval * 1000);
31-
return [NSString stringWithFormat:@"%ld ms", milliseconds];
31+
return [NSString stringWithFormat:@"%lu ms", milliseconds];
3232
}
3333

3434
@implementation FBScreenshot

WebDriverAgentTests/IntegrationTests/XCUIDeviceHelperTests.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ - (void)testGoToHomeScreen
102102
NSError *error;
103103
XCTAssertTrue([[XCUIDevice sharedDevice] fb_goToHomescreenWithError:&error]);
104104
XCTAssertNil(error);
105-
XCTAssertTrue([XCUIApplication fb_activeApplication].icons[@"Safari"].exists);
105+
FBAssertWaitTillBecomesTrue([XCUIApplication fb_activeApplication].icons[@"Safari"].exists);
106106
}
107107

108108
- (void)testLockUnlockScreen

0 commit comments

Comments
 (0)