SyncFusion Calendar Flutter widget unclear how to test it

121 views Asked by At

I used the widget to build a basic application for self learning purpose. I would like to widget test what I am done but there's something unclear to me on the topic. In the widget test I wrote this:

// Render the widget.
await tester.pumpWidget(MaterialApp(
    title: 'Firestore test', home: Calendar(firestore: firestore)));

// Let the snapshots stream fire a snapshot.
await tester.idle();

// Re-render.
await tester.pump();

// Verify the output.
expect(find.text('Appointments'), findsOneWidget);
expect(find.text('No selected date'), findsOneWidget);

With last line that verifies that without any interaction the SyncFusion calendar should display "No selected date" in the agenda. That line fails as no widget are found. I also tried to do a test with the tap to a given date to display the events for a day, but the tap does not work as well.

// pre filled data before
// ...
await tester.pumpWidget(MaterialApp(
    title: 'Firestore test', home: Calendar(firestore: firestore)));

// Let the snapshots stream fire a snapshot.
await tester.idle();

// Re-render.
await tester.pump();

await tester.tap(find.text(datetime.day.toString()));
await tester.pumpAndSettle();

await tester.pump();

// Verify the output.
expect(find.text('Appointments'), findsOneWidget);
expect(find.text('Mark', skipOffstage: false), findsOneWidget);

Could you help me understand what I am missing in order to verify the above behaviour?

0

There are 0 answers