@duckduckgo/autoconsent 16.28.0 → 16.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/dist/addon-firefox/compact-rules.json +1 -1
- package/dist/addon-firefox/content.bundle.js +17 -5
- package/dist/addon-firefox/manifest.json +1 -1
- package/dist/addon-firefox/rule-index.json +1 -1
- package/dist/addon-firefox/rules.json +1 -1
- package/dist/addon-mv3/compact-rules.json +1 -1
- package/dist/addon-mv3/content.bundle.js +17 -5
- package/dist/addon-mv3/manifest.json +1 -1
- package/dist/addon-mv3/rule-index.json +1 -1
- package/dist/addon-mv3/rules.json +1 -1
- package/dist/autoconsent.cjs.js +17 -5
- package/dist/autoconsent.esm.js +17 -5
- package/dist/autoconsent.playwright.js +17 -5
- package/dist/autoconsent.standalone.js +18 -6
- package/dist/types/cmps/base.d.ts +1 -1
- package/dist/types/dom-actions.d.ts +2 -1
- package/dist/types/rules.d.ts +10 -0
- package/dist/types/types.d.ts +1 -1
- package/docs/rule-syntax.md +12 -1
- package/lib/cmps/base.ts +3 -3
- package/lib/dom-actions.ts +26 -2
- package/lib/rules.ts +10 -0
- package/lib/types.ts +7 -1
- package/package.json +1 -1
- package/rules/autoconsent/bankmillennium-pl.json +26 -0
- package/rules/autoconsent/bibliotheek-nl.json +33 -0
- package/rules/autoconsent/ecbeing.json +10 -0
- package/rules/autoconsent/r42-cookiebar.json +37 -0
- package/rules/autoconsent/stright.json +29 -0
- package/rules/compact-rules.json +1 -1
- package/rules/rule-index.json +1 -1
- package/rules/rules.json +1 -1
- package/tests/bankmillennium-pl.spec.ts +5 -0
- package/tests/bibliotheek-nl.spec.ts +3 -0
- package/tests/ecbeing.spec.ts +3 -0
- package/tests/r42-cookiebar.spec.ts +7 -0
- package/tests/stright.spec.ts +8 -0
- package/tests-wtr/dom-actions/dom-actions.wait-for-then-click.html +14 -0
- package/tests-wtr/dom-actions/dom-actions.wait-for-then-click.ts +106 -0
- package/tests-wtr/rules/cmp-test-urls.json +0 -2
- package/rules/generated/auto_NL_averoachmea.nl_fxj.json +0 -40
- package/rules/generated/auto_NL_centraalbeheer.nl_ooy.json +0 -40
- package/tests/generated/auto_NL_averoachmea.nl_fxj.spec.ts +0 -6
- package/tests/generated/auto_NL_centraalbeheer.nl_ooy.spec.ts +0 -6
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import generateCMPTests from '../playwright/runner';
|
|
2
|
+
|
|
3
|
+
generateCMPTests('stright', [
|
|
4
|
+
// 'https://www.kadokawa.co.jp/', // does not serve the banner to CI egress IPs, only reproducible via a regional proxy
|
|
5
|
+
'https://www.toei-anim.co.jp/',
|
|
6
|
+
'https://www.makita.co.jp/',
|
|
7
|
+
'https://www.yamada-denki.jp/',
|
|
8
|
+
]);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<html>
|
|
2
|
+
<body>
|
|
3
|
+
<script type="module">
|
|
4
|
+
import { runTests } from '@web/test-runner-mocha';
|
|
5
|
+
|
|
6
|
+
runTests(async () => {
|
|
7
|
+
await import('./dom-actions.wait-for-then-click');
|
|
8
|
+
});
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<h1>Hello test</h1>
|
|
12
|
+
<div id="container"></div>
|
|
13
|
+
</body>
|
|
14
|
+
</html>
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { expect } from '@esm-bundle/chai';
|
|
2
|
+
import { instantiateDomActions } from './utils';
|
|
3
|
+
|
|
4
|
+
// A short interval keeps the tests fast; the retry loop polls every 50ms regardless.
|
|
5
|
+
const RETRY_INTERVAL = 50;
|
|
6
|
+
|
|
7
|
+
// must be run from dom-actions.wait-for-then-click.html
|
|
8
|
+
describe('waitForThenClick', () => {
|
|
9
|
+
let clicks: number;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Adds a button that hides itself once it has been clicked `handledAfterClicks` times.
|
|
13
|
+
* `handledAfterClicks: 0` simulates a button whose click handler is never effective.
|
|
14
|
+
*/
|
|
15
|
+
function addButton(handledAfterClicks: number): HTMLElement {
|
|
16
|
+
const button = document.createElement('button');
|
|
17
|
+
button.id = 'target';
|
|
18
|
+
button.innerText = 'Click me';
|
|
19
|
+
button.addEventListener('click', () => {
|
|
20
|
+
clicks++;
|
|
21
|
+
if (handledAfterClicks > 0 && clicks >= handledAfterClicks) {
|
|
22
|
+
button.style.display = 'none';
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
document.getElementById('container')!.appendChild(button);
|
|
26
|
+
return button;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
beforeEach(() => {
|
|
30
|
+
clicks = 0;
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
afterEach(() => {
|
|
34
|
+
document.getElementById('container')!.innerHTML = '';
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('should click once and not retry by default', async () => {
|
|
38
|
+
const domActions = instantiateDomActions();
|
|
39
|
+
addButton(0);
|
|
40
|
+
|
|
41
|
+
const result = await domActions.waitForThenClick('#target');
|
|
42
|
+
|
|
43
|
+
expect(result).to.be.true;
|
|
44
|
+
expect(clicks).to.equal(1);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('should retry while the element is still visible', async () => {
|
|
48
|
+
const domActions = instantiateDomActions();
|
|
49
|
+
addButton(0);
|
|
50
|
+
|
|
51
|
+
const result = await domActions.waitForThenClick('#target', 10000, false, 2, RETRY_INTERVAL);
|
|
52
|
+
|
|
53
|
+
expect(result).to.be.true;
|
|
54
|
+
expect(clicks).to.equal(3); // the first click plus two retries
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('should stop retrying as soon as the click is handled', async () => {
|
|
58
|
+
const domActions = instantiateDomActions();
|
|
59
|
+
addButton(2); // the first click is dropped, the second one hides the button
|
|
60
|
+
|
|
61
|
+
const result = await domActions.waitForThenClick('#target', 10000, false, 5, RETRY_INTERVAL);
|
|
62
|
+
|
|
63
|
+
expect(result).to.be.true;
|
|
64
|
+
expect(clicks).to.equal(2);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('should not retry if the element disappears on the first click', async () => {
|
|
68
|
+
const domActions = instantiateDomActions();
|
|
69
|
+
addButton(1);
|
|
70
|
+
|
|
71
|
+
const result = await domActions.waitForThenClick('#target', 10000, false, 5, RETRY_INTERVAL);
|
|
72
|
+
|
|
73
|
+
expect(result).to.be.true;
|
|
74
|
+
expect(clicks).to.equal(1);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it('should not retry when retries is 0', async () => {
|
|
78
|
+
const domActions = instantiateDomActions();
|
|
79
|
+
addButton(0);
|
|
80
|
+
|
|
81
|
+
const result = await domActions.waitForThenClick('#target', 10000, false, 0, RETRY_INTERVAL);
|
|
82
|
+
|
|
83
|
+
expect(result).to.be.true;
|
|
84
|
+
expect(clicks).to.equal(1);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it('should not retry if the element never appeared', async () => {
|
|
88
|
+
const domActions = instantiateDomActions();
|
|
89
|
+
|
|
90
|
+
const result = await domActions.waitForThenClick('#nonexistent', 100, false, 5, RETRY_INTERVAL);
|
|
91
|
+
|
|
92
|
+
expect(result).to.be.false;
|
|
93
|
+
expect(clicks).to.equal(0);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it('should retry all matching elements when all is true', async () => {
|
|
97
|
+
const domActions = instantiateDomActions();
|
|
98
|
+
addButton(0);
|
|
99
|
+
addButton(0);
|
|
100
|
+
|
|
101
|
+
const result = await domActions.waitForThenClick('#target', 10000, true, 1, RETRY_INTERVAL);
|
|
102
|
+
|
|
103
|
+
expect(result).to.be.true;
|
|
104
|
+
expect(clicks).to.equal(4); // two elements, clicked twice each
|
|
105
|
+
});
|
|
106
|
+
});
|
|
@@ -2017,7 +2017,6 @@
|
|
|
2017
2017
|
["auto_NL_assem.nl_g6v", "http://assem.nl/"],
|
|
2018
2018
|
["auto_NL_auto-onderdelen24.nl_4bc", "http://auto-onderdelen24.nl/"],
|
|
2019
2019
|
["auto_NL_autodoc.nl_ojv", "https://autodoc.nl/"],
|
|
2020
|
-
["auto_NL_averoachmea.nl_fxj_+1", "https://centraalbeheer.nl/"],
|
|
2021
2020
|
["auto_NL_backmarket.nl_dye", "https://backmarket.nl/"],
|
|
2022
2021
|
["auto_NL_bandenconcurrent.nl_51x", "https://www.bandenconcurrent.nl/"],
|
|
2023
2022
|
["auto_NL_bandenleader.nl_48r", "https://bandenleader.nl/"],
|
|
@@ -2115,7 +2114,6 @@
|
|
|
2115
2114
|
["auto_NL_evupdate.nl_w0k", "http://evupdate.nl/"],
|
|
2116
2115
|
["auto_NL_experts.anwb.nl_8kh", "https://www.experts.anwb.nl/"],
|
|
2117
2116
|
["auto_NL_eyewish.com_g4i", "https://eyewish.com/"],
|
|
2118
|
-
["auto_NL_fbto.nl_ffa", "http://www.fbto.nl/"],
|
|
2119
2117
|
["auto_NL_festival.idfa.nl_1fh", "http://www.festival.idfa.nl/"],
|
|
2120
2118
|
["auto_NL_fixpart.be_lqf_+1", "http://fixpart.nl/"],
|
|
2121
2119
|
["auto_NL_fiyo.nl_rqd_+1", "http://groenehoedduurzaam.nl/"],
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "auto_NL_averoachmea.nl_fxj",
|
|
3
|
-
"cosmetic": false,
|
|
4
|
-
"_metadata": {
|
|
5
|
-
"vendorUrl": "http://www.averoachmea.nl/"
|
|
6
|
-
},
|
|
7
|
-
"runContext": {
|
|
8
|
-
"main": true,
|
|
9
|
-
"frame": false,
|
|
10
|
-
"urlPattern": "^https?://(www\\.)?averoachmea\\.nl/"
|
|
11
|
-
},
|
|
12
|
-
"prehideSelectors": [],
|
|
13
|
-
"detectCmp": [
|
|
14
|
-
{
|
|
15
|
-
"exists": "body > dialog#r42CookieBar > section:nth-child(2):not([id]) > div:nth-child(3):not([id]) > button:nth-child(1):not([id])"
|
|
16
|
-
}
|
|
17
|
-
],
|
|
18
|
-
"detectPopup": [
|
|
19
|
-
{
|
|
20
|
-
"visible": "body > dialog#r42CookieBar > section:nth-child(2):not([id]) > div:nth-child(3):not([id]) > button:nth-child(1):not([id])"
|
|
21
|
-
}
|
|
22
|
-
],
|
|
23
|
-
"optIn": [],
|
|
24
|
-
"optOut": [
|
|
25
|
-
{
|
|
26
|
-
"wait": 500
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"waitForThenClick": "body > dialog#r42CookieBar > section:nth-child(2):not([id]) > div:nth-child(3):not([id]) > button:nth-child(1):not([id])",
|
|
30
|
-
"comment": "Weigeren"
|
|
31
|
-
}
|
|
32
|
-
],
|
|
33
|
-
"test": [
|
|
34
|
-
{
|
|
35
|
-
"waitForVisible": "body > dialog#r42CookieBar > section:nth-child(2):not([id]) > div:nth-child(3):not([id]) > button:nth-child(1):not([id])",
|
|
36
|
-
"timeout": 1000,
|
|
37
|
-
"check": "none"
|
|
38
|
-
}
|
|
39
|
-
]
|
|
40
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "auto_NL_centraalbeheer.nl_ooy",
|
|
3
|
-
"cosmetic": false,
|
|
4
|
-
"_metadata": {
|
|
5
|
-
"vendorUrl": "http://www.centraalbeheer.nl/"
|
|
6
|
-
},
|
|
7
|
-
"runContext": {
|
|
8
|
-
"main": true,
|
|
9
|
-
"frame": false,
|
|
10
|
-
"urlPattern": "^https?://(www\\.)?centraalbeheer\\.nl/"
|
|
11
|
-
},
|
|
12
|
-
"prehideSelectors": [],
|
|
13
|
-
"detectCmp": [
|
|
14
|
-
{
|
|
15
|
-
"exists": "body > dialog#r42CookieBar > section:nth-child(2):not([id]) > div:nth-child(3):not([id]) > button:nth-child(1):not([id])"
|
|
16
|
-
}
|
|
17
|
-
],
|
|
18
|
-
"detectPopup": [
|
|
19
|
-
{
|
|
20
|
-
"visible": "body > dialog#r42CookieBar > section:nth-child(2):not([id]) > div:nth-child(3):not([id]) > button:nth-child(1):not([id])"
|
|
21
|
-
}
|
|
22
|
-
],
|
|
23
|
-
"optIn": [],
|
|
24
|
-
"optOut": [
|
|
25
|
-
{
|
|
26
|
-
"wait": 500
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"waitForThenClick": "body > dialog#r42CookieBar > section:nth-child(2):not([id]) > div:nth-child(3):not([id]) > button:nth-child(1):not([id])",
|
|
30
|
-
"comment": "Weigeren"
|
|
31
|
-
}
|
|
32
|
-
],
|
|
33
|
-
"test": [
|
|
34
|
-
{
|
|
35
|
-
"waitForVisible": "body > dialog#r42CookieBar > section:nth-child(2):not([id]) > div:nth-child(3):not([id]) > button:nth-child(1):not([id])",
|
|
36
|
-
"timeout": 1000,
|
|
37
|
-
"check": "none"
|
|
38
|
-
}
|
|
39
|
-
]
|
|
40
|
-
}
|