Skip to content

Commit

Permalink
feat: support coca-cola.com using OneTrust (#376)
Browse files Browse the repository at this point in the history
  • Loading branch information
seia-soto authored Mar 5, 2024
1 parent 83b9026 commit 8ceffe3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/cmps/onetrust.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ export default class Onetrust extends AutoConsentCMPBase {
}

async detectCmp() {
return this.elementExists("#onetrust-banner-sdk");
return this.elementExists("#onetrust-banner-sdk,#onetrust-consent-sdk");
}

async detectPopup() {
return this.elementVisible("#onetrust-banner-sdk", 'all');
return this.elementVisible("#onetrust-banner-sdk,#onetrust-consent-sdk", "any");
}

async optOut() {
if (this.elementVisible("#onetrust-reject-all-handler,.js-reject-cookies", 'any')) { // 'reject all' shortcut
return this.click("#onetrust-reject-all-handler,.js-reject-cookies");
if (this.elementVisible("#onetrust-reject-all-handler,.ot-pc-refuse-all-handler,.js-reject-cookies", 'any')) { // 'reject all' shortcut
return this.click("#onetrust-reject-all-handler,.ot-pc-refuse-all-handler,.js-reject-cookies");
}

if (this.elementExists("#onetrust-pc-btn-handler")) { // "show purposes" button inside a popup
Expand All @@ -55,7 +55,7 @@ export default class Onetrust extends AutoConsentCMPBase {
}

async optIn() {
return this.click("#onetrust-accept-btn-handler,.js-accept-cookies");
return this.click("#onetrust-accept-btn-handler,#accept-recommended-btn-handler,.js-accept-cookies");
}

async test() {
Expand Down
1 change: 1 addition & 0 deletions tests/onetrust.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ generateCMPTests('Onetrust', [
"https://www.lovescout24.de/",
"https://www.okcupid.com/",
"https://doodle.com/",
"https://www.coca-cola.com/us/en",
]);

generateCMPTests('Onetrust', [
Expand Down

0 comments on commit 8ceffe3

Please sign in to comment.