Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit c28013a

Browse files
committed
wait for application active
1 parent bebce3d commit c28013a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

testing/scenario_app/ios/Scenarios/ScenariosTests/AppLifecycleTests.m

+10
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@ - (void)setUp {
4040
self.continueAfterFailure = NO;
4141
// Since this test checks for view controller and application lifecycles, the starting point
4242
// must be well defined.
43+
if ([UIApplication sharedApplication].applicationState != UIApplicationStateActive) {
44+
NSLog(@"Initial application state is currently %zd. Waiting for active.",
45+
[UIApplication sharedApplication].applicationState);
46+
// Don't have to inspect the notification since the typed notification itself indicates the
47+
// desired state.
48+
[self expectationForNotification:UIApplicationDidBecomeActiveNotification
49+
object:self
50+
handler:nil];
51+
[self waitForExpectationsWithTimeout:10.0 handler:nil];
52+
}
4353
XCTAssertEqual([UIApplication sharedApplication].applicationState, UIApplicationStateActive);
4454
}
4555

0 commit comments

Comments
 (0)