resolve #1 add ignore and block strategy for privacy purpose

This commit is contained in:
Yanzhen Yu
2026-04-01 12:00:00 +08:00
parent 09f30d2a81
commit 86beabd2bb
6 changed files with 324 additions and 2 deletions

View File

@@ -230,4 +230,21 @@ describe('record integration tests', () => {
);
assert(result.pass, result.pass ? '' : result.report());
}).timeout(10000);
it('should not record input events on ignored elements', async () => {
const page: puppeteer.Page = await this.browser.newPage();
await page.goto('about:blank');
await page.setContent(getHtml.call(this, 'ignore.html'));
await page.type('input[type="password"]', 'password');
await page.type('.rr-ignore', 'secret');
const snapshots = await page.evaluate('window.snapshots');
const result = matchSnapshot(
stringifySnapshots(snapshots),
__filename,
'ignore',
);
assert(result.pass, result.pass ? '' : result.report());
});
});