test: further fixes to snapshotter tests (#9633)

This commit is contained in:
Andrey Lushnikov 2021-10-19 17:26:57 -07:00 committed by GitHub
parent dddf70cead
commit f29ff86344
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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('<BUTTON __playwright_target__=\"snapshot\">Hello</BUTTON><BUTTON>World</BUTTON>');
expect(distillSnapshot(snapshot)).toBe('<BUTTON>Hello</BUTTON><BUTTON>World</BUTTON>');
}
{
const handle = await page.$('text=World');
const snapshot = await snapshotter.captureSnapshot(toImpl(page), 'snapshot2', toImpl(handle));
expect(distillSnapshot(snapshot)).toBe('<BUTTON __playwright_target__=\"snapshot\">Hello</BUTTON><BUTTON __playwright_target__=\"snapshot2\">World</BUTTON>');
expect(distillSnapshot(snapshot)).toBe('<BUTTON>Hello</BUTTON><BUTTON>World</BUTTON>');
}
});
@ -192,7 +192,7 @@ function distillSnapshot(snapshot) {
.replace(/<HTML>/, '')
.replace(/<\/HTML>/, '')
.replace(/<HEAD>/, '')
.replace(/\s__playwright_target__="[^"]+"/, '')
.replace(/\s__playwright_target__="[^"]+"/g, '')
.replace(/<\/HEAD>/, '')
.replace(/<BODY>/, '')
.replace(/<\/BODY>/, '').trim();