From 7e9cfbecf644a496ece482b4ec79b29ef691fae0 Mon Sep 17 00:00:00 2001 From: Maxim Tsoy Date: Fri, 22 Nov 2024 20:07:40 +0100 Subject: [PATCH] Improve Civic rule (#524) --- rules/autoconsent/civic-cookie-control.json | 28 +++++++++++++++++---- tests/civic-cookie-control.spec.ts | 2 +- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/rules/autoconsent/civic-cookie-control.json b/rules/autoconsent/civic-cookie-control.json index 00362110..fa6025b1 100644 --- a/rules/autoconsent/civic-cookie-control.json +++ b/rules/autoconsent/civic-cookie-control.json @@ -1,9 +1,27 @@ { "vendorUrl": "https://www.civicuk.com/cookie-control/", "name": "civic-cookie-control", - "prehideSelectors": ["#ccc-module,#ccc-overlay"], - "detectCmp": [{ "exists": "#ccc-module" }], - "detectPopup": [{ "visible": "#ccc" }, { "visible": "#ccc-module" }], - "optOut": [{ "click": "#ccc-reject-settings" }], - "optIn": [{ "click": "#ccc-recommended-settings" }] + "prehideSelectors": ["#ccc-module,#ccc-overlay,#ccc"], + "detectCmp": [{ "exists": "#ccc-module,#ccc-notify" }], + "detectPopup": [{ "visible": "#ccc" }, { "visible": "#ccc-module,#ccc-notify" }], + "optOut": [ + { + "if": { "exists": "#ccc-notify" }, + "then": [ + { + "waitForThenClick": [ + "#ccc #ccc-notify .ccc-notify-buttons", + "xpath///button[contains(., 'Settings') or contains(., 'Cookie Preferences')]" + ] + }, + { "waitForVisible": "#ccc-module" } + ] + }, + { + "if": { "exists": "#ccc-reject-settings" }, + "then": [{ "waitForThenClick": "#ccc-reject-settings" }], + "else": [{ "waitForThenClick": "#ccc-dismiss-button" }] + } + ], + "optIn": [{ "waitForThenClick": "#ccc-recommended-settings,#ccc-notify-accept" }] } diff --git a/tests/civic-cookie-control.spec.ts b/tests/civic-cookie-control.spec.ts index 0e6dbd50..76bb9def 100644 --- a/tests/civic-cookie-control.spec.ts +++ b/tests/civic-cookie-control.spec.ts @@ -1,5 +1,5 @@ import generateCMPTests from '../playwright/runner'; -generateCMPTests('civic-cookie-control', ['https://www.birmingham.gov.uk/', 'https://planning.org.uk/'], { +generateCMPTests('civic-cookie-control', ['https://www.birmingham.gov.uk/', 'https://planning.org.uk/', 'https://www.jessops.com/'], { skipRegions: ['US', 'DE'], });