Tests: two people on one file, each with their own DeadAir version, place and playlist
The DeadAir tests named for each person's clock used one account. Now three play one file at
once (DeadAir at two pauses, and the original) and each keeps their own place; and two fetch
the same /media/{id}/deadair.m3u8 at once and each gets their own playlist, no-store.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1936,6 +1936,36 @@ test('DeadAir is off until turned on for a show, then plays it shortened, with y
|
||||
await page.locator('#ssave').click();
|
||||
await expect.poll(async () => (await entry()).enclosures[0].deadair).toBeLessThan(usual);
|
||||
|
||||
// Someone else on the same show at the usual pause, at the same address at the same time: one
|
||||
// file on disk, a playlist each, and neither kept by a cache to be handed to the other.
|
||||
{
|
||||
const { execFileSync } = require('child_process');
|
||||
const setup = require('./global-setup');
|
||||
const env = { ...process.env, IPX_CONFIG: `${setup.root}/config/config.toml`, IPX_DATA_DIR: `${setup.root}/data` };
|
||||
try { execFileSync('./target/debug/ipx', ['user', 'add', 'quinn'], { input: 'quinnpassword', env }); }
|
||||
catch (e) { if (!String(e.stderr || e.stdout).includes('already exists')) throw e; }
|
||||
const ctx = await page.context().browser().newContext();
|
||||
const quinn = await ctx.newPage();
|
||||
await quinn.goto('/login');
|
||||
await quinn.locator('#name').fill('quinn');
|
||||
await quinn.locator('#pw').fill('quinnpassword');
|
||||
await quinn.locator('button[type=submit]').click();
|
||||
await expect(quinn.locator('#feedlist')).toBeVisible();
|
||||
await quinn.request.post('/api/feeds', { data: { url: 'http://127.0.0.1:8792/quiet.xml' } });
|
||||
await quinn.request.patch(`/api/feeds/${encodeURIComponent(id)}`, { data: { deadair: true } });
|
||||
const enc = (await entry()).enclosures[0].id;
|
||||
const fetchList = async p => { const r = await p.request.get(`/media/${enc}/deadair.m3u8`);
|
||||
return { status: r.status(), cache: r.headers()['cache-control'], body: await r.text() }; };
|
||||
const [mine, theirs] = await Promise.all([fetchList(page), fetchList(quinn)]);
|
||||
const length = l => l.body.match(/#EXTINF:([\d.]+)/g).reduce((s, x) => s + Number(x.slice(8)), 0);
|
||||
expect([mine.status, theirs.status]).toEqual([200, 200]);
|
||||
expect([mine.cache, theirs.cache]).toEqual(['no-store', 'no-store']);
|
||||
expect(mine.body).not.toBe(theirs.body);
|
||||
expect(length(theirs), 'the usual pause cuts more than the longer one').toBeLessThan(length(mine));
|
||||
await quinn.request.delete(`/api/feeds/${encodeURIComponent(id)}`);
|
||||
await ctx.close();
|
||||
}
|
||||
|
||||
// Saved without its dead air too (#186): smaller than the original, named to say so.
|
||||
const saved = await page.evaluate(async id => {
|
||||
const [d, o, p] = await Promise.all([fetch(`/media/${id}/deadair`), fetch(`/media/${id}`), fetch(`/media/${id}/deadair.mp3`, { headers: { Range: 'bytes=0-99' } })]);
|
||||
|
||||
Reference in New Issue
Block a user