Skip to content

assertEvents ​

Assert that the app sent analytics events (Astra Scout only).

Astra Scout only

assertEvents is not a Maestro command. A flow that uses it does not run on plain Maestro. Astra Scout takes the events from the Amplitude capture, see Tracking.

The assertEvents command checks that the app sent the analytics events you list. It waits for events that have not arrived yet, up to timeout.

Use it right after an action in your flow to confirm the action sent the right event, for example tapping Continue sends Onboarding Step Viewed.

Which events count ​

Each assertEvents looks only at events sent in a recent stretch of time (called the window). The window opens 500 ms before the last action that acted on the app.

  • Actions that act on the app: a tap, text input, swipe, launchApp, and so on.
  • Commands that only observe or wait do not move the window: assertVisible, assertTrue, extendedWaitUntil, takeScreenshot, evalScript, other assertEvents, and the like.
  • A runFlow, repeat or retry block whose commands acted on the app counts as one action that started when the block started. An assertEvents right after it checks every event the block sent. For example: check the app's first events after a loop that answers permission prompts, whatever order the prompts appear in.
  • A block that did nothing (for example a when that did not match) leaves the window where it was.
  • No action yet: the window opens at the start of the flow.

So in tapOn, assertVisible, assertEvents, the last step checks the events of the tap.

The wait lasts timeout milliseconds counted from the assertEvents itself, not from the command before it.

One caveat: if the previous action sent an event less than 500 ms before the next action started, that event can be counted for the next action.

The device clock can differ from the Mac's clock, and analytics SDKs often send events in batches that arrive late. Astra Scout corrects for the clock difference, so neither problem moves an event in or out of the window.

How events match ​

Write the event name as the catalog has it (its Display name).

Each listed event must match exactly one event the app sent: the first one, in time order, with that name and the properties you describe.

  • An event that one assertEvents matched is not matched again by a later one in the same run.
  • The order of the events inside one step does not matter.
  • SDK internal events such as $identify are ignored.

If an event is missing, the step fails and says which one is missing, and which events did arrive. If an event arrived with the wrong property, the message gives the property and the value received. A failed assertEvents does not stop the flow: the next commands still run, but the run ends failed.

Syntax ​

yaml
- assertEvents: [Onboarding Step Viewed]
- assertEvents:
    - License Selected:
        license type: car
- assertEvents:
    timeout: 8000
    events:
      - Paywall Viewed: { placement: onboarding }

Parameters ​

ParameterTypeDescription
eventsListThe events to expect. Each is an event name, or a name with a map of properties.
timeoutIntegerThe maximum time to wait for the events, in milliseconds. Defaults to 5000.

A property value is either a plain value, which must equal the value received, or a map of conditions. A date written as a plain value (date: 2026-10-19) is compared as the text written, quoted or not.

ConditionDescription
equalsThe value must equal this.
inThe value must be one of this list.
minThe value must be a number at least this.
maxThe value must be a number at most this.
regexThe value must be a string that matches this regex (a pattern that describes text, for example ^onb means text that starts with onb).
typestring, boolean, integer or number.

Usage examples ​

yaml
- tapOn: "Continue"
- assertEvents:
    - Onboarding Step Viewed:
        step: { in: [1, 2] }
        source: { regex: "^onb" }