我正在尝试为我的应用程序设置 Flutter Driver 测试,并且应用程序运行异步,所以我发现https://github.com/flutter/flutter/issues/41029
它说你需要做的就是添加await driver.waitUntilFirstFrameRasterized();
并且它应该可以工作,而这确实阻止了测试失败,它根本不会运行。
该应用程序只是挂在启动屏幕上,甚至从未进入应用程序本身。
据我了解,这就是我需要进行的所有设置才能运行测试
FlutterDriver driver;
// Connect to the Flutter driver before running any tests.
setUpAll(() async {
driver = await FlutterDriver.connect();
await driver.waitUntilFirstFrameRasterized();
// await Directory('screenshots').create();
});
// Close the connection to the driver after the tests have completed.
tearDownAll(() async {
if (driver != null) {
await driver.close();
}
});
但是,我在终端中得到的只是以下输出:
VMServiceFlutterDriver: Connecting to Flutter application at http://127.0.0.1:54264/tt9kN4jBSrc=/
VMServiceFlutterDriver: Isolate found with number: 2942164624858163
VMServiceFlutterDriver: Isolate is paused at start.
VMServiceFlutterDriver: Attempting to resume isolate
VMServiceFlutterDriver: Connected to Flutter application.
VMServiceFlutterDriver: waitForCondition message is taking a long time to complete...
我已经离开了几分钟,但什么也没发生,我已经禁用了 firebase 初始化,以防万一它被阻止,因为我需要接受警报对话,而不是我什至可以看到那么远。