vendredi 7 août 2020

EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK

Expected: exactly one matching node in the widget tree Which: means none were found but one was expected When the exception was thrown, this was the stack: #4 main..

#6 testWidgets.. (package:flutter_test/src/widget_tester.dart:140:29)

 

     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);
      },
    );
  });
}

Aucun commentaire:

Enregistrer un commentaire