# ts-customer-01-01 — When OS-level notification permission is denied,
# SHome1st renders the amber "notifikasi off" banner above the
# 'aku mau curhat' CTA.
# Spec ref: requirement/flow_customer.mermaid.md §1 — `NotifCheck → no →
# HomeBanner` (line 24-26 of the mermaid).
#
# Banner widget: home_screen.dart::_NotifDeniedBanner. Gating provider:
# notifPermissionStatusProvider (core/notifications/notif_permission.dart).
# The provider reads `permission_handler::Permission.notification.status`
# which, on Android 13+, reflects the runtime POST_NOTIFICATIONS state and
# on older Android reflects the app's notification-enabled toggle.
#
# Pre-requisite (manual setup):
#   The test only exercises the "denied" branch. Disable notifications for
#   the customer app BEFORE invoking maestro:
#     - Android 13+: maestro's `permissions: { notifications: deny }` below
#       handles this (POST_NOTIFICATIONS is a runtime permission).
#     - Android 7-12 (incl. the API-24 dev AVD): the runtime permission
#       doesn't exist, so the maestro `permissions:` block is a no-op.
#       Instead, toggle Settings → Apps → Halo Bestie → Notifications →
#       Off manually. This sets the system `NotificationManagerCompat`
#       state which the app's `notif_permission.dart::readStatus`
#       pre-check picks up. `clearState: true` below is safe — `pm clear`
#       wipes app data but not the system-level notification toggle.
#   The backend FCM path still fires regardless of this branch (the OS
#   simply suppresses the notification); the banner is the only
#   user-visible signal that they're missing alerts, which is what we
#   assert below.
appId: com.mybestie
env:
  TEST_PHONE: "+6281234567890"
  BACKEND_INTERNAL_URL: http://localhost:3001
---
- runScript:
    file: ../scripts/reset_phone.js
    env:
      TEST_PHONE: ${TEST_PHONE}
      BACKEND_INTERNAL_URL: ${BACKEND_INTERNAL_URL}
- launchApp:
    clearState: true
    permissions:
      notifications: deny
- extendedWaitUntil:
    visible:
      text: "Mulai"
    timeout: 15000
- tapOn:
    text: "Mulai"
    retryTapIfNoChange: true
- extendedWaitUntil:
    visible:
      text: "(?s).*aku mau curhat.*"
    timeout: 30000

# §1 NotifCheck=no → SHome1st banner. Text is the unique copy from
# _NotifDeniedBanner; the icon is decorative-only and not part of the
# a11y label.
- assertVisible: "(?s).*notifikasi off.*"
- assertVisible: "(?s).*kelewat chat dari bestie.*"
- assertVisible: "(?s).*nyalain.*"
- takeScreenshot: /tmp/notif_banner_design
