Skip to content
All articles

Insights~6 min read

Tests Failing on Spinners and Animations? Fix the Cause

Automated UI tests that fail on loading spinners and animations while the app is fine usually share one cause: fixed waits. Here is why, and what to try.

TL;DR

Tests that fail on spinners and animations while the app is fine usually share one cause: the script guesses how long the app takes, and the guess goes stale. Fixed waits encode a timing assumption, not a state. A sturdier approach checks what is on screen and proves each outcome. TaloTrace is a QA testing tool for web, iOS and Android apps that takes this approach.

Key takeaways

  • Root cause: A fixed wait encodes a guess about duration, so it breaks when the environment is slower than the guess.

  • Hidden cost: Hand-tuned waits grow with the number of screens and transitions, not with the number of tests.

  • Triage first: Check the recording and the failure point before blaming the app or the test.

  • Better signal: Waiting on an observable state beats waiting on a clock, but every state check still has to be written and kept up.

  • Different approach: TaloTrace navigates by looking at the screen and marks a goal done only when a machine-checkable predicate proves the outcome.

What Does the Failure Look Like Week to Week?

A test passes on your machine on Monday. On Tuesday it fails in CI on a login screen, then passes on the retry. On Wednesday a different test fails on a screen that has not changed in months.

You open the app by hand and everything works. The failure message usually says one of three things:

  • An element was not found.
  • A tap landed on the wrong thing.
  • An assertion saw the previous screen.

Nobody can reproduce it on demand, so the ticket gets a "flaky" label and a rerun.

Over a few weeks the pattern gets familiar:

  • Failures cluster around screens with a spinner, a skeleton loader, a slide-in transition or a modal fade.
  • Reruns often pass, which teaches the team to distrust red builds.
  • Someone adds a longer sleep, the failure moves to another screen, and the suite gets slower.

The cost is not only wasted reruns. It is the point at which a real regression gets dismissed as "probably that flaky test again".

Why Do Fixed Waits Break on Spinners and Animations?

A fixed wait says "the screen will be ready in two seconds". That is a claim about time, but what the test needs is a claim about state. The two only line up while the environment behaves the way it did when you picked the number.

Several mechanisms produce the same symptom:

  • Slower hosts. A shared CI machine or an emulator under load takes longer to render, so the spinner is still on screen when the wait ends.
  • Variable data. A spinner lasts as long as the request behind it. A fast response and a slow one are both normal.
  • Elements in motion. During a transition an element can exist and be queryable while it is still moving. A tap at its final coordinates lands on empty space or on its neighbour.
  • Overlays that swallow input. A loading layer can sit above the control you want, so the tap goes to the layer.
  • Stale reads. An assertion can run while the old screen is still fading out, and it passes or fails against the wrong view.

None of these are bugs in your app. They are properties of asynchronous interfaces, which is why the Playwright documentation on actionability lists checks for elements that are still animating or hidden behind an overlay, and a script that does not model them will trip over them.

Why Does Hand-Tuning Waits Keep Growing?

Waits are attached to screens and transitions, not to tests. Add one new screen with a loader and every test that passes through it inherits the timing question. Redesign an animation and the tuned values are wrong again.

That is why the effort feels disproportionate. The number of tests may stay flat while the surface the scripts touch keeps expanding, and each stretch of that surface needs its own guess. The same logic applies to element selectors: they encode structure that is not guaranteed to stay stable.

There is also a quiet second cost. Every added second of sleep is paid on every run, so a suite padded against the slowest case is slow in the typical case too.

What Do Teams Usually Try, and Where Does It Run Out?

Teams often work through a similar ladder. Each step helps, and each has a ceiling.

  1. Longer sleeps. Cheap and quick. It lowers the failure rate while making runs slower, and it keeps the underlying guess.
  2. Retries. A rerun hides the timing failure. It also hides a genuine intermittent bug, which is the more expensive thing to miss.
  3. Explicit waits on a condition. Wait until the spinner is gone or the element is visible. This is the right idea, because it waits on state. But someone has to choose and write the condition for every screen, and keep it correct as the UI changes.
  4. Disabling animations in test builds. It removes a class of failures. It also means you are no longer testing the app the user sees, and it does nothing for loading states driven by real requests.
  5. Doing nothing. Accept the noise and review failures by hand. This works until the team stops looking.

The honest summary is that explicit conditions are the best of the scripted options, and they move the work rather than remove it. You still author and maintain a readiness check per screen.

How Can You Tell a Timing Failure From a Real Bug?

Before changing any wait, find out what the screen looked like at the moment of failure. A short checklist saves a lot of guessing:

  • Does a video or screenshot show a spinner, overlay or transition still in progress at the failing step?
  • Does the failure move around between runs, or does it hit the same step every time?
  • Does a slower environment make it more likely?
  • If the spinner never clears on screen, is the request behind it actually failing? That one is a real bug.

The last point matters. A spinner that hangs forever is a defect worth reporting, and a wait-and-retry loop will bury it. Separating "too early" from "genuinely stuck" is the whole job, and it needs evidence you can look at.

What Does a Different Approach Look Like?

The shift is from encoding time to observing state. Instead of a script that says "wait two seconds, then tap the third element", TaloTrace looks at the screen, works out what is there, and pursues a goal until the outcome is confirmed.

That is the premise behind goal-based testing. You describe the flow you care about, optionally in plain language such as "complete a checkout", and TaloTrace explores the running app and plans the journeys worth testing. The ones it completes become replayable scenarios. There are no test scripts to write or maintain. You can read more on the how it works page.

What Makes TaloTrace Different for Timing-Sensitive Flows?

TaloTrace is a QA testing tool for web, iOS and Android apps, and it has no test scripts to write or maintain, which is the scripted part of this problem. It does not make slow networks fast, and it does not promise that a changing UI never needs attention. These are the live mechanisms that bear on spinners and animations:

  • It navigates by looking at the screen. TaloTrace does not depend on brittle element IDs, so it keeps working when the UI changes. Its interactions cover taps, typing, scrolling, swiping, long-press, double-tap, drag and pinch.
  • Completion is proven, not assumed. A goal is marked done only when a machine-checkable predicate proves the outcome. The predicate must be false before the action and true after, so a screen that merely looks right cannot falsely complete a goal.
  • Findings are independently checked. TaloTrace separates finding a bug from reporting it, and independently verifies each finding before it reaches you.
  • Evidence is attached. A screen recording is captured for every run, and each finding carries the time window in that recording where the defect shows. That evidence helps you tell a stuck spinner from an early assertion.

It runs on a browser, an Android emulator or an Apple iOS Simulator, all cloud-hosted and virtual, chosen automatically from your app's platform. If you work on Android specifically, our post on AI QA testing for Android apps goes deeper, and the autonomous mobile app testing tool post covers the wider picture.

How Do You Get Started?

Point TaloTrace at your app, optionally describe the flow that hurts most, and see what it makes of your spinners and transitions. Access is by application during the open beta, and you can ask for a demo at the same time.

Start with the screens where your waits have grown the most.

Get early access or book a demo

Frequently asked questions

Why do my tests pass locally but fail in CI on spinners?

A fixed wait is a guess tuned on one machine. A slower environment takes longer to finish loading or animating, so the test acts before the screen is ready. The app is fine; the assumption about timing is not.

Is increasing the timeout a good fix?

It is a reasonable short-term patch, but it trades flakiness for slower runs. It also keeps the underlying assumption, so the next slower environment or heavier screen can break it again.

Does TaloTrace remove timing problems entirely?

No. TaloTrace navigates by looking at the screen rather than element IDs, and it marks a goal done only when a predicate proves the outcome. That means no test scripts to write or maintain. It does not mean a slow or broken app stops mattering.

Which platforms does TaloTrace test?

TaloTrace runs on three cloud-hosted virtual execution planes: a browser for web apps, an Android emulator for Android apps, and an Apple iOS Simulator for iOS apps. Physical devices are not offered.

You build. TaloTrace tests.

Public testing is coming soon. You can request early access in the meantime.

Book a demo
Request early access