Skip to content

Commit

Permalink
Changed the test 1168 and 1216 to not fail on mondays. The test was m…
Browse files Browse the repository at this point in the history
…ade in such a way, that the pumpandsettle method would change a needed state on mondays.
  • Loading branch information
SadAndBroken committed Nov 17, 2023
1 parent a8daa76 commit 1548b67
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions test/screens/weekplan_screen_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1170,17 +1170,20 @@ void main() {
(WidgetTester tester) async {
await tester.runAsync(() async {
final Completer<bool> checkCompleted = Completer<bool>();

int i = 0;
if(DateTime.now().toString() == DateTime.monday.toString()){
i++;
}
mockActivities[2].state = ActivityState.Normal;
mockActivities[2].timer.paused = true;
mockActivities[2].timer.fullLength = 100;
mockWeek.days[0].activities.add(mockActivities[2]);
mockWeek.days[i].activities.add(mockActivities[2]);
authBloc.setMode(WeekplanMode.citizen);
final WeekplanScreen weekplanScreen = WeekplanScreen(mockWeek, user);
await tester.pumpWidget(MaterialApp(home: weekplanScreen));

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

Expand Down Expand Up @@ -1218,17 +1221,20 @@ void main() {
(WidgetTester tester) async {
await tester.runAsync(() async {
final Completer<bool> checkCompleted = Completer<bool>();

int i = 0;
if(DateTime.now().toString() == DateTime.monday.toString()){
i++;
}
mockActivities[2].state = ActivityState.Normal;
mockActivities[2].timer.paused = true;
mockActivities[2].timer.fullLength = 100;
mockWeek.days[0].activities.add(mockActivities[2]);
mockWeek.days[i].activities.add(mockActivities[2]);
authBloc.setMode(WeekplanMode.citizen);
final WeekplanScreen weekplanScreen = WeekplanScreen(mockWeek, user);
await tester.pumpWidget(MaterialApp(home: weekplanScreen));

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

Expand Down

0 comments on commit 1548b67

Please sign in to comment.