Skip to content

Commit

Permalink
Add a test page for CPM filterlist (#248)
Browse files Browse the repository at this point in the history
* Add a test page for CPM filterlist

* Add a dedicated index page for CPM
  • Loading branch information
muodov authored Dec 19, 2024
1 parent 1116514 commit 6a93536
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 2 deletions.
19 changes: 19 additions & 0 deletions features/autoconsent/autoconsent-index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Autoconsent Feature Tests</title>
</head>
<body>
<p><a href="../">[Home]</a><strong>[Autoconsent Feature Tests]</strong></p>

<h1>Autoconsent Feature Tests</h1>

<ul>
<li><a href='./index.html'>Normal cookie popup</a></li>
<li><a href='./banner.html'>Cookie notice (cosmetic hiding rule)</a></li>
<li><a href='./filterlist.html'>Test for cosmetic filterlist</a></li>
</ul>
</body>
</html>
20 changes: 20 additions & 0 deletions features/autoconsent/filterlist.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Cookie consent notice banner (Filterlist)</title>

<script src='./filterlist.js' defer></script>
</head>
<body>
<p><a href="/index.html">[Home]</a></p>

<p>Tests for filterlist-based hiding of cookie banners.</P>

<div id="privacy-test-page-cmp-test-banner-filterlist">
This is a fake cookie banner that should be hidden by filterlist.
</div>

</body>
</html>
20 changes: 20 additions & 0 deletions features/autoconsent/filterlist.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const acceptButton = document.createElement('button');
acceptButton.innerText = 'Accept all';
acceptButton.id = 'accept-all';
const banner = document.quesrySelector('#privacy-test-page-cmp-test-banner-filterlist');
banner.appendChild(acceptButton);
acceptButton.addEventListener('click', (ev) => {
ev.target.innerText = 'Accept was clicked!';
window.results.results.push('accept_button_clicked');
});

setTimeout(() => {
if (window.getComputedStyle(banner).opacity === '0') {
window.results.results.push('banner_hidden');
}
}, 500);

window.results = {
page: 'autoconsent-filterlist',
results: []
};
3 changes: 1 addition & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ <h2>Browser Features</h2>
<li><a href="./features/download/">Downloads</a></li>
<li><a href="./features/print/">Print</a></li>
<li><a href="./features/fonts.html">Fonts</a></li>
<li><a href="./features/autoconsent/">Cookie consent popups</a></li>
<li><a href="./features/autoconsent/banner.html">Cookie consent notice banners</a></li>
<li><a href="./features/autoconsent/autoconsent-index.html">Autoconsent Feature Tests</a></li>
<li><a href="./features/navigator-interface.html">Navigator Interface</a></li>
<li><a href="./features/js-alerts.html">JS alerts and Hanging</a></li>
<li><a href="./features/local-storage.html">Local storage</a></li>
Expand Down

0 comments on commit 6a93536

Please sign in to comment.