flutter_driver将暂停的所有动作,直到没有动画播放。
我的UI涉及循环动画,我想在我的集成测试中点击一些东西,而这样的动画正在播放。
一旦我输入一个具有循环动画的屏幕,除非有一个点击输入,否则它不会停止,FlutterDriver将简单地在等待动画完成时超时(因此,在我的集成测试中永远不会发生这种情况)。
基本上,在默认情况下,像driver.tap这样的所有操作都会等待所有动画(至少由AnimationController创建)才能被执行。
test('stop looping animation', () async {
// Navigated to a screen with a looping animation before that.
await driver.tap(find.byValueKey('stop_looping_animation')); // FlutterDriver will time out here.
});发布于 2019-08-12 11:35:38
您可以使用FlutterDriver.runUnsynchronized
test('stop looping animation', () async {
await driver.runUnsynchronized(() async {
await driver.tap(find.byValueKey('stop_looping_animation'));
});
});有一个类似的问题,这个评论起到了帮助:https://github.com/flutter/flutter/issues/34503#issuecomment-503545683
https://stackoverflow.com/questions/57411799
复制相似问题