Skip to content

Commit

Permalink
Add rule for tesla (#486)
Browse files Browse the repository at this point in the history
  • Loading branch information
muodov authored Aug 19, 2024
1 parent b1137e7 commit eafe052
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/eval-snippets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ export const snippets = {
EVAL_TEALIUM_2: () => utag.gdpr.setConsentValue(true) || true,
EVAL_TEALIUM_3: () => utag.gdpr.getConsentState() !== 1,
EVAL_TEALIUM_DONOTSELL_CHECK: () => utag.gdpr.dns?.getDnsState() !== 1,
EVAL_TESLA_TEST: () => document.cookie.includes('tsla-cookie-consent=rejected'),
EVAL_TESTCMP_0: () => window.results.results[0] === 'button_clicked',
EVAL_TESTCMP_COSMETIC_0: () => window.results.results[0] === 'banner_hidden',
EVAL_THEFREEDICTIONARY_0: () => cmpUi.showPurposes() || cmpUi.rejectAll() || true,
Expand Down
35 changes: 35 additions & 0 deletions rules/autoconsent/tesla.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "tesla",
"vendorUrl": "https://tesla.com/",
"runContext": {
"main": true,
"frame": false,
"urlPattern": "^https://(www\\.)?tesla\\.com/"
},
"prehideSelectors": [],
"detectCmp": [
{
"exists": "#cookie_banner"
}
],
"detectPopup": [
{
"visible": "#cookie_banner"
}
],
"optIn": [
{
"waitForThenClick": "#tsla-accept-cookie"
}
],
"optOut": [
{
"waitForThenClick": "#tsla-reject-cookie"
}
],
"test": [
{
"eval": "EVAL_TESLA_TEST"
}
]
}
5 changes: 5 additions & 0 deletions tests/tesla.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import generateCMPTests from "../playwright/runner";

generateCMPTests('tesla', [
'https://www.tesla.com/nl_nl/'
]);

0 comments on commit eafe052

Please sign in to comment.