From 4623c99cea86ebefbf365486a5ea6cd402fe6f46 Mon Sep 17 00:00:00 2001 From: Rasyid Ridho Date: Fri, 18 Oct 2024 16:07:58 +0700 Subject: [PATCH] android waitToSettleTimeoutMs not wait for settle for faster commands --- maestro-client/src/main/java/maestro/Maestro.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/maestro-client/src/main/java/maestro/Maestro.kt b/maestro-client/src/main/java/maestro/Maestro.kt index 16a8fec3b3..f01f28f08e 100644 --- a/maestro-client/src/main/java/maestro/Maestro.kt +++ b/maestro-client/src/main/java/maestro/Maestro.kt @@ -184,7 +184,7 @@ class Maestro( ) { LOGGER.info("Tapping on element: ${tapRepeat ?: ""} $element") - val hierarchyBeforeTap = waitForAppToSettle(initialHierarchy, appId, waitToSettleTimeoutMs) ?: initialHierarchy + val hierarchyBeforeTap = initialHierarchy val center = ( hierarchyBeforeTap @@ -353,6 +353,12 @@ class Maestro( } else { driver.tap(Point(x, y)) } + + if (waitToSettleTimeoutMs != null && waitToSettleTimeoutMs < 150) { + LOGGER.info("waitToSettleTimeoutMs is less than 150, skip get hierarchy") + return + } + val hierarchyAfterTap = waitForAppToSettle(waitToSettleTimeoutMs = waitToSettleTimeoutMs) if (hierarchyBeforeTap != hierarchyAfterTap) {