( page: Page, toolName: string, timeout = 10000, )
| 201 | * the separate event-log state update used by these assertions. |
| 202 | */ |
| 203 | export async function waitForExecutionComplete( |
| 204 | page: Page, |
| 205 | toolName: string, |
| 206 | timeout = 10000, |
| 207 | ): Promise<void> { |
| 208 | await page.waitForFunction( |
| 209 | (expectedToolName) => { |
| 210 | const el = document.getElementById('event-log-json') |
| 211 | if (!el) return false |
| 212 | |
| 213 | try { |
| 214 | const events = JSON.parse(el.textContent || '[]') as Array<{ |
| 215 | type?: string |
| 216 | toolName?: string |
| 217 | }> |
| 218 | return events.some( |
| 219 | (event) => |
| 220 | event.type === 'execution-complete' && |
| 221 | event.toolName === expectedToolName, |
| 222 | ) |
| 223 | } catch { |
| 224 | return false |
| 225 | } |
| 226 | }, |
| 227 | toolName, |
| 228 | { timeout }, |
| 229 | ) |
| 230 | } |
| 231 | |
| 232 | /** |
| 233 | * Wait for the #approval-section element to become visible. |
no test coverage detected