diff --git a/tests/snapshotter.spec.ts b/tests/snapshotter.spec.ts index 8807017e6a..89f8094e02 100644 --- a/tests/snapshotter.spec.ts +++ b/tests/snapshotter.spec.ts @@ -153,12 +153,12 @@ it.describe('snapshots', () => { { const handle = await page.$('text=Hello'); const snapshot = await snapshotter.captureSnapshot(toImpl(page), 'snapshot', toImpl(handle)); - expect(distillSnapshot(snapshot)).toBe(''); + expect(distillSnapshot(snapshot, false /* distillTarget */)).toBe(''); } { const handle = await page.$('text=World'); const snapshot = await snapshotter.captureSnapshot(toImpl(page), 'snapshot2', toImpl(handle)); - expect(distillSnapshot(snapshot)).toBe(''); + expect(distillSnapshot(snapshot, false /* distillTarget */)).toBe(''); } }); @@ -182,8 +182,10 @@ it.describe('snapshots', () => { }); }); -function distillSnapshot(snapshot) { - const { html } = snapshot.render(); +function distillSnapshot(snapshot, distillTarget = true) { + let { html } = snapshot.render(); + if (distillTarget) + html = html.replace(/\s__playwright_target__="[^"]+"/g, ''); return html .replace(/