From 5e7b8a7694a381ceefd03191a8ce448faf74bd9e Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Mon, 23 Nov 2026 16:09:02 -0500 Subject: [PATCH] feat(web): home shelves you can tell apart at a glance Each home shelf now has its own shape. Main mixes and playlists are wide cards: the lead album's cover on a wash of its own colour, with the name and what the mix is built from beside it rather than over the art. Songs like mixes are circles, the shape artists already have. Genre mixes are short bands with a fan of three covers. Shelf sizes step down from the main mixes. Tiles show album covers in place of the four-cover collage, and no cover repeats along a shelf while a tile still has an unused one. The size and refresh time every mix on a shelf shares is said once, beside the shelf's title. Library pages keep the square card. Co-Authored-By: Claude Opus 5.5 --- web/src/lib/api/types.ts | 4 + .../lib/components/HorizontalScrollRow.svelte | 12 +- web/src/lib/components/PlaylistCard.svelte | 192 ++++++++++++++++-- web/src/lib/components/PlaylistCard.test.ts | 57 ++++++ .../components/PlaylistPlaceholderCard.svelte | 43 +++- web/src/lib/playlists/shelf.test.ts | 98 +++++++++ web/src/lib/playlists/shelf.ts | 72 +++++++ web/src/routes/+page.svelte | 60 ++++-- web/src/routes/page.test.ts | 25 ++- 9 files changed, 512 insertions(+), 51 deletions(-) create mode 100644 web/src/lib/playlists/shelf.test.ts create mode 100644 web/src/lib/playlists/shelf.ts diff --git a/web/src/lib/api/types.ts b/web/src/lib/api/types.ts index 08d6caed..8d73adac 100644 --- a/web/src/lib/api/types.ts +++ b/web/src/lib/api/types.ts @@ -76,6 +76,10 @@ export type Playlist = { refreshable: boolean; seed_artist_id: string | null; cover_url: string; // empty string when no cover; UI renders glyph + // Up to six distinct albums with art, in track order; each album's art is + // /api/albums/{id}/cover. Absent when the playlist has none. A home shelf + // gives each tile an album no earlier tile shows (lib/playlists/shelf.ts). + cover_album_ids?: string[]; track_count: number; duration_sec: number; created_at: string; diff --git a/web/src/lib/components/HorizontalScrollRow.svelte b/web/src/lib/components/HorizontalScrollRow.svelte index b1944227..c8c1c4fa 100644 --- a/web/src/lib/components/HorizontalScrollRow.svelte +++ b/web/src/lib/components/HorizontalScrollRow.svelte @@ -6,6 +6,7 @@ rows, item, title, + meta, ariaLabel }: { /** One or more visual rows of items rendered inside a single shared @@ -20,6 +21,10 @@ /** Section heading shown to the left of the arrows. Omit for an unlabeled scroller. */ title?: string; + /** One line of facts every item in the section shares (e.g. "25 songs + each · refreshed today"), shown beside the title so the items need + not repeat it. */ + meta?: string; /** Accessible label for the section as a whole. */ ariaLabel?: string; } = $props(); @@ -63,7 +68,12 @@
{#if title} -

{title}

+
+

{title}

+ {#if meta} + {meta} + {/if} +
{:else} {/if} diff --git a/web/src/lib/components/PlaylistCard.svelte b/web/src/lib/components/PlaylistCard.svelte index 1d1b5797..8032b946 100644 --- a/web/src/lib/components/PlaylistCard.svelte +++ b/web/src/lib/components/PlaylistCard.svelte @@ -7,39 +7,67 @@ import { getPlaylist, systemShuffle, refreshSystem } from '#lib/api/playlists.js'; import { playlistTrackToRef } from '#lib/playlists/playlistTrackToRef.js'; import { systemPlaylistRefetch } from '#lib/playlists/systemRefetch.js'; + import { refreshedLabel, songsLikeArtist } from '#lib/playlists/shelf.js'; + import { coverUrl } from '#lib/media/covers.js'; + import { dominantColorFromUrl, rgbToCssString } from '#lib/media/dominantColor.js'; import { errCode } from '#lib/api/errors.js'; import { qk } from '#lib/api/queries.js'; import { playQueue } from '#lib/player/store.svelte.js'; import { pushToast } from '#lib/stores/toast.svelte.js'; - let { playlist }: { playlist: Playlist } = $props(); + let { + playlist, + shape = 'square', + covers = [], + showMeta = true + }: { + playlist: Playlist; + /** square: a cover with the title over it (library pages). wide: a home + page main mix or playlist. round: a Songs like mix, shaped like the + artists elsewhere. band: a genre mix, a colour field with a fan of + covers. */ + shape?: 'square' | 'wide' | 'round' | 'band'; + /** Album ids whose covers this tile shows, as the shelf assigned them + (lib/playlists/shelf.ts). Empty falls back to the playlist's collage. */ + covers?: string[]; + /** False when the shelf heading already says the size and refresh time + every tile shares. */ + showMeta?: boolean; + } = $props(); const isOwn = $derived(user.value?.id === playlist.user_id); // Server tells us which system playlists support by-kind refresh — no // hardcoded kind list here. const refreshable = $derived(playlist.refreshable === true); - // System playlists atomic-replace on rebuild, so created_at - // is the last-rotated time. Surface it so users know how fresh the - // mix is. Friendly wording, not the HistoryRow "m/h ago" style. - function refreshedLabel(iso: string): string { - const t = new Date(iso); - if (Number.isNaN(t.getTime())) return ''; - const now = new Date(); - const mins = Math.floor((now.getTime() - t.getTime()) / 60000); - if (mins < 5) return 'Refreshed just now'; - const startOfToday = new Date(now); - startOfToday.setHours(0, 0, 0, 0); - const days = Math.floor((startOfToday.getTime() - t.getTime()) / 86400000) + 1; - if (t.getTime() >= startOfToday.getTime()) return 'Refreshed today'; - if (days <= 1) return 'Refreshed yesterday'; - if (days < 7) return `Refreshed ${days} days ago`; - return `Refreshed ${t.toLocaleDateString(undefined, { month: 'short', day: 'numeric' })}`; - } const refreshed = $derived( playlist.system_variant != null ? refreshedLabel(playlist.created_at) : '' ); + // The covers this tile shows, as the shelf assigned them. The first is the + // lead: the card's picture and the source of its colour wash. + const coverUrls = $derived(covers.map((id) => coverUrl(id))); + const lead = $derived(coverUrls[0] ?? playlist.cover_url ?? ''); + + // The wash behind a wide card or band is the lead cover's main colour, + // darkened so light text reads on it in either theme. Until the colour is + // known (or when there is no cover) the wash is a neutral slate. + let washRgb = $state('rgb(44 49 58)'); + $effect(() => { + if (shape !== 'wide' && shape !== 'band') return; + const url = lead; + if (!url) return; + dominantColorFromUrl(url).then((rgb) => { + if (rgb && url === lead) washRgb = rgbToCssString(rgb); + }); + }); + + const subline = $derived( + playlist.kind === 'system' && playlist.description + ? playlist.description + : plural(playlist.track_count, 'track', 'tracks') + (isOwn ? '' : ` · by ${playlist.owner_username}`) + ); + const queryClient = useQueryClient(); let starting = $state(false); @@ -137,7 +165,7 @@ { menuOpen = false; }} /> -
+{#snippet kebab()} {#if refreshable} @@ -178,6 +206,99 @@ {/if}
{/if} +{/snippet} + +{#snippet playButton(extra: string)} + +{/snippet} + +{#snippet leadArt(rounded: string)} + {#if lead} + + {:else} +
+ No tracks yet +
+ {/if} +{/snippet} + +{#if shape === 'wide'} + + +{:else if shape === 'round'} + + +{:else if shape === 'band'} + + +{:else} +
+ {@render kebab()}
+{/if} + diff --git a/web/src/lib/components/PlaylistCard.test.ts b/web/src/lib/components/PlaylistCard.test.ts index 8e2725d9..a23cdc63 100644 --- a/web/src/lib/components/PlaylistCard.test.ts +++ b/web/src/lib/components/PlaylistCard.test.ts @@ -75,6 +75,11 @@ vi.mock('#lib/api/playlists.js', () => ({ refreshSystem: vi.fn().mockResolvedValue({ playlist_id: 'p-1', track_count: 5, track_ids: ['t-1'] }) })); +vi.mock('#lib/media/dominantColor.js', () => ({ + dominantColorFromUrl: vi.fn().mockResolvedValue({ r: 90, g: 40, b: 130 }), + rgbToCssString: ({ r, g, b }: { r: number; g: number; b: number }) => `rgb(${r} ${g} ${b})` +})); + vi.mock('#lib/player/store.svelte.js', () => ({ playQueue: vi.fn() })); @@ -335,4 +340,56 @@ describe('PlaylistCard', () => { expect(getPlaylist).toHaveBeenCalledWith('p-1'); expect(playQueue).toHaveBeenCalled(); }); + + describe('home shelf shapes', () => { + const mix: Playlist = { + ...base, + name: 'For You', + kind: 'system', + system_variant: 'for_you', + refreshable: true, + description: 'Built around the songs you play most', + cover_url: '/api/playlists/p-1/cover' + }; + + test('a wide card shows its lead album, not the collage, and says what the mix is built from', () => { + const { container } = render(PlaylistCard, { props: { playlist: mix, shape: 'wide', covers: ['al-7'] } }); + expect(container.querySelector('[data-shape="wide"] img')!.getAttribute('src')).toBe('/api/albums/al-7/cover'); + expect(screen.getByText('Built around the songs you play most')).toBeInTheDocument(); + expect(screen.getByRole('button', { name: 'Play For You' })).toBeInTheDocument(); + }); + + test("a wide card for someone's own playlist shows its size instead", () => { + render(PlaylistCard, { props: { playlist: base, shape: 'wide' } }); + expect(screen.getByText(/12\s+tracks/)).toBeInTheDocument(); + }); + + test('a wide card takes the colour of its lead cover', async () => { + const { container } = render(PlaylistCard, { props: { playlist: mix, shape: 'wide', covers: ['al-7'] } }); + const card = container.querySelector('[data-shape="wide"] a') as HTMLElement; + await waitFor(() => expect(card.style.getPropertyValue('--wash')).toBe('rgb(90 40 130)')); + }); + + test('the shelf heading can carry the refresh line instead of the tile', () => { + render(PlaylistCard, { + props: { playlist: { ...mix, created_at: new Date().toISOString() }, shape: 'wide', showMeta: false } + }); + expect(screen.queryByText(/Refreshed/)).toBeNull(); + }); + + test('a Songs like circle is labelled by its artist', () => { + const sl: Playlist = { ...base, name: 'Songs like Low Tide Choir', kind: 'system', system_variant: 'songs_like_artist' }; + const { container } = render(PlaylistCard, { props: { playlist: sl, shape: 'round', covers: ['al-2'] } }); + expect(screen.getByText('Low Tide Choir')).toBeInTheDocument(); + expect(container.querySelector('[data-shape="round"] .rounded-full img')!.getAttribute('src')).toBe('/api/albums/al-2/cover'); + }); + + test('a genre band names the genre and fans out the covers it was given', () => { + const g: Playlist = { ...base, name: 'Jazz mix', kind: 'system', system_variant: 'genre_mix' }; + const { container } = render(PlaylistCard, { props: { playlist: g, shape: 'band', covers: ['a', 'b', 'c'] } }); + expect(screen.getByText('Jazz')).toBeInTheDocument(); + const fan = Array.from(container.querySelectorAll('.fan img')).map((i) => i.getAttribute('src')); + expect(fan).toEqual(['/api/albums/a/cover', '/api/albums/b/cover', '/api/albums/c/cover']); + }); + }); }); diff --git a/web/src/lib/components/PlaylistPlaceholderCard.svelte b/web/src/lib/components/PlaylistPlaceholderCard.svelte index 090b8539..7771a5fe 100644 --- a/web/src/lib/components/PlaylistPlaceholderCard.svelte +++ b/web/src/lib/components/PlaylistPlaceholderCard.svelte @@ -3,12 +3,16 @@ let { label, - variant = 'pending' + variant = 'pending', + shape = 'square' }: { /** Card title (e.g. "For You" or "Songs like…"). */ label: string; /** Drives copy + animation. */ variant?: 'building' | 'failed' | 'pending' | 'seed-needed'; + /** Matches the shelf it stands in for, so a mix arriving does not + change the shelf's shape (see PlaylistCard's shapes). */ + shape?: 'square' | 'wide' | 'round'; } = $props(); const copy = $derived.by(() => { @@ -30,12 +34,35 @@ ); -
-
- +{#if shape === 'wide'} +
+
+ +
+
+
{label}
+
{copy}
+
-
-
{label}
-
{copy}
+{:else} +
+
+ +
+
+
{label}
+
{copy}
+
-
+{/if} diff --git a/web/src/lib/playlists/shelf.test.ts b/web/src/lib/playlists/shelf.test.ts new file mode 100644 index 00000000..98d0d9d2 --- /dev/null +++ b/web/src/lib/playlists/shelf.test.ts @@ -0,0 +1,98 @@ +import { describe, expect, test } from 'vitest'; +import type { Playlist } from '#lib/api/types.js'; +import { assignShelfCovers, refreshedLabel, shelfMeta, songsLikeArtist } from './shelf.js'; + +function pl(over: Partial): Playlist { + return { + id: 'p', + user_id: 'u', + owner_username: 'me', + name: 'Mix', + description: '', + is_public: false, + kind: 'system', + system_variant: 'for_you', + refreshable: true, + seed_artist_id: null, + cover_url: '', + track_count: 100, + duration_sec: 0, + created_at: '2026-11-23T08:00:00Z', + updated_at: '2026-11-23T08:00:00Z', + ...over + }; +} + +describe('assignShelfCovers', () => { + test('each tile takes the first album no earlier tile shows', () => { + const got = assignShelfCovers( + [ + pl({ cover_album_ids: ['a', 'b', 'c'] }), + pl({ cover_album_ids: ['a', 'd'] }), + pl({ cover_album_ids: ['a', 'd', 'e'] }) + ], + 1 + ); + expect(got).toEqual([['a'], ['d'], ['e']]); + }); + + test('a band takes three unused albums', () => { + const got = assignShelfCovers( + [pl({ cover_album_ids: ['a', 'b', 'c', 'd'] }), pl({ cover_album_ids: ['b', 'c', 'e', 'f', 'g'] })], + 3 + ); + expect(got).toEqual([['a', 'b', 'c'], ['e', 'f', 'g']]); + }); + + test('a tile whose albums are all taken reuses its own rather than showing nothing', () => { + const got = assignShelfCovers([pl({ cover_album_ids: ['a'] }), pl({ cover_album_ids: ['a'] })], 1); + expect(got).toEqual([['a'], ['a']]); + }); + + test('a playlist with no cover albums gets none', () => { + expect(assignShelfCovers([pl({})], 1)).toEqual([[]]); + }); +}); + +describe('shelfMeta', () => { + const now = new Date('2026-11-23T15:00:00Z'); + + test('equal sizes and the same refresh read as one line', () => { + const mixes = [pl({ track_count: 25 }), pl({ track_count: 25 })]; + expect(shelfMeta(mixes, now)).toBe('25 songs each · refreshed today'); + }); + + test('sizes within a tenth of each other read as "about"', () => { + const mixes = [95, 97, 99, 100].map((n) => pl({ track_count: n })); + expect(shelfMeta(mixes, now)).toBe('About 100 songs each · refreshed today'); + }); + + test('sizes that differ widely are left to the tiles', () => { + const mixes = [pl({ track_count: 20 }), pl({ track_count: 100 })]; + expect(shelfMeta(mixes, now)).toBe('Refreshed today'); + }); + + test('user playlists do not count, and a shelf of only them says nothing', () => { + const mine = pl({ kind: 'user', system_variant: null, track_count: 3, created_at: '2025-01-01T00:00:00Z' }); + expect(shelfMeta([mine], now)).toBe(''); + expect(shelfMeta([pl({ track_count: 50 }), mine], now)).toBe('50 songs each · refreshed today'); + }); + + test('different refresh days are not summarised', () => { + const mixes = [pl({}), pl({ created_at: '2026-11-20T08:00:00Z' })]; + expect(shelfMeta(mixes, now)).toBe('100 songs each'); + }); +}); + +describe('refreshedLabel', () => { + test('yesterday and older', () => { + const now = new Date('2026-11-23T12:00:00'); + expect(refreshedLabel('2026-11-22T12:00:00', now)).toBe('Refreshed yesterday'); + expect(refreshedLabel('2026-11-20T12:00:00', now)).toBe('Refreshed 4 days ago'); + }); +}); + +test('songsLikeArtist drops the shelf-wide prefix', () => { + expect(songsLikeArtist(pl({ name: 'Songs like Low Tide Choir' }))).toBe('Low Tide Choir'); + expect(songsLikeArtist(pl({ name: 'Something else' }))).toBe('Something else'); +}); diff --git a/web/src/lib/playlists/shelf.ts b/web/src/lib/playlists/shelf.ts new file mode 100644 index 00000000..bb30f5dd --- /dev/null +++ b/web/src/lib/playlists/shelf.ts @@ -0,0 +1,72 @@ +// What a home shelf of playlist tiles shows: which album covers each tile +// gets, and the one line of facts the shelf's tiles share. +import type { Playlist } from '#lib/api/types.js'; + +// Each tile takes the first of its playlist's cover albums that no tile +// before it on the shelf already shows, so a shelf never repeats a cover +// while a tile still has an unused one. A tile whose albums are all taken +// reuses its own first albums rather than showing nothing. `perTile` is +// how many covers a tile shows (one for a card, three for a genre band). +export function assignShelfCovers(playlists: Playlist[], perTile: number): string[][] { + const used = new Set(); + return playlists.map((p) => { + const own = p.cover_album_ids ?? []; + const fresh = own.filter((id) => !used.has(id)).slice(0, perTile); + const picked = fresh.length > 0 ? fresh : own.slice(0, perTile); + for (const id of picked) used.add(id); + return picked; + }); +} + +// System playlists are rebuilt in place, so created_at is when the mix was +// last refreshed. Worded for a person, not as "3h ago". +export function refreshedLabel(iso: string, now: Date = new Date()): string { + const t = new Date(iso); + if (Number.isNaN(t.getTime())) return ''; + const mins = Math.floor((now.getTime() - t.getTime()) / 60000); + if (mins < 5) return 'Refreshed just now'; + const startOfToday = new Date(now); + startOfToday.setHours(0, 0, 0, 0); + if (t.getTime() >= startOfToday.getTime()) return 'Refreshed today'; + const days = Math.floor((startOfToday.getTime() - t.getTime()) / 86400000) + 1; + if (days <= 1) return 'Refreshed yesterday'; + if (days < 7) return `Refreshed ${days} days ago`; + return `Refreshed ${t.toLocaleDateString(undefined, { month: 'short', day: 'numeric' })}`; +} + +// The facts every system mix on a shelf has in common, said once beside the +// shelf's title instead of under each tile: their size when it is about the +// same, and when they were refreshed when that is the same. Empty when the +// mixes share nothing worth saying. User playlists are left out: their sizes +// and ages are their own. +export function shelfMeta(playlists: Playlist[], now: Date = new Date()): string { + const mixes = playlists.filter((p) => p.kind === 'system'); + if (mixes.length === 0) return ''; + const parts: string[] = []; + + const counts = mixes.map((p) => p.track_count).sort((a, b) => a - b); + const lo = counts[0]; + const hi = counts[counts.length - 1]; + if (lo === hi) { + parts.push(`${lo} ${lo === 1 ? 'song' : 'songs'} each`); + } else if (hi - lo <= hi * 0.1) { + // Close enough to read as one size: round the middle to a friendly 5. + const mid = counts[Math.floor(counts.length / 2)]; + parts.push(`about ${Math.max(5, Math.round(mid / 5) * 5)} songs each`); + } + + const labels = new Set(mixes.map((p) => refreshedLabel(p.created_at, now))); + if (labels.size === 1) { + const [label] = labels; + if (label) parts.push(label.toLowerCase()); + } + + const line = parts.join(' · '); + return line.charAt(0).toUpperCase() + line.slice(1); +} + +// "Songs like Low Tide Choir" → "Low Tide Choir": a Songs like tile labels +// the artist under its circle, so the prefix would only repeat the shelf. +export function songsLikeArtist(p: Playlist): string { + return p.name.replace(/^Songs like\s+/i, ''); +} diff --git a/web/src/routes/+page.svelte b/web/src/routes/+page.svelte index 1cbd9d35..8a0919c2 100644 --- a/web/src/routes/+page.svelte +++ b/web/src/routes/+page.svelte @@ -12,6 +12,7 @@ import { createPlaylistsQuery } from '#lib/api/playlists.js'; import { createSystemPlaylistsStatusQuery } from '#lib/api/me.js'; import type { Playlist } from '#lib/api/types.js'; + import { assignShelfCovers, shelfMeta } from '#lib/playlists/shelf.js'; const queryStore = createHomeQuery(); const query = $derived($queryStore); @@ -132,6 +133,21 @@ return out; }); + // Each shelf gives its tiles covers no earlier tile on it shows, and says + // once, in its heading, what every mix on it shares. + const realPlaylists = $derived( + playlistsRow.flatMap((it) => (it.kind === 'real' ? [it.playlist] : [])) + ); + const playlistsCovers = $derived(new Map( + assignShelfCovers(realPlaylists, 1).map((c, i) => [realPlaylists[i].id, c]) + )); + const songsLikeCovers = $derived(new Map( + assignShelfCovers(songsLikePlaylists, 1).map((c, i) => [songsLikePlaylists[i].id, c]) + )); + const genreCovers = $derived(new Map( + assignShelfCovers(genreMixPlaylists, 3).map((c, i) => [genreMixPlaylists[i].id, c]) + )); + // Dedicated Songs-like row: every generated "Songs like {artist}" // mix — the best-performing surface, promoted out of the Playlists // carousel to show a wider spread. Shows a few placeholders while the @@ -155,22 +171,27 @@ {pageTitle('Home')}
- +
{#snippet item(rowItem: PlaylistRowItem)} - -
+ +
{#if rowItem.kind === 'real'} - + {:else} - + {/if}
{/snippet} @@ -184,14 +205,22 @@ {#snippet item(rowItem: PlaylistRowItem)} -
+ +
{#if rowItem.kind === 'real'} - + {:else} - + {/if}
{/snippet} @@ -206,11 +235,18 @@ {#snippet item(playlist: Playlist)} -
- + +
+
{/snippet} diff --git a/web/src/routes/page.test.ts b/web/src/routes/page.test.ts index 0dc45657..d0d46b8a 100644 --- a/web/src/routes/page.test.ts +++ b/web/src/routes/page.test.ts @@ -142,14 +142,15 @@ describe('home Playlists section', () => { ); const { container } = render(Page); - for (let i = 0; i < 6; i++) { - expect(screen.getByText(`Songs like ${i}`)).toBeInTheDocument(); - } - // The mixes live in the Songs-like row, not the Playlists carousel. - const playlistsSection = container.querySelector('[aria-label="Playlists"]') as HTMLElement; - expect(within(playlistsSection).queryByText('Songs like 0')).toBeNull(); + // The mixes live in the Songs-like row, not the Playlists carousel. Each + // circle is labelled by its artist; its play button names the whole mix. const songsSection = container.querySelector('[aria-label="Songs like"]') as HTMLElement; - expect(within(songsSection).getByText('Songs like 0')).toBeInTheDocument(); + for (let i = 0; i < 6; i++) { + expect(within(songsSection).getByRole('button', { name: `Play Songs like ${i}` })).toBeInTheDocument(); + } + expect(songsSection.querySelectorAll('[data-shape="round"]')).toHaveLength(6); + const playlistsSection = container.querySelector('[aria-label="Playlists"]') as HTMLElement; + expect(within(playlistsSection).queryByRole('button', { name: 'Play Songs like 0' })).toBeNull(); // No placeholders once real mixes exist. expect(within(songsSection).queryByTestId('playlist-placeholder-card')).toBeNull(); }); @@ -187,12 +188,14 @@ describe('home Playlists section', () => { const genres = container.querySelector('[aria-label="Your genres"]') as HTMLElement; expect(genres).not.toBeNull(); + // Each band shows the genre; its play button names the whole mix. const names = within(genres) - .getAllByText(/ mix$/) - .map((el) => el.textContent?.trim()); - expect(names).toEqual(['Dub mix', 'Jazz mix', 'Shoegaze mix']); + .getAllByRole('button', { name: /^Play / }) + .map((el) => el.getAttribute('aria-label')); + expect(names).toEqual(['Play Dub mix', 'Play Jazz mix', 'Play Shoegaze mix']); + expect(genres.querySelectorAll('[data-shape="band"]')).toHaveLength(3); const playlistsSection = container.querySelector('[aria-label="Playlists"]') as HTMLElement; - expect(within(playlistsSection).queryByText('Jazz mix')).toBeNull(); + expect(within(playlistsSection).queryByRole('button', { name: 'Play Jazz mix' })).toBeNull(); }); test('Your genres row is absent until a genre mix exists', () => {