# Comprehensive Calculator Test Suite
# Tests complex flows and intentional failures to verify assertion behavior

config:
  app: com.google.android.calculator

setup:
  - terminate_app
  - launch_app
  - wait: 2s

teardown:
  - terminate_app

tests:
  # TEST 1: Complex chained calculation (should PASS)
  - name: Complex Chained Calculation
    description: Multiple operations in sequence - 7 × 8 + 12 ÷ 4 = 59
    timeout: 60s
    steps:
      - verify_screen: "Calculator app ready with number pad"

      # Calculate 7 × 8 = 56
      - tap: "7"
      - tap: "×"
      - tap: "8"
      - tap: "="
      - verify_screen: "Calculator showing result 56"

      # Continue: + 12 = 68
      - tap: "+"
      - tap: "1"
      - tap: "2"
      - tap: "="
      - verify_screen: "Calculator showing result 68"

      # Continue: ÷ 4 = 17
      - tap: "÷"
      - tap: "4"
      - tap: "="
      - verify_screen: "Calculator showing result 17"

      # Clear for next test
      - tap: "AC"
      - verify_screen: "Calculator cleared"

  # TEST 2: Decimal and negative numbers (should PASS)
  - name: Decimal Number Operations
    description: Test decimal input - 3.5 + 2.5 = 6
    timeout: 60s
    steps:
      - tap: "3"
      - tap: ","
      - tap: "5"
      - tap: "+"
      - tap: "2"
      - tap: ","
      - tap: "5"
      - tap: "="
      - verify_screen: "Calculator showing result 6"
      - tap: "AC"

  # TEST 3: Wrong result verification (INTENTIONAL FAIL)
  - name: "[EXPECTED FAIL] Wrong Result Assertion"
    description: Calculates 5+3=8, but asserts result is 9 - should fail
    timeout: 60s
    steps:
      - tap: "5"
      - tap: "+"
      - tap: "3"
      - tap: "="
      # This SHOULD FAIL - actual result is 8, not 9
      - verify_screen: "Calculator showing result 9"

  # TEST 4: Element not found (INTENTIONAL FAIL)
  - name: "[EXPECTED FAIL] Element Not Found"
    description: Tries to tap non-existent button - should fail with element list
    timeout: 60s
    steps:
      - tap: "AC"
      - verify_screen: "Calculator ready"
      # This SHOULD FAIL - no such element exists
      - tap: "SquareRoot"

  # TEST 5: Wrong screen state (INTENTIONAL FAIL)
  - name: "[EXPECTED FAIL] Wrong Screen State"
    description: After calculation, asserts completely wrong screen - should fail
    timeout: 60s
    steps:
      - tap: "9"
      - tap: "+"
      - tap: "1"
      - tap: "="
      # This SHOULD FAIL - we're on calculator, not settings
      - verify_screen: "Settings menu with theme options and account settings"
