Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

3.9 KB
Raw Blame
procs:
    # E2E test runner with Playwright UI
    playwright:
        shell: 'pnpm --filter=@posthog/frontend build:products && pnpm --filter=@posthog/playwright exec playwright test --ui'
        env:
            BASE_URL: 'http://localhost:8010'
            EMAIL_HOST: 'email.test.posthog.net'

    backend:
        shell: 'uv sync --active && bin/wait-for-docker && ./bin/start-backend'
        ready_pattern: 'Listening at'
        env:
            DATABASE_URL: 'postgres://posthog:posthog@localhost:5432/posthog_e2e_test'
            CLICKHOUSE_DATABASE: 'posthog_test'
            CLOUD_DEPLOYMENT: 'E2E'
            SECRET_KEY: 'e2e_test'
            SECURE_COOKIES: '0'
            SKIP_SERVICE_VERSION_REQUIREMENTS: '1'
            DEBUG: '1'
            E2E_TESTING: '1'
            PERSON_ON_EVENTS_OVERRIDE: '1'
            PERSONHOG_ADDR: 'localhost:50052'

    celery-worker:
        shell: 'uv sync --active && bin/wait-for-docker && ./bin/start-celery worker'
        ready_pattern: 'celery@'
        env:
            DATABASE_URL: 'postgres://posthog:posthog@localhost:5432/posthog_e2e_test'
            CLICKHOUSE_DATABASE: 'posthog_test'
            CLOUD_DEPLOYMENT: 'E2E'
            SECRET_KEY: 'e2e_test'
            SECURE_COOKIES: '0'
            SKIP_SERVICE_VERSION_REQUIREMENTS: '1'
            DEBUG: '1'
            E2E_TESTING: '1'
            PERSONHOG_ADDR: 'localhost:50052'

    frontend:
        shell: './bin/start-frontend'
        ready_pattern: 'VITE.*ready in'
        env:
            E2E_TESTING: '1'

    docker-compose:
        shell: 'docker compose -p posthog -f docker-compose.dev.yml -f docker-compose.profiles.yml up --pull always -d && docker compose -p posthog -f docker-compose.dev.yml -f docker-compose.profiles.yml --profile ingestion up -d personhog-replica personhog-router && echo "docker-compose ready" && docker compose -p posthog -f docker-compose.dev.yml -f docker-compose.profiles.yml logs --tail=100 -f'
        ready_pattern: 'docker-compose ready'

    reset-db:
        shell: |-
            echo "=== Terminating existing connections ===" && \
            psql -d postgres -c "SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = 'posthog_e2e_test' AND pid <> pg_backend_pid();" || true && \
            echo "=== Dropping and recreating databases ===" && \
            dropdb --if-exists posthog_e2e_test && \
            createdb posthog_e2e_test && \
            echo "DROP DATABASE IF EXISTS posthog_test SYNC" | curl 'http://localhost:8123/' --data-binary @- && \
            echo "CREATE DATABASE posthog_test" | curl 'http://localhost:8123/' --data-binary @- && \
            echo "=== Detaching conflicting Kafka-engine tables from posthog DB (shared consumer group 'group1') ===" && \
            for tbl in $(echo "SELECT name FROM system.tables WHERE database='posthog' AND engine='Kafka' FORMAT TabSeparated" | curl -s 'http://localhost:8123/' --data-binary @-); do \
                echo "  detaching posthog.$tbl"; \
                echo "DETACH TABLE IF EXISTS posthog.\`$tbl\` PERMANENTLY" | curl -s 'http://localhost:8123/' --data-binary @- || true; \
            done && \
            echo "=== Running migrations ===" && \
            bin/wait-for-docker && \
            python manage.py migrate && \
            python manage.py migrate_clickhouse && \
            echo "=== Setting up demo data ===" && \
            python manage.py setup_dev && \
            echo "=== Done ==="
        autostart: false
        ready_pattern: '=== Done ==='
        env:
            PGHOST: 'localhost'
            PGPORT: '5432'
            PGUSER: 'posthog'
            PGPASSWORD: 'posthog'
            DATABASE_URL: 'postgres://posthog:posthog@localhost:5432/posthog_e2e_test'
            CLICKHOUSE_DATABASE: 'posthog_test'
            CLOUD_DEPLOYMENT: 'E2E'
            SECRET_KEY: 'e2e_test'
            DEBUG: '1'
            E2E_TESTING: '1'
            PERSONHOG_ADDR: 'localhost:50052'

mouse_scroll_speed: 1
scrollback: 10000