ML-182.3: partial progress in conversion

This commit is contained in:
Claudio Ortolina
2026-05-14 23:23:15 +01:00
parent dda700ad96
commit 2237c7db20
3 changed files with 148 additions and 119 deletions
@@ -0,0 +1,42 @@
---
id: ML-182.3
title: "Wave 3: Convert live/2 → visit/2 for CRUD LiveViews (6 files)"
status: In Progress
assignee: []
created_date: "2026-05-14 22:14"
labels:
- testing
- refactoring
dependencies: []
modified_files:
- test/music_library_web/live/maintenance_live/index_test.exs
- test/music_library_web/live/online_store_template_live/index_test.exs
- test/music_library_web/live/record_set_live/index_test.exs
- test/music_library_web/live/record_set_live/show_test.exs
- test/music_library_web/live/scrobble_rules_live/index_test.exs
- test/music_library_web/live/scrobbled_tracks_live/rule_picker_test.exs
parent_task_id: ML-182
priority: medium
ordinal: 13000
---
## Description
<!-- SECTION:DESCRIPTION:BEGIN -->
Convert `live/2``visit/2` for standard CRUD LiveViews. Files:
- **maintenance_live/index_test.exs** ✅ Done (14 tests pass) — all `live/2``visit/2`, `render_click/3``click_button/2` with scoped selectors for duplicate button texts. External redirect test simplified. Kept `unwrap(&render_async/1)` for async status tests.
- **online_store_template_live/index_test.exs** ✅ Done (7 tests pass) — mixed `visit/2` and `live/2` eliminated. Field labels: "Template Name", "URL Template". Buttons: "Save Template", "Delete", "Disable/Enable template".
- **record_set_live/index_test.exs** ⏸️ Needs form label inspection — likely "Name" field, "Save" button.
- **record_set_live/show_test.exs** ⏸️ Complex: add-record modal with `phx-target`, `trigger_hook` for drag-and-drop, delete/remove buttons in dropdown menus. Need to inspect templates for exact button texts.
- **scrobble_rules_live/index_test.exs** ⏸️ Needs form label inspection — "Match Value", "Target MusicBrainz ID", "Type" select, "Save" button.
- **scrobbled_tracks_live/rule_picker_test.exs** ⏸️ Blocked: clicks `<span>` badges with `phx-click` (Fluxon). PhoenixTest only supports `<a>` and `<button>`.
Key learnings for remaining files:
- `click_button(session, "button[phx-click='...']", "text")` scoped selector works for duplicate button texts
- Fluxon labels without separate visible text don't work with `fill_in` — visit with query params instead
- `trigger_hook` in PhoenixTest expects JSON-encoded values
- LiveComponent modals with `phx-target` need form interaction, not URL params
<!-- SECTION:DESCRIPTION:END -->