Commit graph

9 commits

Author SHA1 Message Date
Jon Seager
0e3847ade9
feat: sync timeline events with entity edits
Add background timeline rebuild task (mirroring stats cache pattern)
that refreshes denormalized timeline event snapshots when entities are
updated. Includes cascade logic so editing a roaster refreshes timeline
events for its roasts, bags, brews, and cups.

- Add update_by_entity/delete_by_entity/delete_all to TimelineEventRepository
- Add TimelineInvalidator with debounced background rebuild task
- Add invalidate() calls to all 7 entity update handlers
- Add delete_by_entity cleanup to define_delete_handler! macro
- Add gear_id filter to BrewFilter for cascade traversal
- Add `brewlog timeline rebuild` CLI command for full rebuild
- Add 5 integration tests for timeline sync behavior
2026-02-15 11:11:07 +00:00
Jon Seager
2cd579a574
refactor: deduplicate update handlers and edit templates
Add HasChanges trait with impl_has_changes! macro, validate_update()
and update_response() helpers to reduce boilerplate across all 7 entity
update handlers. Extract edit form actions (error, spinner, buttons)
into a shared Askama macro. Also adds missing no-changes validation
to the bag update handler.
2026-02-10 20:04:24 +00:00
Jon Seager
0434b127e0
test: add E2E chromedriver tests for edit forms
Cover text fields, numeric fields, +/- adjuster buttons, searchable
selects, image upload/replace/remove, deferred image save, and the
cancel button across roaster, gear, cafe, brew, and cup entities.

Add wait_for_url_not_contains helper to correctly detect post-submit
redirects when the edit page URL shares a prefix with the detail page.
2026-02-10 19:43:06 +00:00
Jon Seager
cf56ac28f7
test: add integration and e2e tests for image API
Cover all image entry points: upload, get, thumbnail, delete, auth
guards, validation, datastar responses, deferred image saves via
roaster create, checkin (cafe/cup), and scan flows including the
matched-roast guard that prevents overwriting existing images.
2026-02-10 17:50:30 +00:00
Jon Seager
3d61f71f1d
test(e2e): add homepage scan tests and fix stale element in checkin test
Add 3 homepage scan e2e tests covering all roaster/roast match
permutations (new+new, existing+new, existing+existing). Fix
StaleElementReference in checkin test by using JS clicks for
Datastar-managed DOM elements.
2026-02-10 11:36:16 +00:00
Jon Seager
264ef9c1fb
test: add e2e checkin test with new cafe and scanned roast
Cover the check-in flow where neither the cafe nor the roast exist
beforehand. The test searches for a cafe via location search (mocked
Foursquare), scans a coffee bag via text prompt (mocked OpenRouter),
and submits the check-in. Adds spawn_app_with_all_mocks helper.
2026-02-10 11:26:17 +00:00
Jon Seager
7c1fbb99b8
test: add e2e tests for data page, detail pages, bag close, and navigation
Cover tab switching, search, pagination, and sorting on the data list
page. Verify detail page rendering for roasters, roasts, bags, gear,
and cafes. Test the close-bag flow from the detail page. Check that
home, stats, and timeline pages load correctly with data.
2026-02-10 11:09:30 +00:00
Jon Seager
104ebb410a
test: add e2e browser tests for core user flows
Roaster creation (basic + all fields), full brew chain through browser,
entity deletion with confirm dialog, AI extraction via text prompt with
mocked OpenRouter, and check-in wizard with saved cafe + existing roast.
2026-02-10 10:45:01 +00:00
Jon Seager
73976cbe51
feat(test): add e2e browser test helpers
BrowserSession wraps headless Chrome via thirtyfour. Auth helper injects
session cookies to bypass WebAuthn. Wait helpers handle Datastar's async
DOM updates (visibility, text, URL). Form helpers find visible elements
to avoid hidden duplicates on tabbed pages. Chromedriver is auto-spawned
on first use via a dedicated parked thread with PR_SET_PDEATHSIG so the
kernel kills it when the test binary exits.
2026-02-10 10:44:47 +00:00