(page: Page)
| 186 | } |
| 187 | |
| 188 | export async function clickGenerate(page: Page) { |
| 189 | // Wait for full page load (including hydration scripts) |
| 190 | await page.waitForLoadState('networkidle') |
| 191 | const btn = page.getByTestId('generate-button') |
| 192 | await btn.click() |
| 193 | // Verify the click actually triggered React — status should leave 'idle' |
| 194 | // If still idle after a short wait, the click missed hydration; retry |
| 195 | try { |
| 196 | await expect(page.getByTestId('generation-status')).not.toHaveText('idle', { |
| 197 | timeout: 3_000, |
| 198 | }) |
| 199 | } catch { |
| 200 | // Retry click — hydration likely wasn't complete on first attempt |
| 201 | await btn.click() |
| 202 | } |
| 203 | } |
| 204 | |
| 205 | export async function waitForGenerationComplete(page: Page, timeout = 30_000) { |
| 206 | await expect(page.getByTestId('generation-status')).toHaveText('complete', { |
no outgoing calls
no test coverage detected