@duckduckgo/autoconsent 8.0.0 → 8.1.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.
@@ -1,5 +1,4 @@
1
1
  import { click, elementExists, wait } from '../rule-executors';
2
- import { waitFor } from '../utils';
3
2
  import AutoConsentCMPBase from './base';
4
3
 
5
4
  export default class Cookiebot extends AutoConsentCMPBase {
@@ -23,9 +22,7 @@ export default class Cookiebot extends AutoConsentCMPBase {
23
22
  }
24
23
 
25
24
  async detectPopup() {
26
- return await waitFor(() => {
27
- return this.mainWorldEval('EVAL_COOKIEBOT_2')
28
- }, 10, 500);
25
+ return this.mainWorldEval('EVAL_COOKIEBOT_2');
29
26
  }
30
27
 
31
28
  async optOut() {
@@ -57,6 +57,7 @@ export const snippets = {
57
57
  EVAL_EZOIC_0: () => ezCMP.handleAcceptAllClick(),
58
58
  EVAL_EZOIC_1: () => !!document.cookie.match(/ezCMPCookieConsent=[^;]+\|2=0\|3=0\|4=0/),
59
59
  EVAL_GOOGLE_0: () => !!document.cookie.match(/SOCS=CAE/),
60
+ EVAL_HEMA_TEST_0: () => document.cookie.includes('cookies_rejected=1'),
60
61
  EVAL_IUBENDA_0: () => document.querySelectorAll('.purposes-item input[type=checkbox]:not([disabled])').forEach(x => {if(x.checked) x.click()}) || true,
61
62
  EVAL_IUBENDA_1: () => !!document.cookie.match(/_iub_cs-\d+=/),
62
63
  EVAL_IWINK_TEST: () => document.cookie.includes('cookie_permission_granted=no'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duckduckgo/autoconsent",
3
- "version": "8.0.0",
3
+ "version": "8.1.0",
4
4
  "description": "",
5
5
  "main": "dist/autoconsent.cjs.js",
6
6
  "module": "dist/autoconsent.esm.js",
@@ -18,6 +18,7 @@
18
18
  "test:firefox": "playwright test --project firefox",
19
19
  "test:chrome": "playwright test --project chrome",
20
20
  "test:lib": "playwright test tests/rule-executors.spec.ts",
21
+ "test:sample": "playwright test tests/_sample-test.spec.ts --project webkit",
21
22
  "fetch-fanboy-list": "wget https://www.fanboy.co.nz/fanboy-cookiemonster.txt",
22
23
  "fetch-site-list": "curl https://s3.amazonaws.com/cdn.cliqz.com/re-consent/supported_sites.txt > sites.txt",
23
24
  "build-rules": "node rules/build.mjs",
@@ -7,6 +7,7 @@ import { enableLogs } from "../lib/config";
7
7
  import { AutoAction } from "../lib/types";
8
8
 
9
9
  const testRegion = (process.env.REGION || "NA").trim();
10
+ test.describe.configure({ mode: 'parallel' });
10
11
 
11
12
  type TestOptions = {
12
13
  testOptOut: boolean;
@@ -15,7 +15,6 @@ const config: PlaywrightTestConfig = {
15
15
  use: {
16
16
  ...devices['Desktop Safari'],
17
17
  proxy,
18
- screenshot: 'only-on-failure',
19
18
  userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15',
20
19
  },
21
20
  },
@@ -24,7 +23,6 @@ const config: PlaywrightTestConfig = {
24
23
  use: {
25
24
  ...devices['iPhone SE'],
26
25
  proxy,
27
- screenshot: 'only-on-failure',
28
26
  userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Mobile/15E148 Safari/604.1',
29
27
  },
30
28
  },
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "hema",
3
+ "prehideSelectors": [".cookie-modal"],
4
+ "detectCmp": [
5
+ { "visible": ".cookie-modal .cookie-accept-btn" }
6
+ ],
7
+ "detectPopup": [
8
+ { "visible": ".cookie-modal .cookie-accept-btn" }
9
+ ],
10
+ "optIn": [
11
+ { "waitForThenClick": ".cookie-modal .cookie-accept-btn" }
12
+ ],
13
+ "optOut": [
14
+ { "waitForThenClick": ".cookie-modal .js-cookie-reject-btn" }
15
+ ],
16
+ "test": [
17
+ {
18
+ "eval": "EVAL_HEMA_TEST_0"
19
+ }
20
+ ]
21
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "ing.de",
3
+ "runContext": {
4
+ "urlPattern": "^https://www\\.ing\\.de/"
5
+ },
6
+ "cosmetic": true,
7
+ "prehideSelectors": ["div[slot=\"backdrop\"]"],
8
+ "detectCmp": [{ "exists": "[data-tag-name=\"ing-cc-dialog-frame\"]" }],
9
+ "detectPopup": [{ "visible": "[data-tag-name=\"ing-cc-dialog-frame\"]" }],
10
+ "optIn": [{ "click": [
11
+ "[data-tag-name=\"ing-cc-dialog-level0\"]",
12
+ "[data-tag-name=\"ing-cc-button\"][class*=\"accept\"]"
13
+ ] }],
14
+ "optOut": [{ "click": [
15
+ "[data-tag-name=\"ing-cc-dialog-level0\"]",
16
+ "[data-tag-name=\"ing-cc-button\"][class*=\"more\"]"
17
+ ] }]
18
+ }
package/rules/rules.json CHANGED
@@ -2382,6 +2382,37 @@
2382
2382
  }
2383
2383
  ]
2384
2384
  },
2385
+ {
2386
+ "name": "hema",
2387
+ "prehideSelectors": [
2388
+ ".cookie-modal"
2389
+ ],
2390
+ "detectCmp": [
2391
+ {
2392
+ "visible": ".cookie-modal .cookie-accept-btn"
2393
+ }
2394
+ ],
2395
+ "detectPopup": [
2396
+ {
2397
+ "visible": ".cookie-modal .cookie-accept-btn"
2398
+ }
2399
+ ],
2400
+ "optIn": [
2401
+ {
2402
+ "waitForThenClick": ".cookie-modal .cookie-accept-btn"
2403
+ }
2404
+ ],
2405
+ "optOut": [
2406
+ {
2407
+ "waitForThenClick": ".cookie-modal .js-cookie-reject-btn"
2408
+ }
2409
+ ],
2410
+ "test": [
2411
+ {
2412
+ "eval": "EVAL_HEMA_TEST_0"
2413
+ }
2414
+ ]
2415
+ },
2385
2416
  {
2386
2417
  "name": "hl.co.uk",
2387
2418
  "prehideSelectors": [
@@ -2479,6 +2510,42 @@
2479
2510
  }
2480
2511
  ]
2481
2512
  },
2513
+ {
2514
+ "name": "ing.de",
2515
+ "runContext": {
2516
+ "urlPattern": "^https://www\\.ing\\.de/"
2517
+ },
2518
+ "cosmetic": true,
2519
+ "prehideSelectors": [
2520
+ "div[slot=\"backdrop\"]"
2521
+ ],
2522
+ "detectCmp": [
2523
+ {
2524
+ "exists": "[data-tag-name=\"ing-cc-dialog-frame\"]"
2525
+ }
2526
+ ],
2527
+ "detectPopup": [
2528
+ {
2529
+ "visible": "[data-tag-name=\"ing-cc-dialog-frame\"]"
2530
+ }
2531
+ ],
2532
+ "optIn": [
2533
+ {
2534
+ "click": [
2535
+ "[data-tag-name=\"ing-cc-dialog-level0\"]",
2536
+ "[data-tag-name=\"ing-cc-button\"][class*=\"accept\"]"
2537
+ ]
2538
+ }
2539
+ ],
2540
+ "optOut": [
2541
+ {
2542
+ "click": [
2543
+ "[data-tag-name=\"ing-cc-dialog-level0\"]",
2544
+ "[data-tag-name=\"ing-cc-button\"][class*=\"more\"]"
2545
+ ]
2546
+ }
2547
+ ]
2548
+ },
2482
2549
  {
2483
2550
  "name": "ionos.de",
2484
2551
  "prehideSelectors": [
@@ -0,0 +1,16 @@
1
+ import coverageData from "../data/coverage.json";
2
+ import generateCMPTests from "../playwright/runner";
3
+
4
+ const region = (process.env.REGION || "US").trim();
5
+ const nSites = parseInt(process.env.NSITES || '1')
6
+
7
+ Object.keys(coverageData).forEach((name) => {
8
+ if (!coverageData[name][region]) {
9
+ // no coverage in this region
10
+ return;
11
+ }
12
+ const siteList = coverageData[name][region].exampleSites.slice(0, nSites);
13
+ generateCMPTests(name, siteList, {
14
+ testOptIn: false,
15
+ });
16
+ });
@@ -0,0 +1,7 @@
1
+ import generateCMPTests from "../playwright/runner";
2
+
3
+ generateCMPTests('hema', [
4
+ 'https://hema.nl/',
5
+ 'https://www.hema.com/de-de',
6
+ ], {
7
+ });