Ожидается: ровно один соответствующий узел в дереве виджетов
Что: означает, что ни один не был найден, но ожидался
Когда было сгенерировано исключение, это был стек:
#4 main.<anonymous closure>.<anonymous closure>
#6 testWidgets.<anonymous closure>.<anonymous closure> (package:flutter_test/src/widget_tester.dart:140:29)
<asynchronous suspension>
IconButton(
key: Key("profileIconKey"),
onPressed: () {
//this is to reset the event chiose chip selection
Constants.eventsCurrentSelectedChoiseChip = 0;
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) {
//return Profile(Strings.ProfileInitialState);
return ProfileNew(Strings.ProfileInitialState);
},
),
);
},
icon: Icon(CustomIcons.female_avatar_and_circle22,
size: 25, color: Colors.grey),
),
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:slc/view/dashboard/dashboard.dart';
void main() {
Widget makeTestableWidget({Widget child}) {
return EasyLocalization(
child: child,
path: 'resources/langs',
supportedLocales: [Locale('en', 'US'), Locale('ar', 'DZ')],
fallbackLocale: Locale('en', 'US'),
);
}
group("full smoke test", () {
final notificationIcon = find.byKey(Key("notificationIconKey"));
testWidgets(
'dashboard 0 smoke test',
(WidgetTester tester) async {
await tester.pumpWidget(makeTestableWidget(
child: Dashboard(
selectedIndex: 0,
)));
expect(notificationIcon, findsOneWidget);
},
);
});
}