In my integration tests I have to keep doing: await tester.pumpAndSettle(const Duration(seconds: [some duration]));
to wait for the widgets to load to the screen after animation delays, otherwise I get the error: "bad state: no element".
Is this the best way to handle this issue? I find it is very flaky now that I am trying to add integration tests to my continuous integration platform. I have had to add more time to the duration to wait which feels quite yuck (race condition) and will also increase the costs of continuous integration due to build times taking longer. Here is an example of the code:
Future<void> registerUserPasswordButtonShouldBeDisabled() async {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
testWidgets('''registering a new user with non-unique email address disables
register password button''', (WidgetTester tester) async {
await app.main();
await tester.pumpAndSettle(const Duration(seconds: 5));
final registerButton = find.byKey(const Key('register'));
Is there a better way to handle the "bad state: no element" error due to delayed animations causing widgets to not appear on the screen until some delay?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…