feat: deliver RSchedule service login exams and elastic glass navigation

This commit is contained in:
Codex
2026-10-13 17:06:50 +08:00
parent 9193fd8e43
commit 8f20a341c4
35 changed files with 1742 additions and 453 deletions
+4 -4
View File
@@ -16,14 +16,14 @@ void main() {
await c.showDemo();
await tester.pumpWidget(HepanApp(controller: c));
await tester.pumpAndSettle();
expect(find.text('Riverside Schedule'), findsOneWidget);
expect(find.text('RSchedule'), findsOneWidget);
expect(tester.getRect(find.text('周日')).right, lessThanOrEqualTo(800));
await tester.drag(find.text('周三'), const Offset(-250, 0));
await tester.pumpAndSettle();
expect(find.text('登录学校账户'), findsNothing);
await tester.drag(
find.byKey(const Key('dock-cursor')),
const Offset(100, 0),
const Offset(185, 0),
);
await tester.pumpAndSettle();
expect(find.text('登录学校账户'), findsOneWidget);
@@ -32,11 +32,11 @@ void main() {
expect(find.text('登录学校账户'), findsOneWidget);
await tester.drag(
find.byKey(const Key('dock-cursor')),
const Offset(-100, 0),
const Offset(-185, 0),
);
await tester.pumpAndSettle();
expect(find.text('示例课表'), findsOneWidget);
await tester.tap(find.bySemanticsLabel('我的'));
await tester.tap(find.bySemanticsLabel('个人设置'));
await tester.pumpAndSettle();
expect(find.text('登录学校账户'), findsOneWidget);
c.dispose();
@@ -0,0 +1,43 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:timezone/data/latest.dart' as tzdata;
import 'package:webview_flutter_platform_interface/webview_flutter_platform_interface.dart';
import 'package:hepan_everyday/app/hepan_app.dart';
import 'package:hepan_everyday/features/school/school_session.dart';
import '../support/fake_school_web.dart';
import 'navigation_test.dart' show uiController;
void main() {
setUpAll(tzdata.initializeTimeZones);
testWidgets(
'logout failure is visible and user can retry clearing school login',
(tester) async {
final platform = FakeSchoolPlatform();
WebViewPlatform.instance = platform;
final school = SchoolSession();
await school.open();
final c = uiController();
await c.initialize();
await tester.pumpWidget(HepanApp(controller: c, school: school));
await tester.pumpAndSettle();
await tester.tap(find.bySemanticsLabel('个人设置'));
await tester.pumpAndSettle();
platform.cookies.fail = true;
await tester.tap(find.text('退出学校登录'));
await tester.pumpAndSettle();
await tester.tap(find.text('保留课表和考试'));
await tester.pumpAndSettle();
expect(find.textContaining('学校退出未完成'), findsOneWidget);
expect(find.text('重试退出学校登录'), findsOneWidget);
platform.cookies.fail = false;
await tester.tap(find.text('重试退出学校登录'));
await tester.pumpAndSettle();
await tester.tap(find.text('保留课表和考试'));
await tester.pumpAndSettle();
expect(find.text('重试退出学校登录'), findsNothing);
expect(find.textContaining('学校退出未完成'), findsNothing);
school.dispose();
c.dispose();
},
);
}
+2 -2
View File
@@ -21,8 +21,8 @@ void main() {
await controller.initialize();
await tester.pumpWidget(HepanApp(controller: controller));
await tester.pumpAndSettle();
expect(find.bySemanticsLabel('我的'), findsOneWidget);
await tester.tap(find.bySemanticsLabel('我的'));
expect(find.bySemanticsLabel('个人设置'), findsOneWidget);
await tester.tap(find.bySemanticsLabel('个人设置'));
await tester.pumpAndSettle();
expect(find.text('登录学校账户'), findsOneWidget);
expect(find.text('课表设置'), findsOneWidget);
+1 -1
View File
@@ -37,7 +37,7 @@ void main() {
await tester.tap(find.text('保留损坏文件并重新建立'));
await tester.pumpAndSettle();
expect(controller.storageReady, isTrue);
await tester.tap(find.bySemanticsLabel('我的'));
await tester.tap(find.bySemanticsLabel('个人设置'));
await tester.pumpAndSettle();
await tester.ensureVisible(find.text('课表设置'));
await tester.pumpAndSettle();
@@ -0,0 +1,41 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:hepan_everyday/app/hepan_app.dart';
import 'package:timezone/data/latest.dart' as tzdata;
import 'navigation_test.dart' show uiController;
void main() {
setUpAll(tzdata.initializeTimeZones);
testWidgets('three icon tabs and vertical scroll hide and restore Dock', (
tester,
) async {
tester.view.physicalSize = const Size(390, 844);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);
final c = uiController();
await c.initialize();
await c.showDemo();
await tester.pumpWidget(HepanApp(controller: c));
await tester.pumpAndSettle();
expect(find.text('RSchedule'), findsOneWidget);
expect(find.bySemanticsLabel('考试'), findsOneWidget);
await tester.drag(find.text('周三'), const Offset(0, -200));
await tester.pumpAndSettle();
expect(find.bySemanticsLabel('考试').hitTestable(), findsNothing);
await tester.drag(find.byType(ListView).first, const Offset(0, 100));
await tester.pumpAndSettle();
expect(find.bySemanticsLabel('考试').hitTestable(), findsOneWidget);
await tester.tap(find.bySemanticsLabel('考试'));
await tester.pumpAndSettle();
expect(find.text('考试安排'), findsOneWidget);
await tester.drag(find.text('考试安排'), const Offset(-200, 0));
await tester.pumpAndSettle();
expect(find.text('考试安排'), findsOneWidget);
await tester.tap(find.bySemanticsLabel('个人设置'));
await tester.pumpAndSettle();
expect(find.text('登录学校账户'), findsOneWidget);
c.dispose();
});
}
+2 -2
View File
@@ -99,8 +99,8 @@ void main() {
await controller.initialize();
await tester.pumpWidget(HepanApp(controller: controller));
await tester.pumpAndSettle();
expect(find.bySemanticsLabel('我的'), findsOneWidget);
await tester.tap(find.bySemanticsLabel('我的'));
expect(find.bySemanticsLabel('个人设置'), findsOneWidget);
await tester.tap(find.bySemanticsLabel('个人设置'));
await tester.pumpAndSettle();
await tester.ensureVisible(find.text('课表设置'));
await tester.pumpAndSettle();
+2 -2
View File
@@ -39,8 +39,8 @@ void main() {
);
await tester.pumpAndSettle();
expect(find.bySemanticsLabel('课表'), findsOneWidget);
expect(find.bySemanticsLabel('我的'), findsOneWidget);
await tester.tap(find.bySemanticsLabel('我的'));
expect(find.bySemanticsLabel('个人设置'), findsOneWidget);
await tester.tap(find.bySemanticsLabel('个人设置'));
await tester.pumpAndSettle();
selection.value = 'math/2026-09-09';
await tester.pumpAndSettle();