| 173 | } |
| 174 | |
| 175 | export async function fillTextInput(page: Page, text: string) { |
| 176 | const input = page.getByTestId('text-input') |
| 177 | await input.click() |
| 178 | await input.fill(text) |
| 179 | await input.dispatchEvent('input', { bubbles: true }) |
| 180 | // If fill() didn't trigger React onChange, fall back to pressSequentially |
| 181 | const btn = page.getByTestId('generate-button') |
| 182 | if (await btn.isDisabled()) { |
| 183 | await input.clear() |
| 184 | await input.pressSequentially(text, { delay: 30 }) |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | export async function clickGenerate(page: Page) { |
| 189 | // Wait for full page load (including hydration scripts) |