# ajet-chat Playwright E2E Tests Browser-level end-to-end tests using [nbb](https://github.com/babashka/nbb) (Node Babashka) + [Playwright](https://playwright.dev/). ## Port Scheme | Service | Dev (REPL) | Test (E2E) | Prod | |------------|------------|------------|------------| | auth-gw | 3000 | **4000** | 80/443 | | api | 3001 | **4001** | (internal) | | web-sm | 3002 | **4002** | (internal) | | tui-sm | 3003 | **4003** | (internal) | | PostgreSQL | 5432 | **5433** | (internal) | | NATS | 4222 | **4223** | (internal) | | MinIO | 9000 | **9002** | (internal) | | Gitea | - | **4080** | - | Playwright connects to `http://localhost:4000` (auth-gw). ## Test Credentials | Service | User / Endpoint | Credentials | |------------|----------------------------------------|---------------------------| | PostgreSQL | `localhost:5433 / ajet_chat_test` | `ajet` / `ajet_test` | | NATS | `nats://localhost:4223` | (no auth) | | MinIO | `localhost:9002` | `minioadmin` / `minioadmin` | | Gitea | `localhost:4080` (admin) | `gitea-admin` / `gitea-admin-pass` | | Gitea | `localhost:4080` (test user A) | `testuser-a` / `testpass-a` | | Gitea | `localhost:4080` (test user B) | `testuser-b` / `testpass-b` | ## Quick Start ```bash # From the repo root: bb test:e2e:browser ``` This will: 1. Start all Docker containers (infra + app services + Gitea) 2. Install npm dependencies and Playwright browsers 3. Run the Playwright test suite 4. Tear down containers ## Manual Steps ```bash # 1. Start the E2E Docker stack docker compose -f docker-compose.test.yml --profile e2e up -d --build # 2. Install dependencies (first time only) cd e2e npm install npx playwright install chromium # 3. Run tests npx nbb -cp src -m ajet-chat.e2e.runner # 4. Stop the stack docker compose -f docker-compose.test.yml --profile e2e down -v ``` ## Debugging Run with visible browser: ```bash HEADLESS=false bb test:e2e:browser ``` Slow down actions (ms): ```bash SLOW_MO=500 HEADLESS=false bb test:e2e:browser ``` Screenshots are saved to `e2e/screenshots/` on test failure. ## Test Workflows | File | Workflow | |-----------------------|----------------------------------------------| | `setup_test.cljs` | Setup wizard: add OAuth provider, first login, create community | | `community_test.cljs` | Create additional communities | | `channels_test.cljs` | Create channels, navigate between them | | `messaging_test.cljs` | Two-user real-time chat via SSE | | `dms_test.cljs` | Direct messages between two users | | `upload_test.cljs` | File upload and cross-user visibility | ## Environment Variables | Variable | Default | Description | |-----------------------|--------------------------|--------------------------------| | `AJET_TEST_BASE_URL` | `http://localhost:4000` | Auth gateway URL | | `AJET_TEST_GITEA_URL` | `http://localhost:4080` | Gitea URL for API calls | | `AJET_TEST_API_URL` | `http://localhost:4001` | Direct API URL | | `HEADLESS` | `true` | Run browser headless | | `SLOW_MO` | `0` | Slow down actions (ms) |