Files
TPSchedule/mobile/test/widgets/rschedule_navigation_test.dart
T

49 lines
1.8 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:hepan_everyday/app/hepan_app.dart';
import 'package:hepan_everyday/features/timetable/timetable_page.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.descendant(
of: find.byType(TimetablePage),
matching: find.text('课表'),
),
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();
});
}