( page: Page, )
| 99 | } |
| 100 | |
| 101 | export async function getToolCalls( |
| 102 | page: Page, |
| 103 | ): Promise<Array<{ name: string }>> { |
| 104 | const toolCalls: Array<{ name: string }> = [] |
| 105 | const elements = page.locator('[data-testid^="tool-call-"]').filter({ |
| 106 | hasNot: page.locator('[data-testid^="tool-call-result-"]'), |
| 107 | }) |
| 108 | const count = await elements.count() |
| 109 | for (let i = 0; i < count; i++) { |
| 110 | const testId = await elements.nth(i).getAttribute('data-testid') |
| 111 | if (testId && testId.startsWith('tool-call-')) { |
| 112 | toolCalls.push({ name: testId.replace('tool-call-', '') }) |
| 113 | } |
| 114 | } |
| 115 | return toolCalls |
| 116 | } |
| 117 | |
| 118 | export async function getStructuredOutput(page: Page): Promise<string> { |
| 119 | return page.getByTestId('structured-output').innerText() |
no test coverage detected