I've got this custom Widget component:
class CollectAssetDataButton extends StatelessWidget {
const CollectAssetDataButton({ Key key }) : super(key: key);
@override
Widget build(BuildContext context) {
return RaisedButton(
child: Text(
context
.translate(I18NKeys.appointmentDetails.collectAssetsData)
.toUpperCase(),
),
onPressed: () {},
);
}
}
And I'm trying to test it using:
final collectAssetsButtonFinder = find.byKey(WidgetKeysAppointmentDetails.collectAssetsButton);
expect(collectAssetsButtonFinder, findsOneWidget);
as per a suggestion in https://github.com/flutter/flutter/issues/54651
But I'm still getting:
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following TestFailure object was thrown running a test:
Expected: exactly one matching node in the widget tree
Actual: _KeyFinder:<zero widgets with key [<'___appointment_details_collect_assets_button___'>]
(ignoring offstage widgets)>
Which: means none were found but one was expected
Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire