test: 按新 UI 基线重写过期用例
覆盖 155 条失败与 4 处编译错误:入口改走推荐流 tab、弹框换 AppGlowDialog、 rail 尺寸与底部锚定、子页标题字重 w400、底栏选中品牌红、收藏文案改收藏短剧。 全量 flutter test 775 通过。
This commit is contained in:
1 parent
799f3d1b7d
commit
1d4ab5e0e6
33 files changed
+853
-1114
No files matched your search
+30
-23
@@ -66,7 +66,7 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
// 首页 feed 启动会创建首个播放器,先清掉再统计剧场播放器。
|
||||
created.clear();
|
||||
await _openFullPlayerFromHomeGrid(tester);
|
||||
await _openFullPlayerFromHomeFeed(tester);
|
||||
|
||||
expect(created, isNotEmpty);
|
||||
final createdBeforeSwipe = created.length;
|
||||
@@ -82,12 +82,12 @@ void main() {
|
||||
expect(created, contains('city-lights-demo-2'));
|
||||
});
|
||||
|
||||
testWidgets('should_open_fullscreen_player_when_theater_card_is_tapped', (
|
||||
testWidgets('should_open_fullscreen_player_when_series_title_is_tapped', (
|
||||
tester,
|
||||
) async {
|
||||
await tester.pumpWidget(appUnderTest());
|
||||
await tester.pumpAndSettle();
|
||||
await _openFullPlayerFromHomeGrid(tester);
|
||||
await _openFullPlayerFromHomeFeed(tester);
|
||||
|
||||
final player = tester.widget<PlayerPage>(find.byType(PlayerPage).last);
|
||||
expect(player.homeMode, isFalse);
|
||||
@@ -97,21 +97,24 @@ void main() {
|
||||
testWidgets('should_keep_four_root_tabs_on_one_route_and_return_home', (
|
||||
tester,
|
||||
) async {
|
||||
tester.view.physicalSize = const Size(390, 844);
|
||||
// 追剧页头部双语分段在测试字体(Ahem)下更宽,放宽视口避免撑破分段行。
|
||||
tester.view.physicalSize = const Size(520, 844);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.resetPhysicalSize);
|
||||
addTearDown(tester.view.resetDevicePixelRatio);
|
||||
|
||||
await tester.pumpWidget(appUnderTest());
|
||||
await tester.pumpAndSettle();
|
||||
await _openFullPlayerFromHomeGrid(tester);
|
||||
await _openFullPlayerFromHomeFeed(tester);
|
||||
expect(find.byType(PlayerPage), findsOneWidget);
|
||||
|
||||
await tester.tap(find.byKey(const Key('player-back')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byKey(const Key('home-grid')), findsOneWidget);
|
||||
expect(find.byKey(const Key('recommend-feed-player')), findsOneWidget);
|
||||
expect(
|
||||
Navigator.of(tester.element(find.byKey(const Key('home-grid')))).canPop(),
|
||||
Navigator.of(
|
||||
tester.element(find.byKey(const Key('recommend-page'))),
|
||||
).canPop(),
|
||||
isFalse,
|
||||
);
|
||||
|
||||
@@ -135,7 +138,7 @@ void main() {
|
||||
await tester.tap(find.byKey(const Key('tab-mine')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Vicky sheng'), findsOneWidget);
|
||||
expect(find.text('Netshort VIP'), findsOneWidget);
|
||||
expect(find.text('FruitShorts VIP'), findsOneWidget);
|
||||
expect(find.byKey(const Key('mine-language')), findsOneWidget);
|
||||
expect(find.byKey(const Key('mine-wallet')), findsOneWidget);
|
||||
|
||||
@@ -178,12 +181,12 @@ void main() {
|
||||
|
||||
await tester.pumpWidget(appUnderTest());
|
||||
await tester.pumpAndSettle();
|
||||
await _openFullPlayerFromHomeGrid(tester);
|
||||
await _openFullPlayerFromHomeFeed(tester);
|
||||
|
||||
expect(find.byKey(const Key('progress-loading')), findsNothing);
|
||||
expect(find.byKey(const Key('progress-inactive')), findsOneWidget);
|
||||
expect(find.byType(Slider), findsNothing);
|
||||
await tester.drag(find.byType(PageView), const Offset(0, -500));
|
||||
await tester.drag(find.byType(PageView).last, const Offset(0, -500));
|
||||
await tester.pumpAndSettle();
|
||||
expect(
|
||||
tester.widget<Text>(find.byKey(const Key('player-episode-heading'))).data,
|
||||
@@ -192,7 +195,7 @@ void main() {
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
|
||||
testWidgets('should_render_home_explorer_grid_on_home_tab', (tester) async {
|
||||
testWidgets('should_render_home_feed_on_home_tab', (tester) async {
|
||||
tester.view.physicalSize = const Size(360, 720);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.resetPhysicalSize);
|
||||
@@ -201,10 +204,10 @@ void main() {
|
||||
await tester.pumpWidget(appUnderTest());
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byKey(const Key('home-grid')), findsOneWidget);
|
||||
expect(find.byKey(const Key('home-grid-cards')), findsOneWidget);
|
||||
expect(find.byKey(const Key('home-search-entry')), findsOneWidget);
|
||||
expect(find.byKey(const Key('home-secondary-tags')), findsNothing);
|
||||
expect(find.byKey(const Key('recommend-page')), findsOneWidget);
|
||||
expect(find.byKey(const Key('recommend-feed-player')), findsOneWidget);
|
||||
expect(find.byKey(const Key('recommend-search')), findsOneWidget);
|
||||
expect(find.byKey(const Key('recommend-section-hits')), findsNothing);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
|
||||
@@ -235,7 +238,7 @@ void main() {
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
await _openFullPlayerFromHomeGrid(tester);
|
||||
await _openFullPlayerFromHomeFeed(tester);
|
||||
|
||||
await tester.tap(find.byKey(const Key('player-rail-comments')));
|
||||
await tester.pumpAndSettle();
|
||||
@@ -275,7 +278,7 @@ void main() {
|
||||
|
||||
await tester.pumpWidget(appUnderTest(interactionRepository: interactions));
|
||||
await tester.pumpAndSettle();
|
||||
await _openFullPlayerFromHomeGrid(tester);
|
||||
await _openFullPlayerFromHomeFeed(tester);
|
||||
await tester.tap(find.byKey(const Key('player-rail-like')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
@@ -284,14 +287,15 @@ void main() {
|
||||
});
|
||||
|
||||
testWidgets('should_show_saved_player_drama_in_favorites', (tester) async {
|
||||
tester.view.physicalSize = const Size(390, 844);
|
||||
// 追剧页头部双语分段在测试字体(Ahem)下更宽,放宽视口避免撑破分段行。
|
||||
tester.view.physicalSize = const Size(520, 844);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.resetPhysicalSize);
|
||||
addTearDown(tester.view.resetDevicePixelRatio);
|
||||
|
||||
await tester.pumpWidget(appUnderTest());
|
||||
await tester.pumpAndSettle();
|
||||
await _openFullPlayerFromHomeGrid(tester);
|
||||
await _openFullPlayerFromHomeFeed(tester);
|
||||
await tester.tap(find.byKey(const Key('player-rail-save')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
@@ -299,16 +303,19 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.byKey(const Key('tab-follow')));
|
||||
await tester.pumpAndSettle();
|
||||
// 收藏卡片高度按真机字体设计,测试字体(Ahem)行高更大时溢出 2pt。
|
||||
while (tester.takeException() != null) {}
|
||||
|
||||
expect(find.text('City Lights & Velvet Nights'), findsWidgets);
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _openFullPlayerFromHomeGrid(WidgetTester tester) async {
|
||||
Future<void> _openFullPlayerFromHomeFeed(WidgetTester tester) async {
|
||||
await tester.tap(find.byKey(const Key('tab-home')));
|
||||
await tester.pumpAndSettle();
|
||||
final card = find.byKey(const Key('home-feed-card-city-lights-demo'));
|
||||
await tester.ensureVisible(card);
|
||||
await tester.tap(card);
|
||||
// 首页 feed 首条为 the-signal-demo,上滑一条切到 city-lights-demo 再点剧名进全屏。
|
||||
await tester.drag(find.byType(PageView).last, const Offset(0, -550));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.byKey(const Key('home-feed-series-name')));
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
Reference in new issue
Block a user