Skip to content

Commit

Permalink
Batch of regression fixes (#476)
Browse files Browse the repository at this point in the history
* Do not trigger on dailymail paywall

* Fix the twitter rule

* Fix instagram rule

* Fix paypal

* Support opt-out button in the quantcast rule

* Add a rule for pinterest business sites
  • Loading branch information
muodov authored Aug 7, 2024
1 parent f32db35 commit cf23a00
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 29 deletions.
4 changes: 2 additions & 2 deletions rules/autoconsent/dmgmedia.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"name": "dmgmedia",
"prehideSelectors": ["[data-project=\"mol-fe-cmp\"]"],
"detectCmp": [
{ "exists": "[data-project=\"mol-fe-cmp\"]" }
{ "exists": "[data-project=\"mol-fe-cmp\"] [class*=footer]" }
],
"detectPopup": [
{ "visible": "[data-project=\"mol-fe-cmp\"]" }
{ "visible": "[data-project=\"mol-fe-cmp\"] [class*=footer]" }
],
"optIn": [
{ "waitForThenClick": "[data-project=\"mol-fe-cmp\"] button[class*=primary]" }
Expand Down
12 changes: 6 additions & 6 deletions rules/autoconsent/instagram.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@
"runContext": {
"urlPattern": "^https://www\\.instagram\\.com/"
},
"prehideSelectors": [".x78zum5.xdt5ytf.xg6iff7.x1n2onr6:has(._a9--)"],
"prehideSelectors": [],
"detectCmp": [
{
"exists": ".x1qjc9v5.x9f619.x78zum5.xdt5ytf.x1iyjqo2.xl56j7k"
"exists": "xpath///span[contains(., \"Vill du tillåta användningen av cookies från Instagram i den här webbläsaren?\") or contains(., \"Allow the use of cookies from Instagram on this browser?\") or contains(., \"Povolit v prohlížeči použití souborů cookie z Instagramu?\") or contains(., \"Dopustiti upotrebu kolačića s Instagrama na ovom pregledniku?\") or contains(., \"Разрешить использование файлов cookie от Instagram в этом браузере?\") or contains(., \"Vuoi consentire l'uso dei cookie di Instagram su questo browser?\") or contains(., \"Povoliť používanie cookies zo služby Instagram v tomto prehliadači?\") or contains(., \"Die Verwendung von Cookies durch Instagram in diesem Browser erlauben?\") or contains(., \"Sallitaanko Instagramin evästeiden käyttö tällä selaimella?\") or contains(., \"Engedélyezed az Instagram cookie-jainak használatát ebben a böngészőben?\") or contains(., \"Het gebruik van cookies van Instagram toestaan in deze browser?\") or contains(., \"Bu tarayıcıda Instagram'dan çerez kullanımına izin verilsin mi?\") or contains(., \"Permitir o uso de cookies do Instagram neste navegador?\") or contains(., \"Permiţi folosirea modulelor cookie de la Instagram în acest browser?\") or contains(., \"Autoriser l’utilisation des cookies d’Instagram sur ce navigateur ?\") or contains(., \"¿Permitir el uso de cookies de Instagram en este navegador?\") or contains(., \"Zezwolić na użycie plików cookie z Instagramu w tej przeglądarce?\") or contains(., \"Να επιτρέπεται η χρήση cookies από τo Instagram σε αυτό το πρόγραμμα περιήγησης;\") or contains(., \"Разрешавате ли използването на бисквитки от Instagram на този браузър?\") or contains(., \"Vil du tillade brugen af cookies fra Instagram i denne browser?\") or contains(., \"Vil du tillate bruk av informasjonskapsler fra Instagram i denne nettleseren?\")]"
}
],
"detectPopup": [
{
"visible": ".x1qjc9v5.x9f619.x78zum5.xdt5ytf.x1iyjqo2.xl56j7k"
"visible": "xpath///span[contains(., \"Vill du tillåta användningen av cookies från Instagram i den här webbläsaren?\") or contains(., \"Allow the use of cookies from Instagram on this browser?\") or contains(., \"Povolit v prohlížeči použití souborů cookie z Instagramu?\") or contains(., \"Dopustiti upotrebu kolačića s Instagrama na ovom pregledniku?\") or contains(., \"Разрешить использование файлов cookie от Instagram в этом браузере?\") or contains(., \"Vuoi consentire l'uso dei cookie di Instagram su questo browser?\") or contains(., \"Povoliť používanie cookies zo služby Instagram v tomto prehliadači?\") or contains(., \"Die Verwendung von Cookies durch Instagram in diesem Browser erlauben?\") or contains(., \"Sallitaanko Instagramin evästeiden käyttö tällä selaimella?\") or contains(., \"Engedélyezed az Instagram cookie-jainak használatát ebben a böngészőben?\") or contains(., \"Het gebruik van cookies van Instagram toestaan in deze browser?\") or contains(., \"Bu tarayıcıda Instagram'dan çerez kullanımına izin verilsin mi?\") or contains(., \"Permitir o uso de cookies do Instagram neste navegador?\") or contains(., \"Permiţi folosirea modulelor cookie de la Instagram în acest browser?\") or contains(., \"Autoriser l’utilisation des cookies d’Instagram sur ce navigateur ?\") or contains(., \"¿Permitir el uso de cookies de Instagram en este navegador?\") or contains(., \"Zezwolić na użycie plików cookie z Instagramu w tej przeglądarce?\") or contains(., \"Να επιτρέπεται η χρήση cookies από τo Instagram σε αυτό το πρόγραμμα περιήγησης;\") or contains(., \"Разрешавате ли използването на бисквитки от Instagram на този браузър?\") or contains(., \"Vil du tillade brugen af cookies fra Instagram i denne browser?\") or contains(., \"Vil du tillate bruk av informasjonskapsler fra Instagram i denne nettleseren?\")]"
}
],
"optIn": [
{
"waitForThenClick": "._a9--._a9_0"
"waitForThenClick": "xpath///button[contains(., 'Tillad alle cookies') or contains(., 'Alle Cookies erlauben') or contains(., 'Allow all cookies') or contains(., 'Разрешаване на всички бисквитки') or contains(., 'Tillåt alla cookies') or contains(., 'Povolit všechny soubory cookie') or contains(., 'Tüm çerezlere izin ver') or contains(., 'Permite toate modulele cookie') or contains(., 'Να επιτρέπονται όλα τα cookies') or contains(., 'Tillat alle informasjonskapsler') or contains(., 'Povoliť všetky cookies') or contains(., 'Permitir todas las cookies') or contains(., 'Permitir todos os cookies') or contains(., 'Alle cookies toestaan') or contains(., 'Salli kaikki evästeet') or contains(., 'Consenti tutti i cookie') or contains(., 'Az összes cookie engedélyezése') or contains(., 'Autoriser tous les cookies') or contains(., 'Zezwól na wszystkie pliki cookie') or contains(., 'Разрешить все cookie') or contains(., 'Dopusti sve kolačiće')]"
}
],
"optOut": [
{
"waitForThenClick": "._a9--._a9_1"
"waitForThenClick": "xpath///button[contains(., 'Отклонить необязательные файлы cookie') or contains(., 'Decline optional cookies') or contains(., 'Refuser les cookies optionnels') or contains(., 'Hylkää valinnaiset evästeet') or contains(., 'Afvis valgfrie cookies') or contains(., 'Odmietnuť nepovinné cookies') or contains(., 'Απόρριψη προαιρετικών cookies') or contains(., 'Neka valfria cookies') or contains(., 'Optionale Cookies ablehnen') or contains(., 'Rifiuta cookie facoltativi') or contains(., 'Odbij neobavezne kolačiće') or contains(., 'Avvis valgfrie informasjonskapsler') or contains(., 'İsteğe bağlı çerezleri reddet') or contains(., 'Recusar cookies opcionais') or contains(., 'Optionele cookies afwijzen') or contains(., 'Rechazar cookies opcionales') or contains(., 'Odrzuć opcjonalne pliki cookie') or contains(., 'Отхвърляне на бисквитките по избор') or contains(., 'Odmítnout volitelné soubory cookie') or contains(., 'Refuză modulele cookie opţionale') or contains(., 'A nem kötelező cookie-k elutasítása')]"
},
{
"wait": 2000
}
]
}
}
32 changes: 19 additions & 13 deletions rules/autoconsent/paypal-us.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,26 @@
"detectPopup": [{ "exists": "#ccpaCookieBanner, .privacy-sheet-content" }],
"optIn": [{ "click": "#acceptAllButton" }],
"optOut": [
{
"if":
{ "exists": "a#manageCookiesLink" },
"then": [
{ "click": "a#manageCookiesLink" }
],
{
"if": { "exists": "#bannerDeclineButton" },
"then": [{ "click": "#bannerDeclineButton" }],
"else": [
{ "waitForVisible": ".privacy-sheet-content #formContent" },
{
"click": "#formContent .cookiepref-11m2iee-checkbox_base input:checked",
"all": true,
"optional": true
},
{ "click": ".confirmCookie #submitCookiesBtn" }
{
"if":
{ "exists": "a#manageCookiesLink" },
"then": [
{ "click": "a#manageCookiesLink" }
],
"else": [
{ "waitForVisible": ".privacy-sheet-content #formContent" },
{
"click": "#formContent .cookiepref-11m2iee-checkbox_base input:checked",
"all": true,
"optional": true
},
{ "click": ".confirmCookie #submitCookiesBtn" }
]
}
]
}
]
Expand Down
28 changes: 28 additions & 0 deletions rules/autoconsent/pinterest-business.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "pinterest-business",
"vendorUrl": "https://business.pinterest.com/",
"runContext": {
"urlPattern": "^https://.*\\.pinterest\\.com/"
},
"prehideSelectors": [".BusinessCookieConsent"],
"detectCmp": [
{
"exists": ".BusinessCookieConsent"
}
],
"detectPopup": [
{
"visible": ".BusinessCookieConsent [data-id=cookie-consent-banner-buttons]"
}
],
"optIn": [
{
"waitForThenClick": "[data-id=cookie-consent-banner-buttons] > div:nth-child(1) button"
}
],
"optOut": [
{
"waitForThenClick": "[data-id=cookie-consent-banner-buttons] > div:nth-child(2) button"
}
]
}
17 changes: 12 additions & 5 deletions rules/autoconsent/quantcast.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,18 @@
"detectCmp": [{ "exists": "#qc-cmp2-container" }],
"detectPopup": [{ "visible": "#qc-cmp2-ui" }],
"optOut": [
{ "click": ".qc-cmp2-summary-buttons > button[mode=\"secondary\"]" },
{ "waitFor": "#qc-cmp2-ui" },
{ "click": ".qc-cmp2-toggle-switch > button[aria-checked=\"true\"]", "all": true, "optional": true },
{ "click": ".qc-cmp2-main button[aria-label=\"REJECT ALL\"]", "optional": true },
{ "waitForThenClick": ".qc-cmp2-main button[aria-label=\"SAVE & EXIT\"],.qc-cmp2-buttons-desktop > button[mode=\"primary\"]", "timeout": 5000 }
{ "waitFor": ".qc-cmp2-summary-buttons > button[mode=\"secondary\"]", "timeout": 2000 },
{
"if": { "exists": ".qc-cmp2-summary-buttons > button[mode=\"secondary\"]:nth-of-type(2)" },
"then": [{ "click": ".qc-cmp2-summary-buttons > button[mode=\"secondary\"]:nth-of-type(2)" }],
"else": [
{ "click": ".qc-cmp2-summary-buttons > button[mode=\"secondary\"]:nth-of-type(1)" },
{ "waitFor": "#qc-cmp2-ui" },
{ "click": ".qc-cmp2-toggle-switch > button[aria-checked=\"true\"]", "all": true, "optional": true },
{ "click": ".qc-cmp2-main button[aria-label=\"REJECT ALL\"]", "optional": true },
{ "waitForThenClick": ".qc-cmp2-main button[aria-label=\"SAVE & EXIT\"],.qc-cmp2-buttons-desktop > button[mode=\"primary\"]", "timeout": 5000 }
]
}
],
"optIn": [{ "click": ".qc-cmp2-summary-buttons > button[mode=\"primary\"]" }]
}
6 changes: 3 additions & 3 deletions rules/autoconsent/twitter.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "twitter",
"runContext": {
"urlPattern": "^https://([a-z0-9-]+\\.)?twitter\\.com/"
"urlPattern": "^https://([a-z0-9-]+\\.)?(twitter|x)\\.com/"
},
"prehideSelectors": ["[data-testid=\"BottomBar\"]"],
"detectCmp": [
Expand All @@ -11,10 +11,10 @@
{ "visible": "[data-testid=\"BottomBar\"] div" }
],
"optIn": [
{ "waitForThenClick": "[data-testid=\"BottomBar\"] > div:has(>div:first-child>div:last-child>span[role=button]) > div:last-child > div[role=button]:first-child" }
{ "waitForThenClick": "[data-testid=\"BottomBar\"] > div:has(>div:first-child>div:last-child>button[role=button]>span) > div:last-child > button[role=button]:first-child" }
],
"optOut": [
{ "waitForThenClick": "[data-testid=\"BottomBar\"] > div:has(>div:first-child>div:last-child>span[role=button]) > div:last-child > div[role=button]:last-child" }
{ "waitForThenClick": "[data-testid=\"BottomBar\"] > div:has(>div:first-child>div:last-child>button[role=button]>span) > div:last-child > button[role=button]:last-child" }
],
"TODOtest": [
{ "eval": "EVAL_document.cookie.includes('d_prefs=MjoxLGNvbnNlbnRfdmVyc2lvbjoy')" }
Expand Down
6 changes: 6 additions & 0 deletions tests/pinterest-business.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import generateCMPTests from "../playwright/runner";

generateCMPTests('pinterest-business', [
'https://business.pinterest.com/en-gb/',
'https://newsroom.pinterest.com/en-gb/news/introducing-new-ai-tools-for-creative-and-performance/',
]);

0 comments on commit cf23a00

Please sign in to comment.