# Collection Detail Test
# Tests navigating to a collection and viewing its workouts
# Prerequisite: User must have completed onboarding

appId: com.millianlmx.tabatafit
name: Collection Detail

---
# Navigate to Explore tab
- tapOn:
    text: "Explore"
    optional: true
- tapOn:
    id: "explore-tab"
    optional: true

# Verify Explore screen loaded
- assertVisible:
    id: "explore-screen"
    timeout: 5000

# Verify collections section
- assertVisible:
    id: "collections-section"
    timeout: 3000
    optional: true

# Tap the first collection card
- tapOn:
    text: ".*collection.*"
    optional: true

# If collection-card testIDs are visible, tap by testID instead
- tapOn:
    id: "collection-card-.*"
    optional: true

# Verify collection detail screen loaded
- assertVisible:
    id: "collection-detail-screen"
    timeout: 5000
    optional: true

# Verify hero card is visible
- assertVisible:
    id: "collection-hero"
    timeout: 3000
    optional: true

# Verify back button exists
- assertVisible:
    id: "collection-back-button"
    timeout: 3000
    optional: true

# Verify workouts are listed
- assertVisible:
    text: ".*Workout.*"
    timeout: 3000
    optional: true

# Scroll to see more workouts
- scroll:
    direction: DOWN
    duration: 500

# Tap a workout in the collection
- tapOn:
    id: "collection-workout-.*"
    optional: true

# Verify workout detail opened
- assertVisible:
    id: "workout-detail-screen"
    timeout: 5000
    optional: true

# Go back to collection
- pressKey: back
  optional: true

# Go back to explore via back button
- tapOn:
    id: "collection-back-button"
    optional: true

# Navigate back to Home
- tapOn:
    text: "Home"
    optional: true
- tapOn:
    id: "home-tab"
    optional: true
