Show toasts above Service mode so the report-needs-a-profile message is visible

This commit is contained in:
Jonathan Sykes
2026-10-13 22:38:10 +08:00
parent ac7cd0555e
commit 4b65b9e376
2 changed files with 15 additions and 1 deletions

View File

@@ -81,3 +81,17 @@ for (const layout of ['classic', 'glass-stage']) for (const width of [390,1440])
await page.getByRole('button',{name:'Add current 8 s to practice',exact:true}).click();await expect(page.locator('.piano-practice button').first()).toHaveText('Loop 0.0–8.0 s');
expect(models).toEqual([]);expect(await page.locator('#settings-section-piano').evaluate(el=>el.scrollWidth<=el.clientWidth+1)).toBe(true);
});
test('Service mode report: the "link a profile" message shows above the overlay, and a linked profile opens the sheet', async ({ page }) => {
await page.setViewportSize({ width: 1440, height: 900 }); await openClassic(page);
await page.route('**/api/notes/0gfX0dFLaBc', route => route.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok:true, lyrics:{rev:1,data:{offset:0,lines:[{t:0,text:'Line one',kind:'line'},{t:5,text:'Line two',kind:'line'}]}}, chapters:null }) }));
await page.route('**/api/notes/0gfX0dFLaBc/flags*', route => route.fulfill({ contentType: 'application/json', body: '{"flags":[]}' }));
await page.evaluate(async () => { data.profile = null; current = {meta:{id:'0gfX0dFLaBc',title:'Fixture'}}; await Notes.load(current.meta); data.settings.serviceLyrics = true; $('serviceMode').classList.remove('hidden'); Notes.serviceRefresh(); });
await page.locator('#serviceFlagBtn').click({ force: true });
await page.locator('#serviceLyricsList .sl-line').nth(1).click({ force: true });
const toast = page.locator('.toast', { hasText: 'Link an online profile' });
await expect(toast).toBeVisible();
expect(await toast.evaluate(el => { const r = el.getBoundingClientRect(); const t = document.elementFromPoint(r.x + r.width / 2, r.y + r.height / 2); return el.contains(t); })).toBe(true);
await page.evaluate(() => { data.profile = { name: 'tester' }; });
await page.locator('#serviceLyricsList .sl-line').nth(1).click({ force: true });
await expect(page.locator('.fs-backdrop')).toHaveCount(1);
});