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.
How to use
Write the step so it begins withexpect toast or expect no toast, followed by
the message to look for (quoted is clearest):
Matching the message
- Quoted text —
Expect 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. LikewiseExpect no toastpasses when no toast of any kind appears.
Example use cases
- Success confirmation —
Expect toast "Changes saved"after tapping Save - Error feedback —
Expect toast "Invalid password"after a bad login - Negative checks —
Expect no toast "Error"to confirm a happy-path flow shows no error toast - Presence-only —
Expect toastto confirm some confirmation appeared without pinning the exact wording
