@@ -431,6 +431,35 @@ def test_reaction_seen_on_another_dev(acfactory) -> None:
431431 assert chat_id == alice2_chat_bob .id
432432
433433
434+ def test_2nd_device_events_when_msgs_are_seen (acfactory ) -> None :
435+ alice , bob = acfactory .get_online_accounts (2 )
436+ alice2 = alice .clone ()
437+ alice2 .start_io ()
438+
439+ # Get an accepted chat, otherwise alice2 won't be notified about the 2nd message.
440+ chat_alice2 = alice2 .create_chat (bob )
441+ chat_id_alice2 = chat_alice2 .get_basic_snapshot ().id
442+
443+ chat_bob_alice = bob .create_chat (alice )
444+ chat_bob_alice .send_text ("Hello!" )
445+ msg_alice = alice .wait_for_incoming_msg ()
446+ assert alice2 .wait_for_incoming_msg_event ().chat_id == chat_id_alice2
447+ chat_bob_alice .send_text ("What's new?" )
448+ assert alice2 .wait_for_incoming_msg_event ().chat_id == chat_id_alice2
449+ chat_alice2 = alice2 .get_chat_by_id (chat_id_alice2 )
450+ assert chat_alice2 .get_fresh_message_count () == 2
451+
452+ msg_alice .mark_seen ()
453+ assert alice2 .wait_for_msgs_changed_event ().chat_id == chat_id_alice2
454+ assert chat_alice2 .get_fresh_message_count () == 1
455+
456+ msg_id = alice .wait_for_msgs_changed_event ().msg_id
457+ msg = alice .get_message_by_id (msg_id )
458+ msg .mark_seen ()
459+ assert alice2 .wait_for_event (EventType .MSGS_NOTICED ).chat_id == chat_id_alice2
460+ assert chat_alice2 .get_fresh_message_count () == 0
461+
462+
434463def test_is_bot (acfactory ) -> None :
435464 """Test that we can recognize messages submitted by bots."""
436465 alice , bob = acfactory .get_online_accounts (2 )
0 commit comments