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

# E2e tests

# E2E Tests

End-to-end tests for the media stack.

## Overview

These tests verify the complete media acquisition pipeline:

1. **API Integration** (`test_api.sh`) - Verifies all services are healthy and properly configured
2. **Movie Pipeline** (`test_pipeline.sh`) - Tests movie flow: Jellyseerr → Radarr → qBittorrent → Jellyfin
3. **TV Series Pipeline** (`test_pipeline_tv.sh`) - Tests TV flow: Jellyseerr → Sonarr → qBittorrent → Jellyfin

## Usage

```bash theme={null}
./run_e2e.sh              # Run all tests
./run_e2e.sh --api-only   # Quick API health checks
./run_e2e.sh --movie-only # Movie pipeline only
./run_e2e.sh --tv-only    # TV pipeline only
./run_e2e.sh --pipeline-only  # Both pipelines, skip API tests
./run_e2e.sh --sequential     # Run pipelines one at a time
./cleanup.sh              # Manual cleanup
```

## What the Pipeline Tests Do

1. **Pre-flight checks** - Verifies all services are healthy
2. **Cleanup existing** - Removes any leftover test data
3. **Request content** - Submits request via Jellyseerr API
4. \**Verify *arr** - Confirms Radarr/Sonarr received the request
5. **Verify download** - Confirms qBittorrent started downloading
6. **Wait for completion** - Monitors download progress (timeout: 30min)
7. **Verify import** - Confirms Radarr/Sonarr imported the file(s)
8. **Trigger scan** - Initiates Jellyfin library scan
9. **Verify playable** - Confirms content appears in Jellyfin
10. **Cleanup** - Removes all test data (always runs, even on failure)

## Troubleshooting

### Prowlarr has no indexers configured

Add indexers in Prowlarr UI, then sync to Radarr.

### Radarr/Sonarr has no root folder configured

Settings → Media Management → Root Folders → Add `/media/movies` or `/media/shows`.

### Radarr/Sonarr has no download client configured

Settings → Download Clients → Add qBittorrent: Host `gluetun`, Port `8085`.

### Download completes but never imports

Radarr/Sonarr's in-memory TrackedDownload cache becomes stale when content is deleted and re-added while the torrent still exists in qBittorrent.

**Solution**: The cleanup script handles this by removing torrents from qBittorrent first, then deleting from Radarr/Sonarr, then restarting the services to clear the cache.
