I have two tests that after a click on a button I want to test if a CircularProgressIndicator will appear on the button. The problem is after the tap and the tester.pump()
, it can't find the CircularProgressIndicator causing the test to fail, I tried with pumpAndSettle()
and also add a Duration(seconds:x)
but got the same error
It's weird because the tests were ok before I update my flutterFire packages and migrate to use the Android embbeding V2.
testWidgets("Should show loading button when click on request button ",
(WidgetTester tester) async {
await tester.pumpWidget(
_buildWidget(
home: FinancialDialogBill(
paymentId: "fakePaymentId",
additionalValueType: AdditionalValueType.fee,
billValues: billValues,
installmentList: installments,
),
),
);
expect(find.byKey(financialDialogBillRequestButton), findsOneWidget);
expect(find.byKey(financialDialogBillRequestButtonLoading), findsNothing);
await tester.tap(find.byKey(financialDialogBillRequestButton));
await tester.pump();
expect(
find.byKey(financialDialogBillRequestButtonLoading), findsOneWidget);
expect(find.byKey(financialDialogBillRequestButton), findsNothing);
});
});
Aucun commentaire:
Enregistrer un commentaire