docs: zones, transports, pattern ota, and submodule readmes

Made-with: Cursor
This commit is contained in:
pi
2026-04-12 00:13:54 +12:00
parent 75ddd559c9
commit 28b19b5219
9 changed files with 90 additions and 97 deletions

View File

@@ -1,79 +1,47 @@
# Tests
This directory contains tests for the LED Controller project.
Tests for the LED Controller project live under **`tests/`** (pytest + legacy scripts).
## Directory Structure
## Layout
- `test_endpoints.py` - HTTP endpoint tests that mimic web browser requests (runs against 192.168.4.1)
- `test_ws.py` - WebSocket tests
- `test_p2p.py` - ESP-NOW P2P tests
- `models/` - Model unit tests
- `web.py` - Local development web server
| Path | Role |
|------|------|
| `test_endpoints.py` | HTTP endpoint checks (often against a running Pi; host configurable in file) |
| `test_endpoints_pytest.py` | Pytest-style endpoint coverage |
| `test_browser.py` | Selenium UI flows |
| `test_pattern_ota_send.py` | Pattern OTA / Wi-Fi send helpers |
| `tcp_test_server.py`, `async_tcp_server.py` | TCP test doubles for driver protocol |
| `udp_server.py` | UDP discovery / hello test listener (port **8766**) |
| `ws.py` | WebSocket client checks |
| `p2p.py` | ESP-NOWrelated helpers / experiments |
| `web.py` | Local dev static server (not the main app) |
| `conftest.py` | Pytest fixtures |
| `models/` | Model unit tests (`run_all.py`, `test_zone.py`, …) |
## Running Tests
## Running tests
### Browser Tests (Real Browser Automation)
### Pytest (recommended)
Tests the web interface in an actual browser using Selenium:
From the project root (with dev dependencies installed):
```bash
pipenv run pytest tests/ -q
```
### Browser tests (real browser)
```bash
python tests/test_browser.py
```
These tests:
- Open a real Chrome browser
- Navigate to the device at 192.168.4.1
- Interact with UI elements (buttons, forms, modals)
- Test complete user workflows
- Verify visual elements and interactions
Requires **Selenium**, Chrome/Chromium, and a matching **ChromeDriver**.
**Requirements:**
```bash
pip install selenium
# Also need ChromeDriver installed and in PATH
# Download from: https://chromedriver.chromium.org/
```
### Endpoint Tests (Browser-like HTTP)
Tests HTTP endpoints by making requests to the device at 192.168.4.1:
```bash
python tests/test_endpoints.py
```
These tests:
- Mimic web browser requests with proper headers
- Handle cookies for session management
- Test all CRUD operations (GET, POST, PUT, DELETE)
- Verify responses and status codes
**Requirements:**
```bash
pip install requests
```
### WebSocket Tests
```bash
python tests/test_ws.py
```
**Requirements:**
```bash
pip install websockets
```
### Model Tests
### Model tests only
```bash
python tests/models/run_all.py
```
### Local Development Server
### Local static server
Run the local development server (port 5000):
```bash
python tests/web.py
```
`tests/web.py` serves files for quick UI experiments; it is **not** the Microdot app. For the real server use **`pipenv run run`** from the repo root.