Skip to content

Commit 2ee620a

Browse files
Vahid Kayclaude
andcommitted
E2E: seed _fbc for WebKit/Safari fbclid test (ITP)
Safari's ITP blocks the JS-set _fbc cookie, so PageView-with-fbclid failed with "_fbc not present" on the safari-ios (WebKit) shard. Seed _fbc deterministically for WebKit as already done for Brave (which strips fbclid); the fbc dedup assertion (pixel cookie == CAPI fbc) is what the test verifies. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 06ab5c1 commit 2ee620a

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

tests/e2e/events-test.spec.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,13 @@ test('PageView with fbclid', async ({ page }, testInfo) => {
229229
const { testId, pixelCapture } = await TestSetup.init(page, 'PageView', testInfo);
230230

231231
const fbclid = process.env.TEST_FBCLID || `e2e${Date.now()}`;
232-
const isBraveProject = testInfo?.project?.name?.includes('brave');
232+
const projectName = testInfo?.project?.name || '';
233+
// Brave strips fbclid; WebKit/Safari ITP blocks the JS-set _fbc cookie. In both
234+
// cases fbevents can't reliably persist _fbc, so seed it deterministically —
235+
// the fbc dedup assertion (pixel cookie == CAPI user_data.fbc) is what we verify.
236+
const needsSeededFbc = projectName.includes('brave') || projectName.includes('safari-ios');
233237

234-
if (isBraveProject) {
238+
if (needsSeededFbc) {
235239
const seededFbc = `fb.1.${Date.now()}.${fbclid}`;
236240
await page.context().addCookies([{ name: '_fbc', value: seededFbc, url: process.env.WORDPRESS_URL }]);
237241
}
@@ -241,7 +245,7 @@ test('PageView with fbclid', async ({ page }, testInfo) => {
241245
await TestSetup.waitForPageReady(page);
242246
await eventPromise;
243247

244-
const validator = new EventValidator(testId, true, false, { allowBraveFbcNormalization: isBraveProject });
248+
const validator = new EventValidator(testId, true, false, { allowBraveFbcNormalization: needsSeededFbc });
245249
await validator.checkDebugLog();
246250
const result = await validator.validate('PageView', page);
247251

0 commit comments

Comments
 (0)