From b587f7e2147a385b9508ab1183d941b12bc855df Mon Sep 17 00:00:00 2001 From: Maxim Tsoy Date: Tue, 28 May 2024 15:52:51 +0200 Subject: [PATCH] Make Fides rule more robust (#442) --- lib/eval-snippets.ts | 1 + rules/autoconsent/fides.json | 7 +++++-- tests/fides.spec.ts | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/eval-snippets.ts b/lib/eval-snippets.ts index 0f5af186..bb04f1f1 100644 --- a/lib/eval-snippets.ts +++ b/lib/eval-snippets.ts @@ -94,6 +94,7 @@ export const snippets = { EVAL_EU_COOKIE_LAW_0: () => !document.cookie.includes('euCookie'), EVAL_EZOIC_0: () => ezCMP.handleAcceptAllClick(), EVAL_EZOIC_1: () => !!document.cookie.match(/ez-consent-tcf/), + EVAL_FIDES_DETECT_POPUP: () => window.Fides?.initialized, EVAL_GOOGLE_0: () => !!document.cookie.match(/SOCS=CAE/), EVAL_HEMA_TEST_0: () => document.cookie.includes('cookies_rejected=1'), EVAL_IUBENDA_0: () => document.querySelectorAll('.purposes-item input[type=checkbox]:not([disabled])').forEach(x => {if(x.checked) x.click()}) || true, diff --git a/rules/autoconsent/fides.json b/rules/autoconsent/fides.json index bc20b79b..1f905229 100644 --- a/rules/autoconsent/fides.json +++ b/rules/autoconsent/fides.json @@ -10,16 +10,19 @@ "detectPopup": [ { "visible": "#fides-overlay #fides-banner" + }, + { + "eval": "EVAL_FIDES_DETECT_POPUP" } ], "optIn": [ { - "waitForThenClick": "#fides-banner [data-testid=\"Accept all-btn\"]" + "waitForThenClick": "#fides-banner .fides-accept-all-button" } ], "optOut": [ { - "waitForThenClick": "#fides-banner [data-testid=\"Reject all-btn\"]" + "waitForThenClick": "#fides-banner .fides-reject-all-button" } ] } \ No newline at end of file diff --git a/tests/fides.spec.ts b/tests/fides.spec.ts index 701c50ba..0540a195 100644 --- a/tests/fides.spec.ts +++ b/tests/fides.spec.ts @@ -2,4 +2,5 @@ import generateCMPTests from "../playwright/runner"; generateCMPTests('fides', [ 'https://www.nytimes.com/', + 'https://vercel.com/', ]);