# CoaxysPanel REST API E2E Test Suite This directory contains the comprehensive, opaque-box E2E test suite for the CoaxysPanel REST API. The test suite validates: - **Tier 1 (Happy Paths)**: Basic CRUD on Auth, Websites, Domains, DNS, and general JSON API envelope compliance. - **Tier 2 (Boundaries & Negative States)**: Validation failures, conflicts (409), rate limiting, not found (404), method checks (405), server errors (500), and SQL injection safety. - **Tier 3 (Cross-Feature logic)**: Session expiration vs CRUD access, role-based scope comparison, and domain deletion mapping effects. - **Tier 4 (Real-World Workload)**: Complete lifecycle scenarios (login -> domain create -> website create -> configure -> clean up -> logout). ## Configuration The test suite communicates with the backend via HTTP and is configured using environment variables. * `API_URL`: The base URL of the CoaxysPanel REST API (defaults to `http://localhost:3001`). * `DEBUG_E2E`: Set to `true` to enable verbose request and response logging for easier debugging. ### Automatic Fallback Mock Server If no active server is detected at `API_URL`, or if the port is occupied by the Nova Telegram bot service, the global setup will **automatically start a local mock backend server** on port `3009` and override `API_URL` to point to it. This allows the E2E tests to be completely self-contained and runnable out of the box. ## Commands ### Typecheck Compilation Verify that the TypeScript test files compile cleanly: ```bash npx tsc --noEmit ``` ### Running the E2E Test Suite To run all E2E specs using Vitest: ```bash npx vitest run --config backend/tests/e2e/vitest.config.ts ``` To run the E2E tests with debug request/response logging: ```bash DEBUG_E2E=true npx vitest run --config backend/tests/e2e/vitest.config.ts ```