当我使用Flutter驱动程序运行集成测试时,我发现我的应用程序中的图像根本没有加载。尽管如果我从运行状态运行应用程序,一切都会正常运行。
这是我的测试代码:
// Imports the Flutter Driver API
import 'package:flutter_driver/flutter_driver.dart';
import 'package:test/test.dart';
void main() {
group('login page ignore', () {
// First, define the Finders. We can use these to locate Widgets from the
// test suite. Note: the Strings provided to the `byValueKey` method must
// be the same as the Strings we used for the Keys in step 1.
final ignoreFinder = find.byValueKey('ignore');
final screenFinder = find.byValueKey('child_screen');
FlutterDriver driver;
// Connect to the Flutter driver before running any tests
setUpAll(() async {
driver = await FlutterDriver.connect();
});
// Close the connection to the driver after the tests have completed
tearDownAll(() async {
if (driver != null) {
driver.close();
}
});
test('test',() async {
await driver.waitUntilNoTransientCallbacks();
await driver.waitFor(ignoreFinder);
await driver.tap(ignoreFinder);
print('button clicked');
});
});
}