@duckduckgo/autoconsent 3.0.1 → 3.0.2
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.
- package/CHANGELOG.md +12 -0
- package/dist/addon-firefox/content.bundle.js +1 -1
- package/dist/addon-firefox/manifest.json +2 -2
- package/dist/addon-mv3/content.bundle.js +1 -1
- package/dist/addon-mv3/manifest.json +1 -1
- package/dist/autoconsent.cjs.js +1 -1
- package/dist/autoconsent.esm.js +1 -1
- package/dist/autoconsent.playwright.js +1 -1
- package/lib/cmps/sourcepoint-frame.ts +4 -2
- package/package.json +1 -1
- package/playwright/runner.ts +22 -15
- package/tests/sourcepoint.spec.ts +13 -2
- package/tests/asus.spec.ts +0 -5
package/playwright/runner.ts
CHANGED
|
@@ -15,6 +15,7 @@ type TestOptions = {
|
|
|
15
15
|
skipRegions?: string[];
|
|
16
16
|
onlyRegions?: string[];
|
|
17
17
|
mobile: boolean;
|
|
18
|
+
expectPopupOpen: boolean;
|
|
18
19
|
};
|
|
19
20
|
const defaultOptions: TestOptions = {
|
|
20
21
|
testOptOut: true,
|
|
@@ -23,6 +24,7 @@ const defaultOptions: TestOptions = {
|
|
|
23
24
|
skipRegions: [],
|
|
24
25
|
onlyRegions: [],
|
|
25
26
|
mobile: false,
|
|
27
|
+
expectPopupOpen: true,
|
|
26
28
|
};
|
|
27
29
|
|
|
28
30
|
const contentScript = fs.readFileSync(
|
|
@@ -120,23 +122,28 @@ export function generateTest(
|
|
|
120
122
|
page.on("framenavigated", injectContentScript);
|
|
121
123
|
|
|
122
124
|
// wait for all messages and assertions
|
|
123
|
-
await waitFor(() => isMessageReceived({ type: "
|
|
124
|
-
expect(isMessageReceived({ type: "
|
|
125
|
+
await waitFor(() => isMessageReceived({ type: "cmpDetected", cmp: expectedCmp }), 50, 500);
|
|
126
|
+
expect(isMessageReceived({ type: "cmpDetected", cmp: expectedCmp })).toBe(true);
|
|
125
127
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
128
|
+
await waitFor(() => isMessageReceived({ type: "popupFound", cmp: expectedCmp }), options.expectPopupOpen ? 50 : 5, 500);
|
|
129
|
+
expect(isMessageReceived({ type: "popupFound", cmp: expectedCmp })).toBe(options.expectPopupOpen);
|
|
130
|
+
|
|
131
|
+
if (options.expectPopupOpen) {
|
|
132
|
+
if (autoAction === 'optOut') {
|
|
133
|
+
await waitFor(() => isMessageReceived({ type: "optOutResult", result: true }), 50, 300);
|
|
134
|
+
expect(isMessageReceived({ type: "optOutResult", result: true })).toBe(true);
|
|
135
|
+
}
|
|
136
|
+
if (autoAction === 'optIn') {
|
|
137
|
+
await waitFor(() => isMessageReceived({ type: "optInResult", result: true }), 50, 300);
|
|
138
|
+
expect(isMessageReceived({ type: "optInResult", result: true })).toBe(true);
|
|
139
|
+
}
|
|
140
|
+
if (options.testSelfTest && selfTestFrame) {
|
|
141
|
+
await waitFor(() => isMessageReceived({ type: "selfTestResult", result: true }), 50, 300);
|
|
142
|
+
expect(isMessageReceived({ type: "selfTestResult", result: true })).toBe(true);
|
|
143
|
+
}
|
|
144
|
+
await waitFor(() => isMessageReceived({ type: "autoconsentDone" }), 10, 500);
|
|
145
|
+
expect(isMessageReceived({ type: "autoconsentDone" })).toBe(true);
|
|
137
146
|
}
|
|
138
|
-
await waitFor(() => isMessageReceived({ type: "autoconsentDone" }), 10, 500);
|
|
139
|
-
expect(isMessageReceived({ type: "autoconsentDone" })).toBe(true);
|
|
140
147
|
|
|
141
148
|
expect(isMessageReceived({ type: "autoconsentError" })).toBe(false);
|
|
142
149
|
})
|
|
@@ -2,8 +2,6 @@ import generateCMPTests from "../playwright/runner";
|
|
|
2
2
|
|
|
3
3
|
generateCMPTests('Sourcepoint-frame', [
|
|
4
4
|
'https://www.theguardian.com/',
|
|
5
|
-
'https://www.n-tv.de/',
|
|
6
|
-
'https://www.sueddeutsche.de/',
|
|
7
5
|
'https://news.sky.com/',
|
|
8
6
|
]);
|
|
9
7
|
|
|
@@ -15,3 +13,16 @@ generateCMPTests('Sourcepoint-frame', [
|
|
|
15
13
|
], {
|
|
16
14
|
skipRegions: ["US", "GB"],
|
|
17
15
|
});
|
|
16
|
+
|
|
17
|
+
generateCMPTests('Sourcepoint-frame', [
|
|
18
|
+
"https://www.sueddeutsche.de/",
|
|
19
|
+
"https://www.derstandard.at/",
|
|
20
|
+
"https://www.heise.de/",
|
|
21
|
+
'https://www.n-tv.de/',
|
|
22
|
+
], {
|
|
23
|
+
skipRegions: ["US", "GB", "FR"],
|
|
24
|
+
expectPopupOpen: false,
|
|
25
|
+
testOptIn: false,
|
|
26
|
+
testOptOut: false,
|
|
27
|
+
testSelfTest: false,
|
|
28
|
+
})
|