feat(interaction): 支持游客点赞收藏评论

This commit is contained in:
Zhou Weidong committed 2026-10-26 22:33:14 +08:00
1 parent 188811fde6
commit a3d50eb935
18 files changed
+364 -121

No files matched your search

+54 -15
View File
@@ -596,9 +596,7 @@ void main() {
expect(find.byType(Slider), findsOneWidget);
});
testWidgets('should_pause_feed_when_auth_page_is_pushed_and_resume_on_pop', (
tester,
) async {
testWidgets('should_keep_feed_playing_when_guest_saves', (tester) async {
final players = <_RecordingPlayer>[];
await _pumpApp(
tester,
@@ -615,18 +613,23 @@ void main() {
await tester.tap(find.byKey(const Key('rail-save')));
await tester.pumpAndSettle();
await tester.tap(find.text('Sign In'));
await tester.pumpAndSettle();
expect(find.byType(AuthPage), findsOneWidget);
expect(player.playing, isFalse);
await tester.pageBack();
await tester.pumpAndSettle();
expect(find.byType(AuthPage), findsNothing);
expect(player.playing, isTrue);
});
testWidgets('should_like_without_login_from_recommend_feed', (tester) async {
final interactions = FakeInteractionRepository();
await _pumpApp(tester, interactions: interactions);
await tester.tap(find.byKey(const Key('tab-recommend')));
await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('rail-like')));
await tester.pumpAndSettle();
expect(find.byType(AuthPage), findsNothing);
expect(interactions.likeTargets, ['EPISODE:the-signal-demo-1']);
});
testWidgets('should_keep_video_surface_background_black', (tester) async {
await _pumpApp(tester);
await _openSeriesPlayer(tester);
@@ -643,7 +646,7 @@ void main() {
expect(find.byKey(const Key('player-fallback-scrim')), findsNothing);
});
testWidgets('should_gate_comments_before_opening_sheet_when_signed_out', (
testWidgets('should_open_comments_without_login', (
tester,
) async {
await _pumpApp(tester);
@@ -652,8 +655,8 @@ void main() {
await tester.tap(find.byKey(const Key('player-rail-comments')));
await tester.pumpAndSettle();
expect(find.text('Sign in to continue'), findsOneWidget);
expect(find.byKey(const Key('player-comments-sheet')), findsNothing);
expect(find.byKey(const Key('player-comments-sheet')), findsOneWidget);
expect(find.byType(AuthPage), findsNothing);
});
testWidgets('should_open_feed_comments_when_signed_in', (tester) async {
@@ -1872,6 +1875,12 @@ void main() {
testWidgets('should_open_unlock_panel_with_honest_method_states', (
tester,
) async {
SharedPreferencesAsyncPlatform.instance =
InMemorySharedPreferencesAsync.withData({
'auth.accessToken': 'access',
'auth.refreshToken': 'refresh',
'auth.user': '{"uid":"9","nickname":"Viewer","avatarUrl":""}',
});
final interactions = FakeInteractionRepository();
await _pumpApp(
tester,
@@ -1905,6 +1914,36 @@ void main() {
find.text('Available unlock methods vary by title.'),
findsOneWidget,
);
});
testWidgets('should_require_login_before_opening_unlock_flow', (
tester,
) async {
await _pumpApp(
tester,
playback: FakePlaybackRepository(
ticket: const PlayTicket(
episodeId: 'city-lights-demo-1',
accessible: false,
accessType: PlayTicket.coinRequired,
unlockCoin: 30,
),
),
);
await _openSeriesPlayer(tester);
await tester.tap(find.byKey(const Key('player-open-unlock')));
await tester.pump();
await tester.pump(const Duration(milliseconds: 300));
expect(find.byKey(const Key('player-unlock-panel')), findsNothing);
final signIn = find.widgetWithText(FilledButton, 'Sign In');
await tester.ensureVisible(signIn);
await tester.tap(signIn);
await tester.pump();
await tester.pump(const Duration(milliseconds: 300));
expect(find.byType(AuthPage), findsOneWidget);
});
}