Skip to content

test(e2e): stabilise waitForAnimationToEnd by animating the demo app on every frame - #3760

Open
Fishbowler wants to merge 2 commits into
mainfrom
demo-app-animation-every-frame
Open

Fishbowler wants to merge 2 commits into
mainfrom
demo-app-animation-every-frame

Conversation

@Fishbowler

Copy link
Copy Markdown
Contributor

Why

The waitForAnimationToEnd e2e flow fails intermittently on Android, ending the wait while the demo app's animation is still running. Run on its own on a local emulator, it passed 1 in 8 on API 33 and 2 in 8 on API 34, and it failed on every level from 34 to 37 in full-suite runs. CI on API 32 hasn't shown it, but only because its slower emulator hides the race; it stands in the way of moving CI to a newer Android version.

Approach

waitForAnimationToEnd takes two screenshots back to back and treats the screen as settled when they match. The Animation Test screen's countdown and globes change only every 100–125ms, so on a fast emulator both screenshots often land between changes.

The globes and the milliseconds counter are replaced by a block that slides across a track on every frame while the animation runs. Its position comes from the animation controller's time-based value, so a dropped frame still moves it. It is hidden when idle, so the flow's no-animation check still sees a static screen, and it is excluded from semantics, so the view hierarchy is unchanged. The countdown stays, because extendedWaitUntil.yaml waits for it to reach 0.0s. Maestro itself is unchanged.

Verification

On arm64 emulators configured like CI's (4 cores, 4192 MB, swiftshader, 606×1280), with a fresh demo app build, commands/waitForAnimationToEnd.yaml run alone 10 times on each level:

API Before After
33 1/8 10/10
34 2/8 10/10
36 — 10/10

commands/extendedWaitUntil.yaml, which uses the same screen, passed on each. After removing the globes and counter, both flows were rerun on API 34: 10/10 and a pass. Not run on iOS.

Fishbowler and others added 2 commits November 18, 2026 14:00
waitForAnimationToEnd takes two screenshots back to back and treats the
screen as settled when they match. The Animation Test screen's countdown
and globes change only every 100-125ms, so on a fast emulator both
screenshots often land between changes and the wait returns while the
animation is still running. Run alone, the flow passed 1 in 8 on API 33
and 2 in 8 on API 34.

Add a block that slides across a track on every frame while the
animation runs, positioned from the controller's time-based value so a
dropped frame still moves it. It is hidden when idle, so the no-animation
case stays static, and excluded from semantics, so the view hierarchy is
unchanged.

Run alone 10 times each, the flow now passes 10/10 on API 33, 34 and 36,
as does extendedWaitUntil, which uses the same screen.
The sliding block now makes waitForAnimationToEnd reliable on its own.
The moon-phase globes and the milliseconds counter only existed to make
the screen change, did so too slowly to help, and no flow refers to
them. The countdown stays: extendedWaitUntil waits for "0.0s".

Run alone 10 times on API 34, waitForAnimationToEnd passes 10/10, as
does extendedWaitUntil.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant