Skip to content

scrollUntilVisible gives up when the screen stops moving, where Maestro scrolls until its timeout #282

Closed

Description

Since af473dd (1.1.28), scrollUntilVisible stops once the screen stops moving and fails with "made no progress after N scrolls (end of content?)". I see why: a target that is not in the list should not cost the whole timeout, and the ScrollProgress comment says Maestro loops to its timeout here and the runner chooses not to. It bites flows written for Maestro in one case, and since it would change a behaviour you chose, I'd like to agree on the shape first.

What happens

A list that fills late looks exactly like a list at its end to the drivers that compare the page source (uiautomator2, devicelab, appium, the legacy devicelab iOS driver): while its rows load the source holds an empty list, or a spinner whose node does not change, so three captures in a row are the same and the step gives up after two or three scrolls, well inside a timeout the flow set for that wait. On wda, which compares settled screenshots, a turning spinner keeps the screen moving, but an empty page reads as stuck there too. Maestro's scrollUntilVisible swipes until its timeout whatever the screen does (Orchestra.scrollUntilVisible: a do … while (now < endTime) with a swipeFromCenter every round and no progress check), then fails with "No visible element found: …". So the same flow passes on Maestro when the rows come in time.

On uiautomator2, devicelab and appium there is a second early exit: a step with no maxScrolls stops at 20 scrolls, which can come before a timeout the flow set, depending on how long a round takes. The iOS drivers already take the timeout as the budget ("the timeout is the budget; a scroll count caps it only when the flow sets one", 6ef5fc7 and c9fc359).

Minimal repro: a screen whose list loads its rows some seconds after it opens.

appId: com.example
---
- launchApp
- tapOn: "Open list"          # the list fetches its rows and stays empty meanwhile
- scrollUntilVisible:
    element:
      id: "row_42"
    timeout: 30000

Measured on an Android emulator (API 36, Chrome 134, a page whose list stays empty, with no spinner, until 10 s after the step's first swipe; the times are the step's duration as each tool reports it): with timeout: 30000, main (deddc58) failed 3 of 3 after 2 scrolls (4.9-5.0 s, "Element not found: scrolling down made no progress after 2 scrolls (end of content?)"), Maestro 2.12.1 passed 3 of 3 (19.2-19.7 s, 11 swipes), and the change below passed 3 of 3 (13.9-14.7 s, 9 swipes). Without a timeout: (3 runs each), main stopped with that same message 3 of 3 (after 2 scrolls, 4.8-5.0 s) and so did the change (after 2 scrolls twice, 4.9-5.1 s, and once after 4, 8.7 s), and Maestro passed within its 20 s default (17.5 s, 1 run). For a row that never comes (timeout: 10000, 1 run each), main stopped at 5.1 s, Maestro failed at 10.9 s with No visible element found: "Row 38", and the change failed at 11.1 s with "No visible element found: Row 38 (scrolling down until the 10000ms timeout)". With the rows there from the start, main scrolled five swipes down to its row 3 of 3, so on this page its early stop comes from the empty list.

Proposal

Keep the early stop for a step without a timeout:, and let a step that sets one look until it passes, as Maestro does:

  1. With its own timeout:, a step whose element was not found keeps scrolling after the screen stops moving, and fails only when the timeout passes, with Maestro's "No visible element found: ". The end-of-content answers for an element already found (on screen but not yet centred, or partly past its container) stay as they are, and so does devicelab iOS's answer to a permission prompt over a list that looks stuck.
  2. With its own timeout: and no maxScrolls, the default 20 scrolls does not apply on uiautomator2, devicelab and appium, as on the iOS drivers.

A step without a timeout behaves as today: the early stop, 20 scrolls on Android and Appium, and the same messages. Read as a rule, an explicit timeout is the budget: a target missing from a list still costs only the scrolls to its end unless the flow asked to wait. The browser driver is not part of this.

It does change what your no-progress tests assert: they give their step a 60 s timeout (the legacy devicelab iOS one 20 s) and expect the stop, so with this rule they would run to that timeout. We would move them to no timeout, which still checks the stop.

Other shapes, if you prefer one: a step option (for example stopAtEndOfContent: false) with today's default kept; or Maestro's behaviour for every step, with the early stop as an opt-in. The decision sits in one predicate next to ScrollProgress, so any of them is a small change.

The first shape is ready as a PR (the stop, then the cap, in each driver with tests that fail without it), which I am opening next to this issue so the change can be read; happy to reshape it to what you pick, or to close it if you prefer another shape.

Activity

  1. omnarayan commented on Nov 18, 2026

    @omnarayan
    Contributor

    Thanks, Luka. The numbers make the case, and your first shape is the one we want. A step's own timeout: is its budget: it keeps looking until the timeout passes, as Maestro does, and the 20-scroll cap doesn't cut it short. A step without one keeps the early stop, so a missing element still fails fast.

    One addition, which we'll do ourselves after #283 is in. Without a timeout:, your late list still fails here at about 5 s while Maestro passes at 17.5 s, because "stuck" means three identical reads, and a list that's still loading gives those in a couple of seconds. So the early stop will also need the screen to have been still for about 5 s. A real end of list still fails in seconds, and a list that fills a little late gets found. It fits in ScrollProgress without touching the drivers.

    I've left a review on #283. The behaviour checks out on every driver; the one request there is about test time.

  2. luka-vladika-happening-xyz commented on Nov 18, 2026

    @luka-vladika-happening-xyz
    ContributorAuthor

    Thanks, sounds good. One data point for it: on the page behind the issue the list comes in about 10 s after the first swipe, with nothing on screen changing before it (no spinner, no placeholder rows).

    Happy to run the same three cases on the emulator (a list that fills late with and without timeout:, and a row that never comes) against your change once it's up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions