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

Function sendMessage

testing/panel/tests/helpers.ts:83–101  ·  view source on GitHub ↗
(page: Page, message: string)

Source from the content-addressed store, hash-verified

81 * Send a message in the chat UI
82 */
83export async function sendMessage(page: Page, message: string): Promise<void> {
84 // Find the textarea input
85 const textarea = page.locator('textarea').first()
86 await textarea.waitFor({ state: 'visible' })
87
88 // Click to focus and clear any existing content
89 await textarea.click()
90 await textarea.fill('')
91
92 // Type the message character by character to properly trigger React state updates
93 await textarea.pressSequentially(message, { delay: 10 })
94
95 // Verify the input has the message
96 await textarea.waitFor({ state: 'visible' })
97
98 // Use keyboard Enter to send (more reliable than finding the button)
99 // The chat UI handles Enter key to send messages
100 await textarea.press('Enter')
101}
102
103/**
104 * Wait for the assistant response to complete

Callers 5

tool-flow.spec.tsFile · 0.90
SimulatorPageFunction · 0.50
AddonManagerPageFunction · 0.50
ChatPageFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected