Skip to content

Commit

Permalink
Fikset 'click Activity Card Does Nothing If Completed Or Timer Runnin…
Browse files Browse the repository at this point in the history
…g For Citizen' og 'click Activity Card Does Nothing If Completed Or Timer Running For Citizen' dog uden at inkorporer issue 936
  • Loading branch information
SadAndBroken committed Dec 12, 2023
1 parent 25d8036 commit 5e5aa44
Showing 1 changed file with 26 additions and 19 deletions.
45 changes: 26 additions & 19 deletions test/screens/weekplan_screen_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1322,29 +1322,36 @@ void main() {

testWidgets('activity Card Start Time When Activated And Shows It For Citizen', (
WidgetTester tester) async {
final Completer<bool> checkCompleted = Completer<bool>();
await tester.runAsync(() async{
final Completer<bool> checkCompleted = Completer<bool>();

mockActivities[2].state = ActivityState.Normal;
mockActivities[2].timer!.paused = true;
mockActivities[2].timer!.fullLength = 100;
mockWeek.days![0].activities!.add(mockActivities[2]);
authBloc.setMode(WeekplanMode.citizen);
final WeekplanScreen weekplanScreen =
WeekplanScreen(mockWeek, user, key: UniqueKey());
await tester.pumpWidget(MaterialApp(home: weekplanScreen));
mockActivities[2].state = ActivityState.Normal;
mockActivities[2].timer!.paused = true;
mockActivities[2].timer!.fullLength = 100;
mockWeek.days![0].activities!.add(mockActivities[2]);
authBloc.setMode(WeekplanMode.citizen);
final WeekplanScreen weekplanScreen =
WeekplanScreen(mockWeek, user, key: UniqueKey());
await tester.pumpWidget(MaterialApp(home: weekplanScreen));

await tester.pumpAndSettle();
await tester.tap(find.byKey(Key(mockWeek.days![0].day!.index.toString() +
mockActivities[2].id.toString())));
await tester.pumpAndSettle();
await tester.pumpAndSettle();
await tester.tap(find.byKey(Key(mockWeek.days![0].day!.index.toString() +
mockActivities[2].id.toString())));
await tester.pumpAndSettle();

expect(find.byKey(const Key('TimerInitKey')), findsOneWidget);
// ignore: always_specify_types
Future.delayed(const Duration(seconds: 2), () async {
checkCompleted.complete(true);
await checkCompleted.future;
expect(find.byKey(const Key('IconComplete')), findsOneWidget);
expect(find.byKey(const Key('TimerInitKey')), findsOneWidget);

await tester.tap(find.byKey(Key(mockWeek.days![0].day!.index.toString() +
mockActivities[2].id.toString())));
// ignore: always_specify_types
Future.delayed(const Duration(seconds: 2), () async {
checkCompleted.complete(true);
await checkCompleted.future;

expect(find.byKey(const Key('IconComplete')), findsOneWidget);
});
});

});

testWidgets('_activityCardHasCompletedIconWhenActivityIsCompleted', (
Expand Down

0 comments on commit 5e5aa44

Please sign in to comment.