Smart playlists (#476)
A playlist is the episodes of the podcasts chosen, those set to play first ahead of the rest, newest or oldest first, unplayed only or all, kept up to date by itself (table `playlists`, /api/playlists). It sits in a folder of its own in the feed list, as Signals do. Played from one, an episode goes on to the playlist's next once Up Next has nothing. The priority ids are written into the ORDER BY, which the page query uses twice, so they are quoted there rather than bound; they are also only ever feed ids this person subscribes to. The folder row first borrowed Signals' `sigs` class, which the tests use to mean Signals' folder; four Signals tests failed until it had its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -58,7 +58,7 @@ test('the page loads and lists the configured feeds', async ({ page }) => {
|
||||
// empty, with every handler below the error dead. Server-side checks all passed.
|
||||
// Four top-level feeds in the fixture config; the OPML's children are inside a closed folder.
|
||||
// The Signals folder is above them, and no feed.
|
||||
await expect(page.locator('.feed:not(.sigs)')).toHaveCount(5, { timeout: 15_000 });
|
||||
await expect(page.locator('.feed:not(.sigs):not(.plists)')).toHaveCount(5, { timeout: 15_000 });
|
||||
await expect(page.locator('.feed', { hasText: 'Test Show' })).toBeVisible();
|
||||
const errors: string[] = [];
|
||||
page.on('pageerror', e => errors.push(e.message));
|
||||
@@ -507,6 +507,43 @@ test('Now Playing opens from the player bar with the artwork, show notes and Up
|
||||
await page.evaluate(() => api('/api/entries/test-show/ui-2/position', { method: 'POST', body: JSON.stringify({ secs: 0 }) }));
|
||||
});
|
||||
|
||||
test('a smart playlist puts its first podcasts ahead and plays on through itself (#476)', async ({ page }) => {
|
||||
await page.evaluate(() => saveUpNext([]));
|
||||
await page.locator('#feedlist .feed', { hasText: 'Playlists' }).click();
|
||||
await page.locator('#content .acts [data-a="new"]').click();
|
||||
await page.locator('#plname').fill('Commute');
|
||||
await page.locator('[data-in="test-show"]').check();
|
||||
await page.locator('[data-in="multi-show"]').check();
|
||||
await page.locator('[data-first="multi-show"]').check();
|
||||
await page.locator('#plunplayed').uncheck();
|
||||
await page.locator('#plsave').click();
|
||||
|
||||
const rows = page.locator('#listening .childrow .txt b');
|
||||
await expect(rows).toHaveText(['Two Files', 'Second Episode', 'First Episode']);
|
||||
await expect(page.locator('#feedlist .feed.child', { hasText: 'Commute' }).locator('.badge')).toHaveText('3');
|
||||
|
||||
// Both of Test Show's files here, whatever ran before: only a downloaded one plays next.
|
||||
const missing = async () => (await page.evaluate(() => api('/api/feeds/test-show/entries')) as ListPage).entries
|
||||
.flatMap(e => e.enclosures).filter(x => !x.path).map(x => x.id);
|
||||
for (const id of await missing()) await page.evaluate(id => api(`/api/enclosures/${id}/download`, { method: 'POST' }), id);
|
||||
await expect.poll(missing, { timeout: 20_000 }).toEqual([]);
|
||||
await page.locator('#feedlist .feed.child', { hasText: 'Commute' }).click();
|
||||
|
||||
// Played from the playlist, the end of one plays the next in it.
|
||||
await page.locator('#listening .childrow', { hasText: 'Second Episode' }).click();
|
||||
await expect(page.locator('#ptitle')).toHaveText('Second Episode');
|
||||
await expect(page.locator('#pnext')).toBeVisible();
|
||||
await page.evaluate(() => audio.dispatchEvent(new Event('ended')));
|
||||
await expect(page.locator('#ptitle')).toHaveText('First Episode');
|
||||
await page.locator('#pclose').click();
|
||||
|
||||
await page.locator('#content .acts [data-a="rm"]').click();
|
||||
await answer(page);
|
||||
await expect(page.locator('#feedlist .feed.child', { hasText: 'Commute' })).toHaveCount(0);
|
||||
for (const g of ['ui-1', 'ui-2'])
|
||||
await page.evaluate(g => api(`/api/entries/test-show/${g}/position`, { method: 'POST', body: JSON.stringify({ secs: 0 }) }), g);
|
||||
});
|
||||
|
||||
test('a player nobody has played since it last saved does not save again', async ({ page }) => {
|
||||
// A tab left paused at 41:15 saved that as it reloaded, over the 32:48 another had reached,
|
||||
// and the episode dropped out of Currently Listening. The fixture audio does not decode, so
|
||||
@@ -611,7 +648,7 @@ test('an OPML subscription is a collapsible folder', async ({ page }) => {
|
||||
const chev = page.locator('.feed.group .chev');
|
||||
await expect(chev).toBeVisible({ timeout: 20_000 });
|
||||
// The Signals folder is a folder too (#255).
|
||||
await expect(page.locator('.feed:not(.group):not(.sigs) .chev')).toHaveCount(0);
|
||||
await expect(page.locator('.feed:not(.group):not(.sigs):not(.plists) .chev')).toHaveCount(0);
|
||||
await expect(chev).toHaveAttribute('aria-expanded', 'false');
|
||||
|
||||
// Closed by default: the children are not listed until the folder is opened.
|
||||
@@ -2412,7 +2449,7 @@ test.describe('an item with no files, on a phone', () => {
|
||||
|
||||
test('a pinned feed, even one from inside a folder, goes to the top of the list', async ({ page }) => {
|
||||
// The Signals folder is first, under All Subscriptions (#256), and no feed.
|
||||
const rows = page.locator('#feedlist .feed:not(.sigs)');
|
||||
const rows = page.locator('#feedlist .feed:not(.sigs):not(.plists)');
|
||||
const group = page.locator('.feed.group').first();
|
||||
if ((await group.locator('.chev').getAttribute('aria-expanded')) !== 'true') await group.locator('.chev').click();
|
||||
const child = page.locator('.feed.child').first();
|
||||
|
||||
Reference in New Issue
Block a user