import { test, expect, callBinding } from '../support/fixtures.js'; import type { Page } from '@playwright/test'; /** * Plan 007 phase 5: `H-13` — the album page can be played from. * * The page is `explore-album-details`; there is no library-side album * detail page at all, so this catalog page is where a Play button has * to live, and what it can honestly claim depends on how much of the * album the user owns. * * What this tier adds over the component tests is that the paths * resolve to something the queue accepts. The first version of this * feature keyed the lookup on recording MBIDs — which is how the * backend decides a track is `inLibrary` — and a library-only album has * none, so Play was wired, labelled correctly, clicked cleanly and * queued **nothing**. Every component test still passed. */ // There is no test for the tracklist legend, and there should not be: // `dcc40b1` inverted the mark — rows *not* in the library are dimmed in // place and nothing marks the ones that are — and deleted // `.tracklist-legend` with it. The spec asserting it survived that // commit and has been failing on main ever since. What replaced it // (the dimming, and the `aria-disabled` that carries it to anyone not // seeing the page) is covered at the component tier, in // frontend/test/components/album-actions.test.ts. test.describe('playing an album from its page', () => { test.beforeEach(async ({ app }) => { await openFirstAlbum(app); }); test.afterEach(async ({ app }) => { // The suite shares one backend process in file order, and a queue // left full is state the next spec did not ask for. await callBinding(app, 'queue.Queue.Clear', []); await app.getByTestId('nav-tracks').click(); }); test('Play queues what the user owns of it', async ({ app }) => { const play = app .locator('explore-album-details') .locator('[data-testid="album-play"]'); // The fixture library is untagged, so this album is wholly local // and the button carries no count. await expect(play).toContainText('Play'); await play.click(); await expect.poll(() => queueLength(app)).toBeGreaterThan(0); }); test('Add to queue appends rather than replacing', async ({ app }) => { const details = app.locator('explore-album-details'); await details.locator('[data-testid="album-play"]').click(); await expect.poll(() => queueLength(app)).toBeGreaterThan(0); const before = await queueLength(app); await details.locator('[data-testid="album-queue"]').click(); await expect.poll(() => queueLength(app)).toBe(before * 2); }); test('the ticks are badges, not keyboard stops', async ({ app }) => { // Every one of them was a