Move band management into dedicated settings pages

- Add BandSettingsPage (/bands/:id/settings/:panel) with Members,
  Storage, and Band Settings panels matching the mockup design
- Strip members list, invite controls, and NC folder config from
  BandPage — library view now focuses purely on recordings workflow
- Add band-scoped nav section to AppShell sidebar (Members, Storage,
  Band Settings) with correct per-panel active states
- Fix amAdmin bug: was checking if any member is admin; now correctly
  checks if the current user holds the admin role
- Add 31 vitest tests covering BandPage cleanliness, routing, access
  control (admin vs member), and per-panel mutation behaviour
- Add test:web, test:api:unit, test:feature (post-feature pipeline),
  and ci tasks to Taskfile; frontend tests run via podman node:20-alpine
- Add README with architecture overview, setup guide, and test docs
- Add @testing-library/dom and @testing-library/jest-dom to package.json

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Mistral Vibe
2026-04-01 14:55:10 +02:00
parent 69c614cf62
commit 16bfdd2e90
12 changed files with 2428 additions and 465 deletions

View File

@@ -0,0 +1,151 @@
# BandSettingsPage — Test Cases
Feature branch: `feature/main-view-refactor`
---
## 1. BandPage cleanliness
**TC-01** — BandPage renders no member list
Navigate to `/bands/:bandId`. Assert that no member name, email, or role badge is rendered.
**TC-02** — BandPage renders no invite button
Navigate to `/bands/:bandId`. Assert that "+ Invite" is absent.
**TC-03** — BandPage renders no NC folder widget
Navigate to `/bands/:bandId`. Assert that "NEXTCLOUD SCAN FOLDER" / "SCAN PATH" label is absent.
**TC-04** — BandPage still shows sessions
Navigate to `/bands/:bandId`. Assert that dated session rows are rendered (or empty-state message if no sessions).
**TC-05** — BandPage still shows Scan Nextcloud button
Navigate to `/bands/:bandId`. Assert "⟳ Scan Nextcloud" button is present.
**TC-06** — BandPage still shows + New Song button
Navigate to `/bands/:bandId`. Assert "+ New Song" button is present.
**TC-07** — BandPage search tab remains functional
Click "Search" tab, enter a query, click Search. Assert results render or empty state shown.
---
## 2. Navigation — sidebar
**TC-08** — Band settings nav items appear when band is active
Log in, select any band. Assert sidebar contains "Members", "Storage", "Band Settings" nav items under a "Band Settings" section label.
**TC-09** — Band settings nav items absent when no band active
Navigate to `/` (no band selected). Assert sidebar does NOT show "Members", "Storage", "Band Settings" items.
**TC-10** — Members nav item highlights correctly
Navigate to `/bands/:bandId/settings/members`. Assert "Members" nav item has amber active style; "Storage" and "Band Settings" do not.
**TC-11** — Storage nav item highlights correctly
Navigate to `/bands/:bandId/settings/storage`. Assert "Storage" nav item is active.
**TC-12** — Band Settings nav item highlights correctly
Navigate to `/bands/:bandId/settings/band`. Assert "Band Settings" nav item is active.
**TC-13** — Switching bands from band switcher while on settings stays on the same panel type
On `/bands/A/settings/storage`, switch to band B. Assert navigation goes to `/bands/B` (library) — band switcher navigates to library, which is correct. Band settings panel is band-specific.
---
## 3. Routing
**TC-14** — Base settings URL redirects to members panel
Navigate directly to `/bands/:bandId/settings`. Assert browser URL redirects to `/bands/:bandId/settings/members` without a visible flash.
**TC-15** — Direct URL navigation to storage panel works
Navigate directly to `/bands/:bandId/settings/storage`. Assert Storage panel content is rendered.
**TC-16** — Direct URL navigation to band panel works
Navigate directly to `/bands/:bandId/settings/band`. Assert Band Settings panel content is rendered.
**TC-17** — Unknown panel falls back to members
Navigate to `/bands/:bandId/settings/unknown-panel`. Assert Members panel is rendered (fallback in `activePanel` logic).
---
## 4. Members panel — access control
**TC-18** — Admin sees + Invite button
Log in as admin, navigate to `/bands/:bandId/settings/members`. Assert "+ Invite" button is present.
**TC-19** — Non-admin does not see + Invite button
Log in as member (non-admin), navigate to `/bands/:bandId/settings/members`. Assert "+ Invite" button is absent.
**TC-20** — Admin sees Remove button on non-admin members
Log in as admin. Assert "Remove" button appears next to member-role users.
**TC-21** — Non-admin does not see Remove button
Log in as member. Assert no "Remove" button appears for any member.
**TC-22** — Admin does not see Remove button for other admins
Log in as admin. Assert "Remove" button is absent next to rows where role is "admin".
**TC-23** — Pending Invites section only visible to admins
Log in as member. Assert "Pending Invites" heading is absent.
---
## 5. Members panel — functionality
**TC-24** — Generate invite creates a link and copies to clipboard
As admin, click "+ Invite". Assert an invite URL (`/invite/<token>`) appears in the UI and `navigator.clipboard.writeText` was called with it.
**TC-25** — Dismiss hides the invite link banner
After generating an invite, click "Dismiss". Assert the invite link banner disappears.
**TC-26** — Remove member removes from list
As admin, click "Remove" on a member-role row. Mock the DELETE endpoint to 200. Assert the members query is invalidated and the member disappears.
**TC-27** — Revoke invite removes from pending list
As admin, click "Revoke" on a pending invite. Mock the DELETE endpoint. Assert the invites query is invalidated.
**TC-28** — Copy invite link writes to clipboard
In the pending invites list, click "Copy" on an invite row. Assert `navigator.clipboard.writeText` was called with the correct URL.
---
## 6. Storage panel — access control and functionality
**TC-29** — Admin sees Edit button on NC folder path
Log in as admin, navigate to storage panel. Assert "Edit" button is visible next to the scan path.
**TC-30** — Non-admin does not see Edit button
Log in as member, navigate to storage panel. Assert "Edit" button is absent.
**TC-31** — Editing NC folder path and saving updates the band
As admin, click Edit, change the path, click Save. Mock PATCH `/bands/:bandId` to 200. Assert band query is invalidated and edit form closes.
**TC-32** — Cancel edit closes form without saving
As admin, click Edit, change the path, click Cancel. Assert the form disappears and PATCH was not called.
**TC-33** — Default path shown when nc_folder_path is null
When `band.nc_folder_path` is null, assert the displayed path is `bands/<slug>/`.
---
## 7. Band settings panel — access control and functionality
**TC-34** — Admin sees Save changes button
Log in as admin, navigate to band panel. Assert "Save changes" button is present.
**TC-35** — Non-admin does not see Save button, sees info text
Log in as member, navigate to band panel. Assert "Save changes" absent and "Only admins can edit band settings." is shown.
**TC-36** — Name field is disabled for non-admins
Log in as member. Assert the band name input has the `disabled` attribute.
**TC-37** — Saving band name and tags calls PATCH
As admin, change band name to "New Name", click Save. Assert PATCH `/bands/:bandId` called with `{ name: "New Name", genre_tags: [...] }`.
**TC-38** — Adding a genre tag updates the tag list
Type "punk" in the tag input, press Enter. Assert "punk" pill appears in the tag list.
**TC-39** — Removing a genre tag removes its pill
Click the × on a genre tag pill. Assert the pill disappears from the list.
**TC-40** — Delete band button disabled for non-admins
Log in as member. Assert the "Delete band" button has the `disabled` attribute.