The photo check navigates the way a person does
Browse files at this commite1ca55f7cbae36af6e9b1576a11ccfe3ed73c4e4Parent: a8afcdd1 changed file +25 -0
crates/iz-web/tests/browser/photo.mjsmodified+25 -0
| @@ -186,6 +186,31 @@ if (!failures.length) { | |||
| 186 | } | 186 | } |
| 187 | } | 187 | } |
| 188 | 188 | ||
| 189 | +// The everyday path: settings arrives by soft navigation, and by the live | ||
| 190 | +// refresh's morph after it — not by document load. The swap re-creates the | ||
| 191 | +// inline scripts and the morph preserves them; either going wrong passes | ||
| 192 | +// every check above and dies for anyone who simply navigated. | ||
| 193 | +if (!failures.length) { | ||
| 194 | + await page.goto(base + '/', { waitUntil: 'networkidle' }); | ||
| 195 | + await page.click('a[href="/settings"]'); | ||
| 196 | + await page | ||
| 197 | + .waitForFunction(() => location.pathname === '/settings', { timeout: 5000 }) | ||
| 198 | + .catch(() => failures.push('the Settings nav click never soft-navigated')); | ||
| 199 | + if (!failures.length && (await openViewer('soft-nav'))) { | ||
| 200 | + await page.keyboard.press('Escape'); | ||
| 201 | + await viewerGone('soft-nav'); | ||
| 202 | + } | ||
| 203 | +} | ||
| 204 | +if (!failures.length) { | ||
| 205 | + await page.evaluate(() => window.__izRefresh()); | ||
| 206 | + // Sleeping is the measurement: the refresh lands without an event. | ||
| 207 | + await page.waitForTimeout(800); | ||
| 208 | + if (await openViewer('post-refresh')) { | ||
| 209 | + await page.keyboard.press('Escape'); | ||
| 210 | + await viewerGone('post-refresh'); | ||
| 211 | + } | ||
| 212 | +} | ||
| 213 | + | ||
| 189 | await browser.close(); | 214 | await browser.close(); |
| 190 | 215 | ||
| 191 | note(`page errors ${errors.length ? errors.join(' | ') : 'none'}`); | 216 | note(`page errors ${errors.length ? errors.join(' | ') : 'none'}`); |