One place to get an episode's file where you are (#457)
Getting an episode onto a phone took two buttons in two states: download it to the server, wait, then keep it on the device, beside Save to this computer, Share and Delete, five buttons that did not say where each copy went. Now a file has one button that brings it to where you are. On a phone or in the iOS app it ends on the device; when iPX has not got the file yet, iPX fetches it and the device's copy follows once iPX says it is done (remembered in localStorage, so a page closed meanwhile catches up when a list next shows the file). On a computer it has iPX fetch the file, and with iPX's copy there saves one. A line beside the size says where the file is, and the rarer actions, two of them destructive, are under a menu. isPlayable is false for any file not on iPX, so the phone's button is decided by playsKind, the same test without the path. download_done now marks the file as on iPX in what the page holds, so the open file's box changes at once rather than after the list is fetched again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RqkrVA8TdTxe556JB3sR1n
This commit is contained in:
@@ -146,12 +146,17 @@ test('an episode kept on the device plays from it offline, and its place waits t
|
||||
await page.locator('.ep', { hasText: 'Listen on a Plane' }).click();
|
||||
};
|
||||
await open();
|
||||
const keep = page.locator('#files [data-a="offline"]');
|
||||
// Kept by its menu on a computer; the line in its box says where it is (#457).
|
||||
const where = page.locator('#files .encbox .meta');
|
||||
const menu = async (m: string) => {
|
||||
await page.locator('#files .encbox [data-a="more"]').last().click();
|
||||
await page.locator(`#modalCard [data-m="${m}"]`).click();
|
||||
};
|
||||
const row = page.locator('.ep', { hasText: 'Listen on a Plane' });
|
||||
await expect(keep).toHaveAttribute('aria-pressed', 'false');
|
||||
await expect(where).toHaveText(/On iPX$/);
|
||||
await expect(row.locator('.kept')).toHaveCount(0);
|
||||
await keep.click();
|
||||
await expect(keep).toHaveAttribute('aria-pressed', 'true', { timeout: 15_000 });
|
||||
await menu('offline');
|
||||
await expect(where).toHaveText(/On iPX and this device$/, { timeout: 15_000 });
|
||||
expect(await cacheSize(page, 'ipx-episodes')).toBe(1);
|
||||
// Its row in the list says so too (#413).
|
||||
await expect(row.locator('.kept')).toHaveText('On this device');
|
||||
@@ -160,7 +165,7 @@ test('an episode kept on the device plays from it offline, and its place waits t
|
||||
await page.reload();
|
||||
await open();
|
||||
// Still kept, as the page reads it from the cache at start.
|
||||
await expect(keep).toHaveAttribute('aria-pressed', 'true');
|
||||
await expect(where).toHaveText(/On iPX and this device$/);
|
||||
await expect(row.locator('.kept')).toBeVisible();
|
||||
await page.locator('#files [data-a="play"]').click();
|
||||
await expect.poll(() => page.evaluate(() => audio.currentTime), { timeout: 15_000 }).toBeGreaterThan(0.3);
|
||||
@@ -180,8 +185,8 @@ test('an episode kept on the device plays from it offline, and its place waits t
|
||||
expect((await call(page, `/api/entries/${encodeURIComponent(id)}/offline-ep-1`)).position).toBeGreaterThanOrEqual(0);
|
||||
|
||||
// Taken off the device again.
|
||||
await keep.click();
|
||||
await expect(keep).toHaveAttribute('aria-pressed', 'false');
|
||||
await menu('offline');
|
||||
await expect(where).toHaveText(/On iPX$/);
|
||||
expect(await cacheSize(page, 'ipx-episodes')).toBe(0);
|
||||
await expect(row.locator('.kept')).toHaveCount(0);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user