> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.

# subflows/tutorial-free-songs.yaml

[Source](https://github.com/leapgame/leap-sim-piano/blob/f794b594016038c483e2d20b6af56aea0ae1b982/.maestro/subflows/tutorial-free-songs.yaml)

```yaml
appId: ${APP_ID}
---
# The tutorial's free songs, from a clean install: intro -> welcome -> the choose screen -> the guided first
# song -> its result -> the video paywall (a free player: closed) -> then, by `tutorial.free_songs`:
#   ${EXPECT_PICK}  "1" (2 free songs, `pick_after_play`): the reward picker offers one more song, the
#                   flow takes the first; anything else (3 free songs, `grant_all`): no picker, the song list
# Each value is checked against the arm's real config (src/data/__tests__/e2e-monetization-flows.test.ts).
#
# Needs the area's console `tutorial_song` (tutorial/app.env): three mock songs on a bundled excerpt, so
# the run OFFERS three. Without it every slot is the Twinkle stand-in, one card, and every arm ends
# "single" (no picker). Needs the e2e IAP backend too (set-variant-env.sh): a free player meets the
# video paywall, a premium one does not.
- runFlow: first-run-intro.yaml
- runFlow: first-run-tutorial.yaml
# The video paywall opens over the song's result (the picker's score-only result, on 2 free songs), as
# the result settles; it is the only paywall of the first run. Close it.
- extendedWaitUntil:
    visible:
      id: "paywall-close"
    timeout: 90000
- assertVisible:
    id: "paywall-screen-intro"
- tapOn:
    id: "paywall-close"
# What is under it depends on the run's reward plan (TutorialSongResultScreen):
#   2 free songs (`pick_after_play`): the result is the score only, then REPLACED by the reward picker
#     (`tutorial-reward-cta-<song>`, the two songs not played) — take the first;
#   3 free songs (`grant_all`): the full Game Mode result with its buttons ("Open songs list", "Next
#     song") and no picker, however long it stays — leave by "Open songs list".
- runFlow:
    when:
      true: ${EXPECT_PICK == '1'}
    commands:
      - extendedWaitUntil:
          visible:
            id: "tutorial-reward-cta-.*"
          timeout: 90000
      - tapOn:
          id: "tutorial-reward-cta-.*"
          index: 0
- runFlow:
    when:
      true: ${EXPECT_PICK != '1'}
    commands:
      - extendedWaitUntil:
          visible:
            id: "session-action-songs"
          timeout: 90000
      # The picker would replace the score after its hold: wait past it, then say it never came.
      - runFlow:
          file: sleep.yaml
          env:
            MS: "10000"
      - assertNotVisible:
          id: "tutorial-reward-cta-.*"
      - assertVisible:
          id: "session-action-songs"
      - tapOn:
          id: "session-action-songs"
# Either way the tutorial is over: reach the song list (a picked song may open its gameplay first).
- runFlow: leave-to-song-list.yaml
```
