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

Commit 63759ca

Browse files
committed
move the application state wait until after setting the root vc
1 parent 5e7ebbd commit 63759ca

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,14 @@ @implementation AppLifecycleTests
3838
- (void)setUp {
3939
[super setUp];
4040
self.continueAfterFailure = NO;
41+
}
42+
43+
- (void)ensureApplicationIsInActiveState {
4144
// Since this test checks for view controller and application lifecycles, the starting point
4245
// must be well defined.
46+
47+
// Make this check after setting the root view controller since it seems to just hang if
48+
// done in setUp.
4349
if ([UIApplication sharedApplication].applicationState != UIApplicationStateActive) {
4450
NSLog(@"Initial application state is currently %zd. Waiting for active.",
4551
[UIApplication sharedApplication].applicationState);
@@ -48,7 +54,7 @@ - (void)setUp {
4854
[self expectationForNotification:UIApplicationDidBecomeActiveNotification
4955
object:self
5056
handler:nil];
51-
[self waitForExpectationsWithTimeout:60.0 handler:nil];
57+
[self waitForExpectationsWithTimeout:30.0 handler:nil];
5258
}
5359
XCTAssertEqual([UIApplication sharedApplication].applicationState, UIApplicationStateActive);
5460
}
@@ -68,6 +74,8 @@ - (void)skip_testDismissedFlutterViewControllerNotRespondingToApplicationLifecyc
6874
application.delegate.window.rootViewController = rootVC;
6975
FlutterEngine* engine = rootVC.engine;
7076

77+
[self ensureApplicationIsInActiveState];
78+
7179
NSMutableArray* lifecycleExpectations = [NSMutableArray arrayWithCapacity:10];
7280

7381
// Expected sequence from showing the FlutterViewController is inactive and resumed.
@@ -212,6 +220,8 @@ - (void)skip_testVisibleFlutterViewControllerRespondsToApplicationLifecycle {
212220
application.delegate.window.rootViewController = rootVC;
213221
FlutterEngine* engine = rootVC.engine;
214222

223+
[self ensureApplicationIsInActiveState];
224+
215225
NSMutableArray* lifecycleExpectations = [NSMutableArray arrayWithCapacity:10];
216226

217227
// Expected sequence from showing the FlutterViewController is inactive and resumed.
@@ -322,6 +332,8 @@ - (void)skip_testFlutterViewControllerDetachingSendsApplicationLifecycle {
322332
application.delegate.window.rootViewController = rootVC;
323333
FlutterEngine* engine = rootVC.engine;
324334

335+
[self ensureApplicationIsInActiveState];
336+
325337
NSMutableArray* lifecycleExpectations = [NSMutableArray arrayWithCapacity:10];
326338

327339
// Expected sequence from showing the FlutterViewController is inactive and resumed.

0 commit comments

Comments
 (0)