Skip to content

Commit

Permalink
Add rule for openai
Browse files Browse the repository at this point in the history
  • Loading branch information
muodov committed Aug 30, 2024
1 parent cc6db47 commit 646e477
Show file tree
Hide file tree
Showing 3 changed files with 39 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 @@ -109,6 +109,7 @@ export const snippets = {
EVAL_MICROSOFT_2: () => !!document.cookie.match('MSCC|GHCC'),
EVAL_MOOVE_0: () => document.querySelectorAll('#moove_gdpr_cookie_modal input').forEach(i => { if (!i.disabled) i.checked = (i.name === 'moove_gdpr_strict_cookies' || i.id === 'moove_gdpr_strict_cookies') }) || true,
EVAL_ONENINETWO_0: () => document.cookie.includes('CC_ADVERTISING=NO') && document.cookie.includes('CC_ANALYTICS=NO'),
EVAL_OPENAI_TEST: () => document.cookie.includes('oai-allow-ne=false'),
EVAL_OPERA_0: () => document.cookie.includes('cookie_consent_essential=true') && !document.cookie.includes('cookie_consent_marketing=true'),
EVAL_PAYPAL_0: () => document.cookie.includes('cookie_prefs') === true,
EVAL_PRIMEBOX_0: () => !document.cookie.includes('cb-enabled=accepted'),
Expand Down
33 changes: 33 additions & 0 deletions rules/autoconsent/openai.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "openai",
"vendorUrl": "https://platform.openai.com/",
"cosmetic": false,
"runContext": {
"urlPattern": "^https://([a-z0-9-]+\\.)?openai\\.com/"
},
"prehideSelectors": ["[data-testid=cookie-consent-banner]"],
"detectCmp": [
{
"exists": "[data-testid=cookie-consent-banner]"
}
],
"detectPopup": [
{
"visible": "[data-testid=cookie-consent-banner]"
}
],
"optIn": [
{
"waitForThenClick": "xpath///button[contains(., 'Accept all')]"
}
],
"optOut": [
{
"waitForThenClick": "xpath///button[contains(., 'Reject all')]"
}
],
"test": [
{ "wait": 500 },
{ "eval": "EVAL_OPENAI_TEST" }
]
}
5 changes: 5 additions & 0 deletions tests/openai.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import generateCMPTests from "../playwright/runner";

generateCMPTests('openai', [
'https://platform.openai.com/docs/guides',
]);

0 comments on commit 646e477

Please sign in to comment.