fix: harden school imports and add optional feedback diagnostics

This commit is contained in:
Codex
2026-10-15 10:37:32 +08:00
parent 674df1ceb3
commit 7299f4d8b6
25 changed files with 722 additions and 42 deletions
+23 -4
View File
@@ -31,10 +31,29 @@ Future<void> reveal(
backwards ? -250 : 250,
scrollable: find.byType(Scrollable).first,
);
await tester.pump();
await tester.pumpAndSettle();
}
void main() {
testWidgets('logs are opt in and included only when checked', (tester) async {
final sender = RecordingSender();
await tester.pumpWidget(MaterialApp(home: FeedbackPage(sender: sender)));
await tester.enterText(find.byKey(const Key('feedback-message')), '无法登录');
await reveal(tester, find.byKey(const Key('feedback-logs')));
expect(
tester
.widget<CheckboxListTile>(find.byKey(const Key('feedback-logs')))
.value,
isFalse,
);
await tester.tap(find.byKey(const Key('feedback-logs')));
await tester.pump();
await reveal(tester, find.byKey(const Key('feedback-submit')));
await tester.tap(find.byKey(const Key('feedback-submit')));
await tester.pumpAndSettle();
expect(sender.submissions.single.diagnosticLog, isNotNull);
expect(sender.submissions.single.attachments, isEmpty);
});
testWidgets('uncertain delivery retains original payload for status check', (
tester,
) async {
@@ -191,7 +210,7 @@ void main() {
),
);
await tester.enterText(find.byKey(const Key('feedback-message')), '旧问题');
await tester.ensureVisible(find.byKey(const Key('feedback-add-media')));
await reveal(tester, find.byKey(const Key('feedback-add-media')));
await tester.tap(find.byKey(const Key('feedback-add-media')));
await tester.pumpAndSettle();
await reveal(tester, find.text('我要参与开发'), backwards: true);
@@ -303,7 +322,7 @@ void main() {
),
);
await tester.enterText(find.byKey(const Key('feedback-message')), '问题');
await tester.ensureVisible(find.byKey(const Key('feedback-add-media')));
await reveal(tester, find.byKey(const Key('feedback-add-media')));
await tester.tap(find.byKey(const Key('feedback-add-media')));
await tester.pumpAndSettle();
expect(find.text('screen.png'), findsOneWidget);
@@ -312,7 +331,7 @@ void main() {
await tester.pumpAndSettle();
expect(sender.submissions.single.attachments, hasLength(1));
expect(find.text('screen.png'), findsOneWidget);
await tester.ensureVisible(find.byTooltip('移除 screen.png'));
await reveal(tester, find.byTooltip('移除 screen.png'), backwards: true);
await tester.tap(find.byTooltip('移除 screen.png'));
await tester.pumpAndSettle();
expect(find.text('screen.png'), findsNothing);