From b411908e65936296429a4e6b01ef9bfeecea7002 Mon Sep 17 00:00:00 2001 From: David Calhoun Date: Fri, 2 Oct 2026 10:10:58 -0400 Subject: [PATCH] test(android): let E2E node waits span activity switches waitForNode polled with fetchSemanticsNodes()'s default atLeastOneRootRequired, which throws when no Compose root is resumed. Tapping into the next activity opens that gap briefly, and waitUntil doesn't retry thrown errors, so "No compose hierarchies found" failed navigateToEditor intermittently on CI. Co-Authored-By: Claude Opus 5.5 --- .../java/com/example/gutenbergkit/EditorTestHelpers.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/android/app/src/androidTest/java/com/example/gutenbergkit/EditorTestHelpers.kt b/android/app/src/androidTest/java/com/example/gutenbergkit/EditorTestHelpers.kt index 30eea47fc..38e404b2a 100644 --- a/android/app/src/androidTest/java/com/example/gutenbergkit/EditorTestHelpers.kt +++ b/android/app/src/androidTest/java/com/example/gutenbergkit/EditorTestHelpers.kt @@ -384,8 +384,12 @@ private fun AndroidComposeTestRule<*, *>.waitForNode( // Poll on the match count rather than `assertExists`, so an ambiguous // match fails as soon as it appears instead of burning the full timeout // on an assertion that can never pass. + // Between activities no Compose root is resumed, and the default + // `atLeastOneRootRequired` throws there instead of letting the poll retry. waitUntil(timeoutMs) { - onAllNodes(matcher).fetchSemanticsNodes().isNotEmpty() + onAllNodes(matcher) + .fetchSemanticsNodes(atLeastOneRootRequired = false) + .isNotEmpty() } val matches = onAllNodes(matcher).fetchSemanticsNodes() check(matches.size == 1) {