[pim/akonadi-e2e-tests] tests/imap: Align test_offline_removed_message* and test_offline_append_message

Kevin Ottens <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 0771f7c2f8634550c5d209a58f83813b996d24b3 by Kevin Ottens.
Committed on 17/07/2026 at 10:09.
Pushed by ervin into branch 'master'.

Align test_offline_removed_message* and test_offline_append_message

Their implementations diverged a bit but it's clearer if they follow
similar patterns. Also there were missing opportunities to wait on the
server applying the changes making them flakier.

Also, the "only syncCollectionTree" assumption doesn't always hold so
don't check it, it doesn't quite matter anyway.

M  +4    -4    tests/imap/test_server_to_resource_imap.py

https://invent.kde.org/pim/akonadi-e2e-tests/-/commit/0771f7c2f8634550c5d209a58f83813b996d24b3

diff --git a/tests/imap/test_server_to_resource_imap.py b/tests/imap/test_server_to_resource_imap.py
index dec6842..2b0eec5 100644
--- a/tests/imap/test_server_to_resource_imap.py
+++ b/tests/imap/test_server_to_resource_imap.py
@@ -402,11 +402,11 @@ def test_offline_removed_message_server_side(
     imap_resource.synchronize()
     assert_collection_equal_mailbox(folder.name, imap_resource, imap_client)
 
-    imap_client.folder.set(folder.name)
     imap_resource.set_online(False)
 
-    imap_resource.list_items(folder.name)
+    imap_client.folder.set(folder.name)
     imap_client.delete(["1"])
+    wait_until(lambda: len(list(imap_client.fetch(mark_seen=False))) == len(folder.messages) - 1)
 
     # Make sure this resource isn't updated when offline
     assert len(imap_resource.list_items(folder.name)) == len(folder.messages)
@@ -429,13 +429,13 @@ def test_offline_append_message(imap_resource: ImapResource, imap_client: BaseMa
 
     imap_resource.set_online(False)
 
+    imap_client.folder.set(folder.name)
     ImapEmailFactory.create(folder=folder.name)
+    wait_until(lambda: len(list(imap_client.fetch(mark_seen=False))) == len(folder.messages) + 1)
     # Make sure this resource isn't updated when offline
     assert len(imap_resource.list_items(folder.name)) == len(folder.messages)
 
     imap_resource.set_online(True)
-    # Only syncCollectionTree happened
-    assert len(imap_resource.list_items(folder.name)) == len(folder.messages)
     imap_resource.sync_collection(folder.name)
     wait_until(lambda: len(imap_resource.list_items(folder.name)) == len(folder.messages) + 1)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.