feat(flutter): 新剧首映厅与档期预约页
This commit is contained in:
1 parent
fdee89b345
commit
4f81bcf2b1
10 files changed
+998
-61
No files matched your search
@@ -4,10 +4,10 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:fruitshorts/app.dart';
|
||||
import 'package:fruitshorts/core/data/models/drama.dart';
|
||||
import 'package:fruitshorts/core/theme/app_colors.dart';
|
||||
import 'package:fruitshorts/core/data/repositories/favorite_repository.dart';
|
||||
import 'package:fruitshorts/core/data/repositories/playback_repository.dart';
|
||||
import 'package:fruitshorts/core/data/repositories/watch_history_repository.dart';
|
||||
import 'package:fruitshorts/pages/discover/widgets/drama_grid.dart';
|
||||
import 'package:shared_preferences_platform_interface/in_memory_shared_preferences_async.dart';
|
||||
import 'package:shared_preferences_platform_interface/shared_preferences_async_platform_interface.dart';
|
||||
|
||||
@@ -46,12 +46,20 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byKey(const Key('new-releases-page')), findsOneWidget);
|
||||
final grid = tester.widget<DramaGrid>(find.byType(DramaGrid));
|
||||
expect(grid.dramas.map((drama) => drama.id).toList(), [
|
||||
'vengeance-demo',
|
||||
'the-signal-demo',
|
||||
'city-lights-demo',
|
||||
]);
|
||||
expect(find.byKey(const Key('new-releases-hero')), findsOneWidget);
|
||||
expect(find.text('Vengeance Rising'), findsWidgets);
|
||||
expect(
|
||||
find.byKey(const Key('new-release-card-the-signal-demo')),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(
|
||||
find.byKey(const Key('new-release-card-city-lights-demo')),
|
||||
findsOneWidget,
|
||||
);
|
||||
|
||||
await tester.tap(find.byKey(const Key('new-releases-hero')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byKey(const Key('player-scaffold')), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should_open_reserve_empty_state', (tester) async {
|
||||
@@ -60,12 +68,26 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byKey(const Key('reserve-page')), findsOneWidget);
|
||||
expect(find.byKey(const Key('reserve-week-strip')), findsOneWidget);
|
||||
for (var index = 0; index < 7; index++) {
|
||||
expect(find.byKey(Key('reserve-day-$index')), findsOneWidget);
|
||||
}
|
||||
expect(find.byKey(const Key('reserve-empty')), findsOneWidget);
|
||||
expect(find.text('Coming soon'), findsOneWidget);
|
||||
expect(
|
||||
tester.widget<TextButton>(find.byType(TextButton)).onPressed,
|
||||
isNull,
|
||||
for (var index = 1; index <= 3; index++) {
|
||||
expect(find.byKey(Key('reserve-step-$index')), findsOneWidget);
|
||||
}
|
||||
final todayIndex = DateTime.now().weekday - 1;
|
||||
final today = tester.widget<Container>(
|
||||
find.descendant(
|
||||
of: find.byKey(Key('reserve-day-$todayIndex')),
|
||||
matching: find.byType(Container),
|
||||
),
|
||||
);
|
||||
expect((today.decoration! as BoxDecoration).color, AppColors.blue);
|
||||
|
||||
await tester.tap(find.byKey(const Key('reserve-go-new')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byKey(const Key('new-releases-page')), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should_render_podium_with_center_on_top', (tester) async {
|
||||
@@ -119,7 +141,7 @@ void main() {
|
||||
await tester.tap(find.byKey(const Key('theater-toolbar-new')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
final card = find.byKey(const Key('home-drama-card-the-signal-demo'));
|
||||
final card = find.byKey(const Key('new-release-card-the-signal-demo'));
|
||||
await tester.ensureVisible(card);
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(card);
|
||||
|
||||
Reference in new issue
Block a user