Skip to main content

Overview

A toast is a small, transient message that appears briefly and then disappears on its own (an Android Toast, a snackbar, or a short banner). Because toasts vanish quickly, they’re hard to catch with a normal verification step — so Spur provides two dedicated assertions:
  • Expect Toast — the step passes if the expected toast appears, and fails if it does not.
  • Expect No Toast — the step passes if the toast does not appear, and fails if it does.
These are pure assertions: the step itself performs no tap or type. Spur watches the moments right after the previous step (the action that would trigger the toast), samples several frames across that window, and checks them for the toast.

How to use

Write the step so it begins with expect toast or expect no toast, followed by the message to look for (quoted is clearest):
Tap the "Save" button
Expect toast "Changes saved"
Submit the form with an invalid email
Expect no toast "Profile updated"
The triggering action should be the step immediately before the expect-toast step — that’s the window Spur inspects for the toast.

Matching the message

  • Quoted textExpect toast "Added to cart" matches a toast containing that message.
  • Any toast — omit the message (e.g. Expect toast) to pass when any toast appears, regardless of its text. Likewise Expect no toast passes when no toast of any kind appears.

Example use cases

  • Success confirmationExpect toast "Changes saved" after tapping Save
  • Error feedbackExpect toast "Invalid password" after a bad login
  • Negative checksExpect no toast "Error" to confirm a happy-path flow shows no error toast
  • Presence-onlyExpect toast to confirm some confirmation appeared without pinning the exact wording
Keep the expected text short and stable — match a distinctive phrase rather than the full sentence, so minor copy changes don’t break the assertion.

Platform support

Works on both iOS and Android.