For AI agents: the complete documentation index is available at ../../../llms.txt, the full documentation bundle is available at ../../../llms-full.txt, and this page is available as Markdown at ../../../quality/scripts/subflows/noads-popup.md.

subflows/noads-popup.yaml

Source

appId: ${APP_ID}
---
# The Remove Ads popup of one arm (`noads_popup`), with the e2e ads (E2E_ADS=1) and a seeded song-end
# count, so every song end may show an interstitial from the first song:
#   ${POPUP_AT}     `noads_popup.after_fs`: the popup opens after a song-end interstitial once this many
#                   have shown this session; "0" = never
#   ${POPUP_PRICE}  regex of the price the popup's buy button reads (its pack in the arm's tier), "-" for none
#   ${COOLDOWN_MS}  the arm's interstitial cooldown (`fs.cooldown_sec` in ms)
#   ${BUY}          "1": buy from the popup, then no interstitial and no banner follow
# Each value is checked against the arm's real config (src/data/__tests__/e2e-monetization-flows.test.ts).
#
# Proof, not just "a popup showed": every interstitial before the POPUP_AT-th closes WITHOUT the popup
# (handle-e2e-ad.yaml, EARLY), and for "0" three interstitials pass and none opens it.
- runFlow:
    file: launch-app-seeded.yaml
    env:
      SONG_ENDS: "5"
- runFlow: to-song-list.yaml

# POPUP_AT 1 or 3: songs until the popup is up (at most 8), never before its turn.
- runFlow:
    when:
      true: ${POPUP_AT != '0'}
    commands:
      - repeat:
          times: 8
          while:
            notVisible:
              id: "noads-popup-close"
          commands:
            - runFlow:
                file: noads-popup-cycle.yaml
                env:
                  # Labels before the popup's turn: none for 1; #1 and #2 for 3.
                  EARLY: ${POPUP_AT == '3' ? 'E2E interstitial #[12]' : 'E2E interstitial #0'}
                  MODE: "expect"
                  COOLDOWN_MS: ${COOLDOWN_MS}
      - assertVisible:
          id: "noads-popup-close"
      # The card's inside fades in piece by piece after the popup opens (noads-popup-reveal.ts: the
      # CTA ~0.5 s in), and until then it is not in the accessibility tree: wait for it, then read
      # its price — asserting at once raced the reveal.
      - extendedWaitUntil:
          visible:
            id: "noads-popup-buy"
            text: ${POPUP_PRICE}
          timeout: 10000

# POPUP_AT 0: songs until the 3rd interstitial (at most 8); none of them brings the popup.
- runFlow:
    when:
      true: ${POPUP_AT == '0'}
    commands:
      - repeat:
          times: 8
          while:
            notVisible:
              text: "E2E interstitial #[3-9]"
          commands:
            - runFlow:
                file: noads-popup-cycle.yaml
                env:
                  EARLY: "E2E interstitial #[12]"
                  MODE: "never"
                  COOLDOWN_MS: ${COOLDOWN_MS}
      - assertVisible:
          text: "E2E interstitial #[3-9]"
      - tapOn:
          id: "e2e-ad-close"
      - runFlow:
          file: sleep.yaml
          env:
            MS: "6000"
      - assertNotVisible:
          id: "noads-popup-close"

# Buy from the popup: then the ads are gone (rewarded stays; nothing here asks for one).
- runFlow:
    when:
      true: ${BUY == '1'}
    commands:
      - tapOn:
          id: "noads-popup-buy"
      - extendedWaitUntil:
          notVisible:
            id: "noads-popup-close"
          timeout: 30000
      - runFlow: expect-no-ads.yaml
- runFlow:
    when:
      true: ${BUY != '1'}
      visible:
        id: "noads-popup-close"
    commands:
      - tapOn:
          id: "noads-popup-close"