Files
shawn faacf0bce9 Rename 'Add Asset' tab to 'Add / Find Asset' across nav + tabs
- Drawer nav: 'Add Asset' → 'Add / Find Asset'
- Bottom tab bar: 'Add Asset' → 'Add / Find Asset'
- Updated e2e_browser_test.py assertions to match
2026-05-25 23:14:52 -04:00
..

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

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:

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