@duckduckgo/autoconsent 16.46.0 → 16.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ import generateCMPTests from '../playwright/runner';
2
+
3
+ generateCMPTests('controlgame', ['https://controlgame.com/cookies']);
@@ -0,0 +1,3 @@
1
+ import generateCMPTests from '../playwright/runner';
2
+
3
+ generateCMPTests('dalecarnegie', ['https://www.dalecarnegie.com/en']);
@@ -0,0 +1,8 @@
1
+ import generateCMPTests from '../playwright/runner';
2
+
3
+ generateCMPTests('jpmorgan-chase', [
4
+ 'https://www.chase.com/personal/events/experiences',
5
+ 'https://www.chase.com/business',
6
+ 'https://www.jpmorgan.com/',
7
+ 'https://www.jpmorganchase.com/',
8
+ ]);
@@ -217,5 +217,18 @@ describe('Autoconsent.findCmp', () => {
217
217
  expect(found).to.have.length(1);
218
218
  expect(found[0].name).to.equal('HEURISTIC-TIER2');
219
219
  });
220
+
221
+ it('does not wait for a DOM mutation after an attempt that skipped the heuristic', async function () {
222
+ this.timeout(10000);
223
+ // the next attempt is odd, so it skips the heuristic; the popup is already shown and the page stays quiet
224
+ autoconsent.state.findCmpAttempts = 2;
225
+
226
+ const timeout = new Promise<null>((resolve) => setTimeout(() => resolve(null), 5000));
227
+ const found = await Promise.race([autoconsent.findCmp(1), timeout]);
228
+
229
+ expect(found, 'detection is stuck waiting for a DOM mutation').to.not.equal(null);
230
+ expect(found).to.have.length(1);
231
+ expect(found![0].name).to.equal('HEURISTIC-REJECT');
232
+ });
220
233
  });
221
234
  });
@@ -4,6 +4,7 @@
4
4
  "declaration": true,
5
5
  "emitDeclarationOnly": true,
6
6
  "declarationDir": "./dist/types",
7
+ "rootDir": "./lib",
7
8
  "noCheck": true
8
9
  },
9
10
  "include": ["lib/web.ts"],
package/tsconfig.json CHANGED
@@ -9,7 +9,8 @@
9
9
  "noImplicitAny": true,
10
10
  "allowSyntheticDefaultImports": true,
11
11
  "strict": true,
12
- "module": "NodeNext"
12
+ "module": "NodeNext",
13
+ "types": ["node", "chrome", "mocha"]
13
14
  },
14
15
  "exclude": ["node_modules/*", "dist/*"]
15
16
  }