| Error pattern | Likely cause | Recovery |
|---|---|---|
Expected image to match or be a close match to snapshot |
Real visual change or regression | Inspect the diff PNG, then decide whether to update snapshots or fix the code |
| Timeout or hanging Jest run | Selenium sessions leaked | Run python3 ./.github/skills/webchat-html-tests/scripts/cleanup-grid-sessions.py before rerunning |
Failed to load resource: 404 (Not Found) for dist files |
webchat2 serving stale or empty content |
docker compose -f docker-compose-wsl2.yml restart webchat2 |
Cannot read properties of undefined (reading 'FluentThemeProvider') |
Fluent bundle returned 404 | Restart webchat2 and confirm the local build completed |
Cannot read properties of undefined (reading 'ReactWebChat') |
Main bundle returned 404 | Restart webchat2 and confirm the local build completed |
- Reproduce the failure without
--update. - Inspect the generated
.snap-N-diff.pngfile next to the HTML test. - Only if the change is intentional, rerun with
--update. - Rerun the same test again without
--updateto confirm the snapshot is now stable. - Clean leaked Selenium sessions between runs.
Most HTML tests follow this structure:
- Load
/test-harness.jsand/test-page-object.js - Create a Direct Line emulator with
testHelpers.createDirectLineEmulator() - Drive activities with
emulateIncomingActivity()oremulateOutgoingActivity() - Assert through
pageConditionsandpageElements - Capture snapshots with
await host.snapshot('local') - Use
expect, notassert