---
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"
updated_date: "2026-05-15 06:01"
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)
- **online_store_template_live/index_test.exs** ✅ Done (7 tests pass)
- **record_set_live/index_test.exs** ✅ Done (7 tests pass)
- **record_set_live/show_test.exs** ✅ Done (15 tests pass)
- **scrobble_rules_live/index_test.exs** ✅ Done (10 tests pass) — removed `import Phoenix.LiveViewTest`, added explicit `only:` for `render_change/1` and `form/3`. Fluxon `<.select>` component requires `unwrap` with `form/3` + `render_change/1` for type changes — standard `PhoenixTest.select/3` doesn't work with custom selects. Dynamic label ("Match Value"/"Album Title"/"Artist Name") handled via `set_rule_type` helper. Edit validation test uses `unwrap` with `render_change` to clear existing data before checking errors. Path assertions on patch links omit query params (not captured by PhoenixTest). Buttons: "Add" (link), "Save Rule", "Apply", "Apply rule", "Delete", "Disable rule"/"Enable rule".
- **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:

- Fluxon custom `<.select>` components are NOT native `<select>` elements — use `unwrap` with `form/3` + `render_change/1` instead of `PhoenixTest.select/3`
- For edit-form validation tests where existing data would pass validation, `unwrap` with `render_change` clears fields first
- `assert_path` on patch links doesn't capture query params — use path-only assertions
- `<li phx-click>` needs `unwrap` with `element/2` + `render_click/1` since PhoenixTest only supports `<a>` and `<button>` natively
<!-- SECTION:DESCRIPTION:END -->
