# Mirror of client_app's 03_payment_to_chat_happy.yaml — this drives the MITRA side
# of the same flow. Use this when you specifically need to assert mitra-side UI
# (the incoming overlay, accept tap behavior).
#
# Pre-req:
#   1. Mitra signed in to the mitra_app and ONLINE
#   2. TEST_CUSTOMER_ID and TEST_CUSTOMER_JWT in .maestro/config.yaml point at a real customer
#   3. The customer has an existing confirmed payment_session ready to blast (use the
#      seed_customer_pending_blast.sh helper)
#
# A more thorough version that walks auth + asserts every popup element is in
# ts-mitra-3-01-incoming_popup_curhat_baru.yaml; this file keeps the
# lightweight smoke version for fast iteration on a pre-signed-in device.
#
# Run:
#   maestro test mitra_app/.maestro/flows/03_accept_general_blast.yaml
appId: ${APP_ID_ANDROID}
---
- launchApp:
    clearState: false

# Ensure mitra is online before triggering the blast. Stage 2 swapped the
# Switch widget for a "Kamu lagi ONLINE" status card.
- assertVisible:
    text: "(?s).*Kamu lagi ONLINE.*"

# Step 1: simulate a customer creating a confirmed payment + firing a general blast.
# This script returns once the blast notification has been sent to this mitra.
- runScript: ../scripts/customer_blast_now.sh

# Step 2: incoming-request popup appears on this device (BestieIncomingPopup,
# variant=new — pink-bordered card with "Curhat Baru!" headline).
- extendedWaitUntil:
    visible:
      text: "(?s).*Curhat Baru!.*"
    timeout: 10000
- assertVisible:
    text: "(?s).*Terima.*"
- assertVisible:
    text: "(?s).*Tolak.*"

# Step 3: mitra accepts → popup closes, chat opens. BestieChatV5 active
# subtitle is "sesi aktif · Chat".
- tapOn: "(?s).*Terima.*"
- extendedWaitUntil:
    visible:
      text: "(?s).*sesi aktif · Chat.*"
    timeout: 10000
