Remove common consent overlays
This commit is contained in:
@@ -78,6 +78,28 @@ test("applies cosmetic filters with domain exceptions and skips unsupported proc
|
||||
assert.match(getCosmeticCssForHostname(rules, "foo.com").join("\n"), /\.adguard/);
|
||||
});
|
||||
|
||||
test("renderPage removes common cookie consent overlays before snapshot", async () => {
|
||||
const html = `<!doctype html>
|
||||
<html class="js sp-message-open" style="overflow: hidden;">
|
||||
<body class="didomi-popup-open" style="overflow: hidden;">
|
||||
<main>Article text</main>
|
||||
<div id="sp_message_container_123" role="dialog" aria-modal="true">
|
||||
<iframe id="sp_message_iframe_123" title="SP Consent Message" srcdoc="<p>Cookies on FT Sites</p>"></iframe>
|
||||
</div>
|
||||
</body>
|
||||
</html>`;
|
||||
|
||||
const rendered = await renderPage(`data:text/html,${encodeURIComponent(html)}`, {
|
||||
userscriptDelay: 0
|
||||
});
|
||||
|
||||
assert.match(rendered, /Article text/);
|
||||
assert.doesNotMatch(rendered, /sp_message_container_123/);
|
||||
assert.doesNotMatch(rendered, /sp_message_iframe_123/);
|
||||
assert.doesNotMatch(rendered, /<html[^>]*class="[^"]*sp-message-open/i);
|
||||
assert.doesNotMatch(rendered, /<body[^>]*class="[^"]*didomi-popup-open/i);
|
||||
});
|
||||
|
||||
test("renderPage serializes CSSOM-inserted style rules", async () => {
|
||||
const html = `<!doctype html>
|
||||
<html>
|
||||
|
||||
Reference in New Issue
Block a user