# Frontend E2E Tests

Playwright tests for the Canteen Asset Tracker SPA.

## Requirements

- System Chromium installed (`/usr/bin/chromium-browser`)
- Playwright Python: `pip install playwright`
- All backend deps: `pip install -r requirements.txt`

## Running

```bash
cd ~/projects/canteen-asset-tracker
python3 -m pytest tests/frontend/ -v
```

## Architecture

- Each test gets an isolated temp SQLite database
- A FastAPI server runs on a random port in a background thread
- `CANTEEN_SKIP_AUTH=1` skips auth middleware so Playwright doesn't need real tokens
- Playwright launches system Chromium in headless mode at iPhone 14 viewport size
- Geolocation is mocked to Orlando, FL

## Writing Tests

Import the `page` and `live_server` fixtures:

```python
def test_something(page, live_server):
    page.locator("#someButton").click()
    assert page.locator(".result").is_visible()
```
