Skip to content

Commit

Permalink
added logs to scroll until visible (#2280)
Browse files Browse the repository at this point in the history
* added logs to scroll until visible

* fix: logs
  • Loading branch information
proksh authored Feb 2, 2025
1 parent d702a0c commit 09ce57f
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,12 @@ class Orchestra(
val element = findElement(command.selector, command.optional, 500).element
val visibility = element.getVisiblePercentage(deviceInfo.widthGrid, deviceInfo.heightGrid)

logger.info("Scrolling try count: $retryCenterCount, DeviceWidth: ${deviceInfo.widthGrid}, DeviceWidth: ${deviceInfo.heightGrid}")
logger.info("Element bounds: ${element.bounds}")
logger.info("Visibility Percent: $retryCenterCount")
logger.info("Command centerElement: $command.centerElement")
logger.info("visibilityPercentageNormalized: ${command.visibilityPercentageNormalized}")

if (command.centerElement && visibility > 0.1 && retryCenterCount <= maxRetryCenterCount) {
if (element.isElementNearScreenCenter(direction, deviceInfo.widthGrid, deviceInfo.heightGrid)) {
return true
Expand All @@ -526,6 +532,7 @@ class Orchestra(
return true
}
} catch (ignored: MaestroException.ElementNotFound) {
logger.error("Error: $ignored")
}
maestro.swipeFromCenter(direction, durationMs = command.scrollDuration.toLong(), waitToSettleTimeoutMs = command.waitToSettleTimeoutMs)
} while (System.currentTimeMillis() < endTime)
Expand Down

0 comments on commit 09ce57f

Please sign in to comment.