Skip to content

Commit

Permalink
Add integration test to load feedback history (#1387)
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsreichardt authored Mar 14, 2024
1 parent af155e3 commit e494dbf
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 2 deletions.
14 changes: 14 additions & 0 deletions app/integration_test/app_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,20 @@ void main() {
// We a searching for an information sheet that is already created.
expect($('German Course Trip to Berlin'), findsOneWidget);
});

patrolTest(
'User should be able to load feedback',
config: config,
($) async {
await login($);
await $(K.feedbackNavigationItem).tap();

await $(K.openFeedbackHistory).tap();
await $('Feedback for our integration tests').waitUntilExists();
},
// See "Test: User should be able to load feedback" in "integration_test_old.dart"
skip: !PlatformCheck.isDesktopOrWeb,
);
});
}

Expand Down
16 changes: 16 additions & 0 deletions app/integration_test/integration_test_old.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:sharezone/keys.dart';
import 'package:sharezone/main/run_app.dart';
import 'package:sharezone/main/sharezone.dart';
import 'package:sharezone/util/flavor.dart';
Expand Down Expand Up @@ -144,6 +145,21 @@ void main() {
// We don't check the text of the information sheet for now because the
// `find.text()` can't find text `MarkdownBody` which it a bit more
// complex.

log("Test: User should be able to load feedback");
if (PlatformCheck.isDesktopOrWeb) {
// We currently, only test on desktop and web, because the feedback
// button on mobile is in the drawer and it's not worth implement this
// behavior for the integration tests because we change the navigation
// in the next weeks.
await tester.tap(find.byKey(K.feedbackNavigationItem));
await tester.pumpAndSettle();

await tester.tap(find.byKey(K.openFeedbackHistory));
await tester.pumpAndSettle();

await tester.pumpUntil(find.text('Feedback for our integration tests'));
}
});
});
}
Expand Down
2 changes: 2 additions & 0 deletions app/lib/feedback/feedback_box_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import 'package:sharezone/feedback/history/feedback_history_page_controller.dart
import 'package:sharezone/feedback/src/bloc/feedback_bloc.dart';
import 'package:sharezone/feedback/src/cache/cooldown_exception.dart';
import 'package:sharezone/feedback/src/widgets/thank_you_bottom_sheet.dart';
import 'package:sharezone/keys.dart';
import 'package:sharezone/navigation/logic/navigation_bloc.dart';
import 'package:sharezone/navigation/models/navigation_item.dart';
import 'package:sharezone/navigation/scaffold/app_bar_configuration.dart';
Expand Down Expand Up @@ -67,6 +68,7 @@ class _HistoryButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return IconButton(
key: K.openFeedbackHistory,
tooltip: "Meine Feedbacks",
icon: const Icon(Icons.history),
onPressed: () {
Expand Down
2 changes: 2 additions & 0 deletions app/lib/keys.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ class K {
static const groupsNavigationItem = Key('nav-item-groups-E2E');
static const timetableNavigationItem = Key('nav-item-timetable-E2E');
static const blackboardNavigationItem = Key('nav-item-blackboard-E2E');
static const feedbackNavigationItem = Key('nav-item-feedback-E2E');
static const openFeedbackHistory = Key('open-feedback-history-E2E');
}
9 changes: 7 additions & 2 deletions app/lib/navigation/models/navigation_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,13 @@ extension NavigationItemExtension on NavigationItem {
return Icon(themeIconData(Icons.settings,
cupertinoIcon: SFSymbols.gear_alt_fill));
case NavigationItem.feedbackBox:
return Icon(themeIconData(Icons.message,
cupertinoIcon: SFSymbols.exclamationmark_bubble_fill));
return Icon(
key: K.feedbackNavigationItem,
themeIconData(
Icons.message,
cupertinoIcon: SFSymbols.exclamationmark_bubble_fill,
),
);
case NavigationItem.accountPage:
return Icon(
themeIconData(Icons.person, cupertinoIcon: SFSymbols.person_fill));
Expand Down

0 comments on commit e494dbf

Please sign in to comment.