(page: Page, text: string)
| 160 | } |
| 161 | |
| 162 | export async function fillPrompt(page: Page, text: string) { |
| 163 | const input = page.getByTestId('prompt-input') |
| 164 | await input.click() |
| 165 | await input.fill(text) |
| 166 | await input.dispatchEvent('input', { bubbles: true }) |
| 167 | // If fill() didn't trigger React onChange, fall back to pressSequentially |
| 168 | const btn = page.getByTestId('generate-button') |
| 169 | if (await btn.isDisabled()) { |
| 170 | await input.clear() |
| 171 | await input.pressSequentially(text, { delay: 30 }) |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | export async function fillTextInput(page: Page, text: string) { |
| 176 | const input = page.getByTestId('text-input') |
no test coverage detected