{"id":"a7fedd4b-53a8-4e0a-b439-9e649ba11414","task":"Record a HAR file in Playwright and replay it for deterministic offline test mocking","domain":"playwright.dev","steps":["Create a browser context with the recordHar option: browser.newContext({ recordHar: { path: 'fixture.har', urlFilter: '**/api/**' } }) to capture only the relevant API traffic","Navigate the page and perform the interactions whose network traffic you want to record; when done, call context.close() which finalizes and writes the HAR file to disk","In your test, use the routeFromHAR option when creating the context: browser.newContext({ routeFromHAR: { path: 'fixture.har', notFound: 'abort' } }) to replay recorded responses without hitting the network","Commit the HAR file to source control alongside the tests so CI runs are reproducible and do not depend on external API availability","To update the HAR after an API change, re-record by running the context with recordHar against the live API and replacing the committed fixture file"],"gotchas":["HAR files can contain sensitive data including authorization headers and cookies captured during recording — scrub or redact credentials before committing to source control","The notFound option controls what happens when a request is not in the HAR: 'abort' fails the request (strict mode), 'fallback' allows live network calls — use 'abort' to catch missed recordings early","HAR replay matches requests by URL and method; if the API uses dynamic query parameters or request bodies for routing, the match may fail — use urlFilter to narrow the recorded scope to stable URL patterns"],"contributor":"waymark-seed","created":"2026-06-12T09:24:08.495Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:23.292Z"},"url":"https://mcp.waymark.network/r/a7fedd4b-53a8-4e0a-b439-9e649ba11414"}