feat: extend optional HTML feedback to graduate imports in 0.7.8

This commit is contained in:
Codex
2026-10-24 15:15:29 +08:00
parent 9a198fe466
commit a946aa6ec0
24 changed files with 513 additions and 36 deletions
+34
View File
@@ -37,6 +37,40 @@ Future<void> reveal(
}
void main() {
testWidgets('graduate HTML can be selected, consented and sent with logs', (
tester,
) async {
final store = SchoolPageDiagnostic.instance;
addTearDown(store.clear);
store.remember(
'<select id="drpxq"><option value="73" selected>2026-2027秋</option></select>'
'<table id="tbl"><tr><td id="t11">研究生课程排查内容</td></tr></table>',
Uri.parse('https://yjsjy.uestc.edu.cn/pyxx/pygl/xskbcx/index/73'),
);
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-html')));
await tester.tap(find.byKey(const Key('feedback-logs')));
await tester.pump();
await tester.tap(find.byKey(const Key('feedback-html')));
await tester.pumpAndSettle();
await tester.tap(find.text('同意附带'));
await tester.pumpAndSettle();
await reveal(tester, find.byKey(const Key('feedback-submit')));
await tester.tap(find.byKey(const Key('feedback-submit')));
await tester.pumpAndSettle();
expect(sender.submissions, hasLength(1));
expect(sender.submissions.single.diagnosticLog, isNotNull);
expect(
utf8.decode(sender.submissions.single.diagnosticHtml!),
contains('研究生课程排查内容'),
);
expect(store.export(), isNull);
});
testWidgets('HTML is opt in, confirmed, and stays identical on retry', (
tester,
) async {