const assert=require('node:assert/strict'); module.exports=async({page,go,shot})=>{ await go('/tasks'); const base=new URL(page.url()).origin; const tasks=await (await page.request.get(base+'/api/tasks')).json(); const task=tasks.find(t=>t.status==='parked' && t.attempt>0); assert.ok(task,'seeded stack has no parked attempt to inspect'); const state=await (await page.request.get(`${base}/api/tasks/${task.id}/attempts`)).json(); assert.ok(state.attempts.some(a=>a.attempt===state.current_attempt),'claimed current attempt missing'); await go(`/tasks/${task.id}`); assert.equal(await page.getByText(`Attempt ${state.current_attempt} is not recorded`,{exact:true}).count(),0); const logs=await (await page.request.get(`${base}/api/tasks/${task.id}/logs?attempt=${state.current_attempt}&level=ERROR&limit=1`)).json(); await page.getByRole('button',{name:'Jump to log line',exact:true}).click(); if(logs.entries?.[0]?.id){ await page.locator(`[data-row-key="${logs.entries[0].id}"]`).waitFor(); await page.waitForFunction(id=>document.activeElement?.getAttribute('data-row-key')===String(id),logs.entries[0].id); }else{ await page.getByText('No error log line was recorded for this attempt.',{exact:true}).waitFor(); } await shot('attempt'); };