# E2E smoke — Maestro flow. SPEC: SHELL-01, SHELL-02, HOME-02.
#
# Proves the real app boots on a device/emulator and the bottom-nav shell works.
# Selectors go by testTag (surfaced as resource-ids on Android via TestTagAutomation),
# never by display text. Nav-item ids are nav_<label-slug> — the slug rule lives in
# AppShell.kt's navItemTag (lowercase, non-[a-z0-9] runs collapsed to "_", trimmed);
# keep these ids in sync with it if the configured tabs change.
#
# SETTLE RULE for the behaviour steps you add: any assertion that follows an interaction
# triggering an async state change (search input, a toggle that persists, a load) must use
# extendedWaitUntil — the ViewModel round-trip passes through a brief Loading arm, and a
# lane-loaded emulator stretches that window past a bare assert's patience (a real false
# red from the field). Bare assertVisible is for static post-navigation elements only.
#
# Run:  maestro test qa/e2e/smoke.yaml      (device/emulator attached)
# The verify lane's e2eSmoke step runs this automatically when maestro + a device are present.
appId: __PACKAGE__
---
- launchApp:
    clearState: true

# SPEC: SHELL-01 — the app boots and the first tab renders inside the shell, bottom nav visible.
# Cold-start after clearState can take longer than a bare assert's default window on a slow/CI
# emulator (first Compose frame under load). Waiting for the first frame IS the SHELL-01 boot
# proof, so wait explicitly with a generous budget rather than asserting immediately.
- extendedWaitUntil:
    visible:
      id: "home_title"
    timeout: 60000
- assertVisible:
    id: "app_bottom_nav"

# SPEC: HOME-02 — when loading completes, the items are listed: the first item's row
# is on screen (the exemplar's device journey; the lane's e2eCoverage gate asks every
# feature with a screen and a spec for at least one clause proven by a flow).
- extendedWaitUntil:
    visible:
      id: "home_item_1"
    timeout: 30000

# SPEC: SHELL-02 — switching tabs keeps the shell
- tapOn:
    id: "nav_profile"
- assertVisible:
    id: "profile_title"
- assertVisible:
    id: "app_bottom_nav"

# and back
- tapOn:
    id: "nav_home"
- assertVisible:
    id: "home_title"
