MCPcopy Create free account
hub / github.com/TanStack/ai / waitForExecutionComplete

Function waitForExecutionComplete

testing/e2e/tests/tools-test/helpers.ts:203–230  ·  view source on GitHub ↗
(
  page: Page,
  toolName: string,
  timeout = 10000,
)

Source from the content-addressed store, hash-verified

201 * the separate event-log state update used by these assertions.
202 */
203export 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.

Callers 2

Calls 1

parseMethod · 0.80

Tested by

no test coverage detected