Unverified Commit 7428ab66 authored by Chris Yang's avatar Chris Yang Committed by GitHub

Add debug informations on ios_module_test (#96622)

parent accd6aba
......@@ -3,6 +3,7 @@
// found in the LICENSE file.
@import XCTest;
@import os.log;
static const CGFloat kStandardTimeOut = 60.0;
......@@ -65,6 +66,9 @@ static const CGFloat kStandardTimeOut = 60.0;
// too soon. Trying to tap the element again.
[self waitForAndTapElement:app.buttons[@"Flutter View (Warm)"]];
newPageAppeared = [app.staticTexts[@"Button tapped 0 times."] waitForExistenceWithTimeout:kStandardTimeOut];
if (!newPageAppeared) {
os_log(OS_LOG_DEFAULT, "%@", app.debugDescription);
}
}
XCTAssertTrue(newPageAppeared);
......
......@@ -12,6 +12,8 @@
@interface MainViewController ()
@property (weak, nonatomic) UIButton* flutterViewWarmButton;
@end
......@@ -39,7 +41,7 @@
[self addButton:@"Native iOS View" action:@selector(showNative)];
[self addButton:@"Full Screen (Cold)" action:@selector(showFullScreenCold)];
[self addButton:@"Full Screen (Warm)" action:@selector(showFullScreenWarm)];
[self addButton:@"Flutter View (Warm)" action:@selector(showFlutterViewWarm)];
self.flutterViewWarmButton = [self addButton:@"Flutter View (Warm)" action:@selector(showFlutterViewWarm)];
[self addButton:@"Hybrid View (Warm)" action:@selector(showHybridView)];
[self addButton:@"Dual Flutter View (Cold)" action:@selector(showDualView)];
}
......@@ -99,26 +101,47 @@
}
- (void)showFlutterViewWarm {
[[self engine].navigationChannel invokeMethod:@"setInitialRoute"
self.flutterViewWarmButton.backgroundColor = UIColor.redColor;
FlutterEngine *engine = [self engine];
FlutterBasicMessageChannel* messageChannel = [self reloadMessageChannel];
NSAssert(engine != nil, @"Engine is not nil.");
NSAssert(engine.navigationChannel != nil, @"Engine.navigationChannel is not nil.");
NSAssert(messageChannel != nil, @"messageChannel is not nil.");
[engine.navigationChannel invokeMethod:@"setInitialRoute"
arguments:@"/"];
[[self reloadMessageChannel] sendMessage:@"/"];
[messageChannel sendMessage:@"/"];
FlutterViewController *flutterViewController =
[[FlutterViewController alloc] initWithEngine:[self engine]
nibName:nil
bundle:nil];
flutterViewController.view.accessibilityLabel = @"flutter view";
NSAssert(self.navigationController != nil, @"self.navigationController is not nil.");
[self.navigationController pushViewController:flutterViewController
animated:YES];
animated:NO];
if (self.navigationController.topViewController != flutterViewController) {
// For debugging:
// Some unknown issue happened caused `flutterViewController` not being pushed.
// We try to push an basic UIViewController to see if it would work.
UIViewController *viewController = [[UIViewController alloc] init];
viewController.view.backgroundColor = UIColor.blueColor;
[self.navigationController pushViewController:viewController
animated:NO];
NSAssert(self.navigationController.topViewController == viewController, @"self.navigationController.topViewController should be the basic view controller");
}
}
- (void)addButton:(NSString *)title action:(SEL)action {
- (UIButton *)addButton:(NSString *)title action:(SEL)action {
UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
[button setTitle:title forState:UIControlStateNormal];
[button addTarget:self
action:action
forControlEvents:UIControlEventTouchUpInside];
[_stackView addArrangedSubview:button];
return button;
}
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment