# QA360 Example: Full Stack
# Complete testing suite with API, UI, and Performance

version: 2
name: fullstack-tests
description: Full stack testing with API, UI and performance gates

gates:
  api-health:
    adapter: playwright-api
    enabled: true
    config:
      baseUrl: "https://httpbin.org"
      smoke:
        - "GET /status/200 -> 200"
        - "GET /json -> 200"
        - "POST /post -> 200"

  ui-smoke:
    adapter: playwright-ui
    enabled: true
    config:
      baseUrl: "https://example.com"
      pages:
        - url: "/"
          expectedElements: ["body", "main"]

  perf:
    adapter: k6-perf
    enabled: true
    config:
      script: |
        import http from 'k6/http';
        import { check } from 'k6';

        export const options = {
          stages: [
            { duration: '10s', target: 10 },
            { duration: '20s', target: 50 },
            { duration: '10s', target: 0 },
          ],
        };

        export default function () {
          const res = http.get('https://httpbin.org/status/200');
          check(res, {
            'status is 200': (r) => r.status === 200,
            'response time < 500ms': (r) => r.timings.duration < 500,
          });
        }
    budgets:
      p95_ms: 2000

execution:
  default_timeout: 60000
  default_retries: 2
  on_failure: continue
  parallel: true

# Optional: Docker Compose integration (uncomment if using Docker)
# hooks:
#   beforeAll:
#     - type: docker
#       compose:
#         file: docker-compose.yml
#         command: up -d
#       timeout: 30000
#     - type: wait_on
#       wait_for:
#         resource: http://localhost:3000
#         timeout: 30000
#
#   afterAll:
#     - type: docker
#       compose:
#         file: docker-compose.yml
#         command: down
#       timeout: 30000
