> ## Documentation Index
> Fetch the complete documentation index at: https://launchpad.datalumina.com/llms.txt
> Use this file to discover all available pages before exploring further.

# End-to-End Testing

> Exercise the full API + Celery + database path with a single HTTP call

After validating a workflow with the playground, run it through the full stack — API, database, Celery worker, and Langfuse if enabled — to confirm the pieces work together.

## Hit the `/events` endpoint

The generic events endpoint stores the payload, queues `process_incoming_event`, and returns HTTP 202 immediately. `get_workflow_type()` in `app/launchpad/api/events.py` currently returns `WorkflowRegistry.QUICKSTART.name`, so every event posted to `/events/` runs through `CustomerCareWorkflow`.

### curl

```bash theme={null}
curl -X POST http://localhost:8080/events/ \
  -H "Content-Type: application/json" \
  -d @app/launchpad/workflows/examples/quickstart/request_examples/invoice.json
```

Expected response:

```json theme={null}
{"message": "process_incoming_event started `<task-id>` "}
```

with HTTP status **202 Accepted**.

### Python

```python theme={null}
import json
from pathlib import Path

import requests

event_path = Path("app/launchpad/workflows/examples/quickstart/request_examples/invoice.json")
payload = json.loads(event_path.read_text())

response = requests.post("http://localhost:8080/events/", json=payload)
print(response.status_code, response.text)
assert response.status_code == 202
```

## Prerequisites

* **Docker running** — `docker ps` shows the api, celery\_worker, redis, and db services.
* **API reachable** at `http://localhost:8080`.
* **Celery worker running** — logs show it picking up `process_incoming_event`.
* **Migrations applied** — run `./migrate.sh` from `app/launchpad/` once.

## Monitor results

<Steps>
  <Step title="Check worker logs">
    Run `docker compose logs celery_worker` from `docker/` and look for the `process_incoming_event` task completing.
  </Step>

  <Step title="Inspect the database">
    Query the `events` table with your preferred PostgreSQL client. Each row holds the raw payload in `data` and the final `TaskContext` in `task_context` once the worker finishes.
  </Step>

  <Step title="Optional: use Supabase Studio">
    If you enabled `docker-compose.supabase.yml`, open Studio at [http://localhost:8000](http://localhost:8000), authenticate with the dashboard credentials from `docker/.env`, and inspect the `events` table in the Table Editor.
  </Step>
</Steps>

## Troubleshooting

* **Nothing processes** — check Celery worker logs; `docker compose logs celery_worker` will show import errors immediately.
* **422 from FastAPI** — the endpoint accepts any JSON, but the workflow raises a Pydantic validation error when the payload does not match `CustomerCareEventSchema`. Inspect the Celery logs for the stack trace.
* **Stuck on an older workflow** — update `get_workflow_type()` in `app/launchpad/api/events.py` to return a different `WorkflowRegistry.*.name`, or add a dedicated router module under `app/launchpad/api/` that mounts your workflow on its own path.
