From fa83a987238a7477811ded9a74d6a2ddf76c5afb Mon Sep 17 00:00:00 2001 From: Amanda RASOLOFOTSARA <50955126+icodebyamanda@users.noreply.github.com> Date: Fri, 16 Sep 2022 13:44:08 +0200 Subject: [PATCH] Add rules for Pubtech (CMP) (#25) * rules added WIP * optout working - self test to wip * need self test * pubtech selftest added & localtest passed * logs disabled * selector found for leFonti, now to be merged with others * rules, selftest, localtest working - waiting for feedbacks on the eval logic * logs disabled * Corrected microsoft mistake * detectPopup reduced to 1 selector * optIn now with conditional rule * parenthesis added to eval logic * L26 just some whitespace added Co-authored-by: euw-arasolofotsara1 --- rules/autoconsent/pubtech.json | 42 ++++++++++++++++++++++++++++++++++ tests/pubtech.spec.ts | 13 +++++++++++ 2 files changed, 55 insertions(+) create mode 100644 rules/autoconsent/pubtech.json create mode 100644 tests/pubtech.spec.ts diff --git a/rules/autoconsent/pubtech.json b/rules/autoconsent/pubtech.json new file mode 100644 index 00000000..a8fba5c0 --- /dev/null +++ b/rules/autoconsent/pubtech.json @@ -0,0 +1,42 @@ +{ + "name": "pubtech", + "prehideSelectors": ["#pubtech-cmp"], + "detectCmp": [ + { + "exists": "#pubtech-cmp" + } + ], + "detectPopup": [ + { + "visible": "#pubtech-cmp #pt-actions" + } + ], + "optIn": [ + { + "if": { + "exists": "#pt-accept-all" + }, + "then": [ + { + "click": "#pubtech-cmp #pt-actions #pt-accept-all" + } + ], + "else": [ + { + "click": "#pubtech-cmp #pt-actions button:nth-of-type(2)" + } + ] + } + ], + "optOut": [ + + { + "click": "#pubtech-cmp #pt-close" + } + ], + "test": [ + { + "eval": "document.cookie.includes('euconsent-v2') && (document.cookie.match(/.YAAAAAAAAAAA/) || document.cookie.match(/.aAAAAAAAAAAA/) || document.cookie.match(/.YAAACFgAAAAA/)) " + } + ] +} diff --git a/tests/pubtech.spec.ts b/tests/pubtech.spec.ts new file mode 100644 index 00000000..f9ef38f0 --- /dev/null +++ b/tests/pubtech.spec.ts @@ -0,0 +1,13 @@ +import generateCMPTests from "../playwright/runner"; + +generateCMPTests('pubtech', [ + 'https://www.lefonti.tv/', + 'https://www.liberoquotidiano.it/', + 'https://www.telefonino.net/', + 'https://www.fattoincasadabenedetta.it/', + 'https://www.quotidianopiemontese.it/', + 'https://www.iltelegrafolivorno.it/', + 'https://www.agrigentooggi.it/', + 'https://blog.cliomakeup.com/', + 'https://www.leccenews24.it/' +]);