From bc45c9f3c93f4f640328f72608d5f32170e5675e Mon Sep 17 00:00:00 2001 From: Jason Ross Date: Fri, 3 Jul 2026 20:59:36 -0500 Subject: [PATCH] fix(test): assert a robust node in MailboxScreenTest empty-state-gate test emptyState_isHidden_whileTheInboxPagerIsStillLoading asserted the compose FAB with assertIsDisplayed(), but MailboxScreen renders no loading affordance in this exact scenario (isSyncingFolder only flips true from selectFolder(), which this test never calls), so there is nothing else guaranteed visible while refresh == Loading. The FAB is unconditionally composed in Scaffold's floatingActionButton slot regardless of loading state, so its role here is only to prove the screen composed rather than crashing or rendering blank. Swap to assertExists(), which checks presence in the semantics tree without requiring on-screen visibility, and keep the core assertion (mailbox_empty assertDoesNotExist()) that verifies the actual issue #219 behavior. Co-Authored-By: Claude Opus 4.8 --- .../kotlin/org/libremail/ui/mailbox/MailboxScreenTest.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/androidTest/kotlin/org/libremail/ui/mailbox/MailboxScreenTest.kt b/app/src/androidTest/kotlin/org/libremail/ui/mailbox/MailboxScreenTest.kt index e68cfaf..ea0ed88 100644 --- a/app/src/androidTest/kotlin/org/libremail/ui/mailbox/MailboxScreenTest.kt +++ b/app/src/androidTest/kotlin/org/libremail/ui/mailbox/MailboxScreenTest.kt @@ -306,8 +306,13 @@ class MailboxScreenTest { ) setContent(FakeMailRepository(pagedOverride = loadingEmpty)) - // The screen has composed (its compose FAB shows), but the empty state stays gated off. - composeTestRule.onNodeWithText(string(R.string.action_compose)).assertIsDisplayed() + // The screen has composed (its compose FAB is present in the tree) rather than having crashed + // or rendered blank — that's the sanity check here, not the FAB's on-screen visibility. This + // scenario has no other loading affordance to point at instead: isSyncingFolder (the spinner + // gate below) only applies to a per-folder background sync started by selectFolder(), which + // this test never calls, so nothing else is guaranteed visible while refresh == Loading. + // assertExists() rather than assertIsDisplayed() for that reason — the FAB isn't under test here. + composeTestRule.onNodeWithText(string(R.string.action_compose)).assertExists() composeTestRule.onNodeWithText(string(R.string.mailbox_empty)).assertDoesNotExist() }