feat(recommend): 新增分区流全部短剧与剧单

This commit is contained in:
Zhou Weidong committed 2026-10-22 17:23:22 +08:00
1 parent 0ef2438100
commit f1b5418954
22 files changed
+1426 -722

No files matched your search

+18 -22
View File
@@ -66,7 +66,7 @@ void main() {
await tester.pumpAndSettle();
// 首页 feed 启动会创建首个播放器,先清掉再统计剧场播放器。
created.clear();
await _openRecommendFullPlayer(tester);
await _openFullPlayerFromHomeGrid(tester);
expect(created, isNotEmpty);
final createdBeforeSwipe = created.length;
@@ -79,7 +79,7 @@ void main() {
contains('Episode 2'),
);
expect(created.length, greaterThan(createdBeforeSwipe));
expect(created, contains('the-signal-demo-2'));
expect(created, contains('city-lights-demo-2'));
});
testWidgets('should_open_fullscreen_player_when_theater_card_is_tapped', (
@@ -87,7 +87,7 @@ void main() {
) async {
await tester.pumpWidget(appUnderTest());
await tester.pumpAndSettle();
await _openRecommendFullPlayer(tester);
await _openFullPlayerFromHomeGrid(tester);
final player = tester.widget<PlayerPage>(find.byType(PlayerPage).last);
expect(player.homeMode, isFalse);
@@ -104,23 +104,17 @@ void main() {
await tester.pumpWidget(appUnderTest());
await tester.pumpAndSettle();
await _openRecommendFullPlayer(tester);
await _openFullPlayerFromHomeGrid(tester);
expect(find.byType(PlayerPage), findsOneWidget);
await tester.tap(find.byKey(const Key('player-back')));
await tester.pumpAndSettle();
expect(find.byKey(const Key('home-feed-title')), findsOneWidget);
expect(find.byKey(const Key('home-grid')), findsOneWidget);
expect(
Navigator.of(
tester.element(find.byKey(const Key('home-feed-title'))),
).canPop(),
Navigator.of(tester.element(find.byKey(const Key('home-grid')))).canPop(),
isFalse,
);
await tester.binding.handlePopRoute();
await tester.pumpAndSettle();
expect(find.byKey(const Key('home-grid')), findsOneWidget);
await tester.tap(find.byKey(const Key('tab-follow')));
await tester.pumpAndSettle();
expect(find.byKey(const Key('favorites-page')), findsOneWidget);
@@ -184,7 +178,7 @@ void main() {
await tester.pumpWidget(appUnderTest());
await tester.pumpAndSettle();
await _openRecommendFullPlayer(tester);
await _openFullPlayerFromHomeGrid(tester);
expect(find.byKey(const Key('progress-loading')), findsNothing);
expect(find.byKey(const Key('progress-inactive')), findsOneWidget);
@@ -241,7 +235,7 @@ void main() {
),
);
await tester.pumpAndSettle();
await _openRecommendFullPlayer(tester);
await _openFullPlayerFromHomeGrid(tester);
await tester.tap(find.byKey(const Key('player-rail-comments')));
await tester.pumpAndSettle();
@@ -261,13 +255,13 @@ void main() {
await tester.tap(find.byKey(const Key('player-rail-like')));
await tester.pumpAndSettle();
expect(interactions.likeTargets, contains('EPISODE:the-signal-demo-1'));
expect(interactions.likeTargets, contains('EPISODE:city-lights-demo-1'));
await tester.tap(find.byKey(const Key('player-rail-save')));
await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('player-rail-share')));
await tester.pumpAndSettle();
expect(sharedText, contains('The Signal'));
expect(sharedText, contains('City Lights & Velvet Nights'));
expect(sharedText, contains('FruitShorts'));
expect(tester.takeException(), isNull);
});
@@ -281,7 +275,7 @@ void main() {
await tester.pumpWidget(appUnderTest(interactionRepository: interactions));
await tester.pumpAndSettle();
await _openRecommendFullPlayer(tester);
await _openFullPlayerFromHomeGrid(tester);
await tester.tap(find.byKey(const Key('player-rail-like')));
await tester.pumpAndSettle();
@@ -297,7 +291,7 @@ void main() {
await tester.pumpWidget(appUnderTest());
await tester.pumpAndSettle();
await _openRecommendFullPlayer(tester);
await _openFullPlayerFromHomeGrid(tester);
await tester.tap(find.byKey(const Key('player-rail-save')));
await tester.pumpAndSettle();
@@ -308,13 +302,15 @@ void main() {
await tester.tap(find.byKey(const Key('mine-watchlist')));
await tester.pumpAndSettle();
expect(find.text('The Signal'), findsWidgets);
expect(find.text('City Lights & Velvet Nights'), findsWidgets);
});
}
Future<void> _openRecommendFullPlayer(WidgetTester tester) async {
await tester.tap(find.byKey(const Key('tab-recommend')));
Future<void> _openFullPlayerFromHomeGrid(WidgetTester tester) async {
await tester.tap(find.byKey(const Key('tab-home')));
await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('home-feed-full-series')));
final card = find.byKey(const Key('home-feed-card-city-lights-demo'));
await tester.ensureVisible(card);
await tester.tap(card);
await tester.pumpAndSettle();
}