(page: Page)
| 209 | * Get all messages as parsed JSON from the debug panel |
| 210 | */ |
| 211 | export async function getMessages(page: Page): Promise<any[]> { |
| 212 | const messagesJson = page.locator('pre').filter({ hasText: '"role"' }).first() |
| 213 | |
| 214 | try { |
| 215 | const jsonText = await messagesJson.textContent({ timeout: 5000 }) |
| 216 | if (jsonText) { |
| 217 | return JSON.parse(jsonText) |
| 218 | } |
| 219 | } catch { |
| 220 | // Return empty array if parsing fails |
| 221 | } |
| 222 | |
| 223 | return [] |
| 224 | } |
| 225 | |
| 226 | /** |
| 227 | * Check if the last message has tool calls |
no test coverage detected