fix block strategy

If an element was blocked, its child nodes should also be blocked.
The interactions and mutations on the element and its child nodes
also need to be blocked.
This commit is contained in:
Yanzhen Yu
2018-12-30 21:46:23 +08:00
parent e563dc1638
commit 8f24cb78b3
5 changed files with 256 additions and 6 deletions

View File

@@ -252,4 +252,22 @@ describe('record integration tests', () => {
);
assert(result.pass, result.pass ? '' : result.report());
});
it('should not record blocked elements and its child nodes', async () => {
const page: puppeteer.Page = await this.browser.newPage();
await page.goto('about:blank');
await page.setContent(getHtml.call(this, 'block.html'));
await page.type('input', 'should not be record');
await page.evaluate(`document.getElementById('text').innerText = '1'`);
await page.click('#text');
const snapshots = await page.evaluate('window.snapshots');
const result = matchSnapshot(
stringifySnapshots(snapshots),
__filename,
'block',
);
assert(result.pass, result.pass ? '' : result.report());
});
});