@@ -23,6 +23,7 @@ import 'package:lichess_mobile/src/model/settings/preferences_storage.dart';
2323import 'package:lichess_mobile/src/network/http.dart' ;
2424import 'package:lichess_mobile/src/network/socket.dart' ;
2525import 'package:lichess_mobile/src/styles/lichess_icons.dart' ;
26+ import 'package:lichess_mobile/src/view/chat/chat_screen.dart' ;
2627import 'package:lichess_mobile/src/view/game/game_screen.dart' ;
2728import 'package:lichess_mobile/src/view/game/game_screen_providers.dart' ;
2829import 'package:lichess_mobile/src/widgets/bottom_bar.dart' ;
@@ -963,6 +964,25 @@ void main() {
963964 () => mockSoundService.play (Sound .confirmation, volume: any (named: 'volume' )),
964965 ).called (1 );
965966 });
967+
968+ testWidgets ('chat messages do not disappear when game state changes' , (
969+ WidgetTester tester,
970+ ) async {
971+ await createTestGame (tester, pgn: 'e4 e5' );
972+ sendServerSocketMessages (testGameSocketUri, [
973+ '{"t":"message","d":{"u":"Steven","t":"Hello!"}}' ,
974+ ]);
975+ await tester.pump ();
976+
977+ // Play a move to update the GameController's state.
978+ // There used to be a bug where this would make chat messages disappear.
979+ await playMove (tester, 'g1' , 'f3' );
980+
981+ await tester.tap (find.byType (ChatBottomBarButton ));
982+ await tester.pumpAndSettle (); // wait for chat to open
983+
984+ expect (find.text ('Hello!' ), findsOneWidget);
985+ });
966986 });
967987
968988 group ('Disabled' , () {
0 commit comments