Check the live import test on the page, not the player stores

The live test waited for the notices after Choose and Retry unmatched in the
imports store and read the playlist titles from the library store. It now
waits for the visible status notices and reads the titles of the rendered
playlist rows. Against an instance that already has an administrator it
stops at once with an explanation instead of a 30-second timeout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
sanapachandClaude Opus 5.5 committed 2026-11-26 20:31:06 +02:00
1 parent 6dc547e66e
commit f1443948d8
1 file changed
+5 -4
+5 -4
View File
@@ -92,6 +92,7 @@ const exportZip=Buffer.from(fflate.zipSync(Object.fromEntries(Object.entries(exp
// Administrator and library: exact matches, a remaster-only-on-one-side doubt, the rest missing.
await page.goto(base+'/admin/setup');
assert.equal(await page.locator('[name=confirm_password]').count(),1,'the instance already has an administrator; start a fresh one');
await page.locator('[name=username]').fill('importer');
await page.locator('[name=password]').fill('library-import-password');
await page.locator('[name=confirm_password]').fill('library-import-password');
@@ -178,8 +179,8 @@ const exportZip=Buffer.from(fflate.zipSync(Object.fromEntries(Object.entries(exp
await page.locator('.import-playlists a',{hasText:'Road trip'}).click();
await view('playlist_detail');assert.ok(page.url().endsWith(`#playlist/${targets['Road trip']}`));
await page.waitForFunction(()=>Alpine.store('library').currentPlaylist?.tracks?.length===2);
assert.equal(await page.locator('.playlist-track-row').count(),2);
assert.deepEqual(await page.evaluate(()=>Alpine.store('library').currentPlaylist.tracks.map(entry=>entry.title)),['Paranoid Android','Teardrop']);
const rowTitles=page.locator('.playlist-track-row .track-title');
assert.deepEqual((await rowTitles.allInnerTexts()).map(text=>text.trim()),['Paranoid Android','Teardrop']);
await page.goBack();await view('import_detail');await page.locator('.import-item').first().waitFor();
// Filters list the unmatched and unsupported entries.
@@ -199,7 +200,7 @@ const exportZip=Buffer.from(fflate.zipSync(Object.fromEntries(Object.entries(exp
const candidate=page.locator('.import-candidate',{hasText:'Come Together'}).first();
await candidate.getByText('Abbey Road',{exact:false}).waitFor();
await candidate.getByRole('button',{name:'Choose'}).click();
await page.waitForFunction(()=>Alpine.store('imports').message==='The track will be added to the playlist.');
await page.getByRole('status').filter({hasText:'The track will be added to the playlist.'}).waitFor();
const chosen=posts.find(post=>/\/items\/\d+\/match$/.test(post.path));assert.deepEqual(JSON.parse(chosen.body),{candidate:0});
const afterChoice=(await waitDone(id)).statistics;
assert.equal(afterChoice.ambiguous,0);assert.equal(afterChoice.matched_local,6);assert.equal(afterChoice.published,5);
@@ -226,7 +227,7 @@ const exportZip=Buffer.from(fflate.zipSync(Object.fromEntries(Object.entries(exp
const panel=page.locator('#import-retry-panel');await panel.waitFor();
assert.equal(await panel.getByRole('switch').isDisabled(),true);
await panel.getByRole('button',{name:'Retry',exact:true}).click();
await page.waitForFunction(()=>Alpine.store('imports').message==='Unmatched tracks will be searched again.');
await page.getByRole('status').filter({hasText:'Unmatched tracks will be searched again.'}).waitFor();
const retry=posts.find(post=>post.path===`/api/imports/${id}/resync`);assert.ok(retry,'Retry unmatched was not sent');
const afterRetry=(await waitDone(id)).statistics;
assert.equal(afterRetry.unmatched,2);assert.equal(afterRetry.matched_local,7);assert.equal(afterRetry.published,6);