I have an alert dialog like this:
return AlertDialog(
actions: <Widget>[
FlatButton(
onPressed: (){
Navigator.pop(context);
});
I would like to test that, when the user presses on the FlatButton, the alert will pop. This is my test:
await tester.pumpWidget(generateView());
await tester.pump();
await tester.tap(find.byType(FlatButton));
await tester.pump();
expect(find.byType(AlertDialog), findsNothing);
This test will enter inside onPressed()
, but it will fail saying that there is still one AlertDialog.
Aucun commentaire:
Enregistrer un commentaire