From 988112db96f0dcc6675395abcc4df4fa63f3ed59 Mon Sep 17 00:00:00 2001 From: Carter McBride <18412686+carterworks@users.noreply.github.com> Date: Fri, 12 Jun 2026 11:55:56 -0600 Subject: [PATCH 1/8] test(integration): migrate location hints functional specs to Vitest+Playwright+MSW --- .../Location Hints/locationHints.spec.js | 134 ++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 packages/browser/test/integration/specs/Location Hints/locationHints.spec.js diff --git a/packages/browser/test/integration/specs/Location Hints/locationHints.spec.js b/packages/browser/test/integration/specs/Location Hints/locationHints.spec.js new file mode 100644 index 000000000..209a99aa4 --- /dev/null +++ b/packages/browser/test/integration/specs/Location Hints/locationHints.spec.js @@ -0,0 +1,134 @@ +/* +Copyright 2026 Adobe. All rights reserved. +This file is licensed to you under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. You may obtain a copy +of the License at http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed under +the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +OF ANY KIND, either express or implied. See the License for the specific language +governing permissions and limitations under the License. +*/ +import { http, HttpResponse } from "msw"; +import { test, expect, describe } from "../../helpers/testsSetup/extend.js"; +import { sendEventHandler } from "../../helpers/mswjs/handlers.js"; +import alloyConfig from "../../helpers/alloy/config.js"; +import { MAIN_CLUSTER_COOKIE_NAME } from "../../helpers/constants/cookies.js"; +import deleteCookies from "../../helpers/utils/deleteCookies.js"; + +// Handler that returns sgp3 (Singapore, region 3) as the EdgeNetwork location hint. +// This simulates the edge response when the client is routed via the Singapore cluster +// (mboxEdgeCluster=38 maps to sgp3 in Konductor). +const sgp3LocationHintHandler = http.post( + /https:\/\/edge.adobedc.net\/ee\/.*\/?v1\/interact/, + () => { + return HttpResponse.json({ + requestId: "sgp3-location-hint-test", + handle: [ + { + payload: [ + { + id: "41861666193140161934276845651148876988", + namespace: { code: "ECID" }, + }, + ], + type: "identity:result", + }, + { + payload: [ + { scope: "Target", hint: "38", ttlSeconds: 1800 }, + { scope: "AAM", hint: "3", ttlSeconds: 1800 }, + { scope: "EdgeNetwork", hint: "sgp3", ttlSeconds: 1800 }, + ], + type: "locationHint:result", + }, + { + payload: [ + { + key: MAIN_CLUSTER_COOKIE_NAME, + value: "sgp3", + maxAge: 1800, + }, + ], + type: "state:store", + }, + ], + }); + }, +); + +describe("Location Hints", () => { + // C6589015 - The Experience Edge location hint is used on the second request. + test("C6589015 - location hint from first response is included in second request URL", async ({ + alloy, + worker, + networkRecorder, + }) => { + await deleteCookies(); + worker.use(sendEventHandler); + + await alloy("configure", { + ...alloyConfig, + thirdPartyCookiesEnabled: false, + debugEnabled: false, + }); + await alloy("sendEvent", {}); + + // After the first request, the edge response (sendEventResponse.json) sets + // EdgeNetwork hint "or2" and a cluster cookie "or2". + const clusterCookie = document.cookie + .split("; ") + .find((c) => c.startsWith(MAIN_CLUSTER_COOKIE_NAME + "=")); + const locationHint = clusterCookie?.split("=")[1]; + expect(locationHint).toBeTruthy(); + + await alloy("sendEvent", {}); + + const calls = await networkRecorder.findCalls(/edge\.adobedc\.net/, { + minCalls: 2, + }); + expect(calls.length).toBe(2); + + // The first request goes to the base URL without a hint segment + expect(calls[0].request.url).toMatch( + /^https:\/\/[^/]+\/[^/]+\/v1\/interact/, + ); + // The second request should include the location hint in the URL path + expect(calls[1].request.url).toMatch( + new RegExp(`edge\\.adobedc\\.net/ee/${locationHint}/v1/interact`), + ); + }); + + // C6944931 - The legacy Adobe Target location hint is used. + test("C6944931 - legacy mboxEdgeCluster cookie is translated to a location hint on the first request", async ({ + alloy, + worker, + networkRecorder, + }) => { + await deleteCookies(); + + // Set mboxEdgeCluster=38 (Singapore, Konductor region ID 3 = sgp3) + // Alloy reads this cookie and uses it as the initial location hint (/t38/) + document.cookie = "mboxEdgeCluster=38; path=/"; + + worker.use(sgp3LocationHintHandler); + + await alloy("configure", { + ...alloyConfig, + thirdPartyCookiesEnabled: false, + debugEnabled: false, + }); + await alloy("sendEvent", {}); + await alloy("sendEvent", {}); + + const calls = await networkRecorder.findCalls(/edge\.adobedc\.net/, { + minCalls: 2, + }); + expect(calls.length).toBe(2); + + // First request uses the legacy mboxEdgeCluster=38 hint (/t38/ in URL path) + expect(calls[0].request.url).toMatch(/edge\.adobedc\.net\/ee\/t38\//); + // Second request uses the sgp3 hint returned in the edge response + expect(calls[1].request.url).toMatch(/edge\.adobedc\.net\/ee\/sgp3\//); + }); +}); From c37215768231fa0a1e1736778ee96bda6020f551 Mon Sep 17 00:00:00 2001 From: Carter McBride <18412686+carterworks@users.noreply.github.com> Date: Tue, 16 Jun 2026 09:50:04 -0600 Subject: [PATCH 2/8] Use beforeEach/afterEach instead of calls --- .../specs/Location Hints/locationHints.spec.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/packages/browser/test/integration/specs/Location Hints/locationHints.spec.js b/packages/browser/test/integration/specs/Location Hints/locationHints.spec.js index 209a99aa4..5e3588d7b 100644 --- a/packages/browser/test/integration/specs/Location Hints/locationHints.spec.js +++ b/packages/browser/test/integration/specs/Location Hints/locationHints.spec.js @@ -10,7 +10,13 @@ OF ANY KIND, either express or implied. See the License for the specific languag governing permissions and limitations under the License. */ import { http, HttpResponse } from "msw"; -import { test, expect, describe } from "../../helpers/testsSetup/extend.js"; +import { + test, + expect, + describe, + beforeEach, + afterEach, +} from "../../helpers/testsSetup/extend.js"; import { sendEventHandler } from "../../helpers/mswjs/handlers.js"; import alloyConfig from "../../helpers/alloy/config.js"; import { MAIN_CLUSTER_COOKIE_NAME } from "../../helpers/constants/cookies.js"; @@ -58,13 +64,18 @@ const sgp3LocationHintHandler = http.post( ); describe("Location Hints", () => { + beforeEach(async () => { + await deleteCookies(); + }); + afterEach(async () => { + await deleteCookies(); + }); // C6589015 - The Experience Edge location hint is used on the second request. test("C6589015 - location hint from first response is included in second request URL", async ({ alloy, worker, networkRecorder, }) => { - await deleteCookies(); worker.use(sendEventHandler); await alloy("configure", { @@ -105,8 +116,6 @@ describe("Location Hints", () => { worker, networkRecorder, }) => { - await deleteCookies(); - // Set mboxEdgeCluster=38 (Singapore, Konductor region ID 3 = sgp3) // Alloy reads this cookie and uses it as the initial location hint (/t38/) document.cookie = "mboxEdgeCluster=38; path=/"; From d271596b273889df1a6f24f0052794d2f39e3c84 Mon Sep 17 00:00:00 2001 From: Carter McBride <18412686+carterworks@users.noreply.github.com> Date: Tue, 16 Jun 2026 10:06:58 -0600 Subject: [PATCH 3/8] delete redundent deleteCookies --- .../specs/Location Hints/locationHints.spec.js | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/packages/browser/test/integration/specs/Location Hints/locationHints.spec.js b/packages/browser/test/integration/specs/Location Hints/locationHints.spec.js index 5e3588d7b..8c7a6c737 100644 --- a/packages/browser/test/integration/specs/Location Hints/locationHints.spec.js +++ b/packages/browser/test/integration/specs/Location Hints/locationHints.spec.js @@ -10,17 +10,10 @@ OF ANY KIND, either express or implied. See the License for the specific languag governing permissions and limitations under the License. */ import { http, HttpResponse } from "msw"; -import { - test, - expect, - describe, - beforeEach, - afterEach, -} from "../../helpers/testsSetup/extend.js"; +import { test, expect, describe } from "../../helpers/testsSetup/extend.js"; import { sendEventHandler } from "../../helpers/mswjs/handlers.js"; import alloyConfig from "../../helpers/alloy/config.js"; import { MAIN_CLUSTER_COOKIE_NAME } from "../../helpers/constants/cookies.js"; -import deleteCookies from "../../helpers/utils/deleteCookies.js"; // Handler that returns sgp3 (Singapore, region 3) as the EdgeNetwork location hint. // This simulates the edge response when the client is routed via the Singapore cluster @@ -64,12 +57,6 @@ const sgp3LocationHintHandler = http.post( ); describe("Location Hints", () => { - beforeEach(async () => { - await deleteCookies(); - }); - afterEach(async () => { - await deleteCookies(); - }); // C6589015 - The Experience Edge location hint is used on the second request. test("C6589015 - location hint from first response is included in second request URL", async ({ alloy, From e104e5632e6b6336a01ea6612eb49c0f66e02841 Mon Sep 17 00:00:00 2001 From: Carter McBride <18412686+carterworks@users.noreply.github.com> Date: Tue, 16 Jun 2026 10:10:18 -0600 Subject: [PATCH 4/8] Use the cookiestore api --- .../specs/Location Hints/locationHints.spec.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/browser/test/integration/specs/Location Hints/locationHints.spec.js b/packages/browser/test/integration/specs/Location Hints/locationHints.spec.js index 8c7a6c737..5ee1bdcc1 100644 --- a/packages/browser/test/integration/specs/Location Hints/locationHints.spec.js +++ b/packages/browser/test/integration/specs/Location Hints/locationHints.spec.js @@ -74,10 +74,8 @@ describe("Location Hints", () => { // After the first request, the edge response (sendEventResponse.json) sets // EdgeNetwork hint "or2" and a cluster cookie "or2". - const clusterCookie = document.cookie - .split("; ") - .find((c) => c.startsWith(MAIN_CLUSTER_COOKIE_NAME + "=")); - const locationHint = clusterCookie?.split("=")[1]; + const clusterCookie = await cookieStore.get(MAIN_CLUSTER_COOKIE_NAME); + const locationHint = clusterCookie?.value; expect(locationHint).toBeTruthy(); await alloy("sendEvent", {}); @@ -105,7 +103,7 @@ describe("Location Hints", () => { }) => { // Set mboxEdgeCluster=38 (Singapore, Konductor region ID 3 = sgp3) // Alloy reads this cookie and uses it as the initial location hint (/t38/) - document.cookie = "mboxEdgeCluster=38; path=/"; + await cookieStore.set({ name: "mboxEdgeCluster", value: "38", path: "/" }); worker.use(sgp3LocationHintHandler); From 5746c5dc5a41339736d8de7f97345aa3c90f3571 Mon Sep 17 00:00:00 2001 From: Carter McBride <18412686+carterworks@users.noreply.github.com> Date: Tue, 16 Jun 2026 10:22:59 -0600 Subject: [PATCH 5/8] test(integration): harden location hints spec with configId guard and CookieStore API - Migrate document.cookie reads/writes to CookieStore API (cookieStore.get/set) - Add configId guard to inline sgp3LocationHintHandler matching convention in consent_gate.spec.js; throws when configId does not match the configured datastreamId so misconfigured handlers surface immediately - Restore intermediate cluster-cookie assertion in C6944931 between the two sendEvent calls so a storage failure surfaces here rather than as a confusing URL-path mismatch on the second request --- .../Location Hints/locationHints.spec.js | 80 +++++++++++-------- 1 file changed, 47 insertions(+), 33 deletions(-) diff --git a/packages/browser/test/integration/specs/Location Hints/locationHints.spec.js b/packages/browser/test/integration/specs/Location Hints/locationHints.spec.js index 5ee1bdcc1..1b6f18ce7 100644 --- a/packages/browser/test/integration/specs/Location Hints/locationHints.spec.js +++ b/packages/browser/test/integration/specs/Location Hints/locationHints.spec.js @@ -20,39 +20,46 @@ import { MAIN_CLUSTER_COOKIE_NAME } from "../../helpers/constants/cookies.js"; // (mboxEdgeCluster=38 maps to sgp3 in Konductor). const sgp3LocationHintHandler = http.post( /https:\/\/edge.adobedc.net\/ee\/.*\/?v1\/interact/, - () => { - return HttpResponse.json({ - requestId: "sgp3-location-hint-test", - handle: [ - { - payload: [ - { - id: "41861666193140161934276845651148876988", - namespace: { code: "ECID" }, - }, - ], - type: "identity:result", - }, - { - payload: [ - { scope: "Target", hint: "38", ttlSeconds: 1800 }, - { scope: "AAM", hint: "3", ttlSeconds: 1800 }, - { scope: "EdgeNetwork", hint: "sgp3", ttlSeconds: 1800 }, - ], - type: "locationHint:result", - }, - { - payload: [ - { - key: MAIN_CLUSTER_COOKIE_NAME, - value: "sgp3", - maxAge: 1800, - }, - ], - type: "state:store", - }, - ], - }); + async (req) => { + const url = new URL(req.request.url); + const configId = url.searchParams.get("configId"); + + if (configId === alloyConfig.datastreamId) { + return HttpResponse.json({ + requestId: "sgp3-location-hint-test", + handle: [ + { + payload: [ + { + id: "41861666193140161934276845651148876988", + namespace: { code: "ECID" }, + }, + ], + type: "identity:result", + }, + { + payload: [ + { scope: "Target", hint: "38", ttlSeconds: 1800 }, + { scope: "AAM", hint: "3", ttlSeconds: 1800 }, + { scope: "EdgeNetwork", hint: "sgp3", ttlSeconds: 1800 }, + ], + type: "locationHint:result", + }, + { + payload: [ + { + key: MAIN_CLUSTER_COOKIE_NAME, + value: "sgp3", + maxAge: 1800, + }, + ], + type: "state:store", + }, + ], + }); + } + + throw new Error("Handler not configured properly"); }, ); @@ -113,6 +120,13 @@ describe("Location Hints", () => { debugEnabled: false, }); await alloy("sendEvent", {}); + + // The edge response's state:store sets the cluster cookie to sgp3; assert it + // explicitly so a storage failure surfaces here rather than as a confusing + // URL-path mismatch on the second request below. + const clusterCookie = await cookieStore.get(MAIN_CLUSTER_COOKIE_NAME); + expect(clusterCookie?.value).toBe("sgp3"); + await alloy("sendEvent", {}); const calls = await networkRecorder.findCalls(/edge\.adobedc\.net/, { From 50fee2bf791da337cae5ccad5de3f534e4e96c69 Mon Sep 17 00:00:00 2001 From: Carter McBride <18412686+carterworks@users.noreply.github.com> Date: Tue, 16 Jun 2026 10:29:33 -0600 Subject: [PATCH 6/8] Remove slop comments --- .../Location Hints/locationHints.spec.js | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/packages/browser/test/integration/specs/Location Hints/locationHints.spec.js b/packages/browser/test/integration/specs/Location Hints/locationHints.spec.js index 1b6f18ce7..0b78e9b64 100644 --- a/packages/browser/test/integration/specs/Location Hints/locationHints.spec.js +++ b/packages/browser/test/integration/specs/Location Hints/locationHints.spec.js @@ -15,9 +15,8 @@ import { sendEventHandler } from "../../helpers/mswjs/handlers.js"; import alloyConfig from "../../helpers/alloy/config.js"; import { MAIN_CLUSTER_COOKIE_NAME } from "../../helpers/constants/cookies.js"; -// Handler that returns sgp3 (Singapore, region 3) as the EdgeNetwork location hint. -// This simulates the edge response when the client is routed via the Singapore cluster -// (mboxEdgeCluster=38 maps to sgp3 in Konductor). +// Simulates the edge response when routed via the Singapore cluster: +// mboxEdgeCluster=38 maps to sgp3 in Konductor. const sgp3LocationHintHandler = http.post( /https:\/\/edge.adobedc.net\/ee\/.*\/?v1\/interact/, async (req) => { @@ -64,7 +63,6 @@ const sgp3LocationHintHandler = http.post( ); describe("Location Hints", () => { - // C6589015 - The Experience Edge location hint is used on the second request. test("C6589015 - location hint from first response is included in second request URL", async ({ alloy, worker, @@ -79,8 +77,6 @@ describe("Location Hints", () => { }); await alloy("sendEvent", {}); - // After the first request, the edge response (sendEventResponse.json) sets - // EdgeNetwork hint "or2" and a cluster cookie "or2". const clusterCookie = await cookieStore.get(MAIN_CLUSTER_COOKIE_NAME); const locationHint = clusterCookie?.value; expect(locationHint).toBeTruthy(); @@ -92,24 +88,21 @@ describe("Location Hints", () => { }); expect(calls.length).toBe(2); - // The first request goes to the base URL without a hint segment + // no hint expect(calls[0].request.url).toMatch( /^https:\/\/[^/]+\/[^/]+\/v1\/interact/, ); - // The second request should include the location hint in the URL path + // yes hint expect(calls[1].request.url).toMatch( new RegExp(`edge\\.adobedc\\.net/ee/${locationHint}/v1/interact`), ); }); - // C6944931 - The legacy Adobe Target location hint is used. test("C6944931 - legacy mboxEdgeCluster cookie is translated to a location hint on the first request", async ({ alloy, worker, networkRecorder, }) => { - // Set mboxEdgeCluster=38 (Singapore, Konductor region ID 3 = sgp3) - // Alloy reads this cookie and uses it as the initial location hint (/t38/) await cookieStore.set({ name: "mboxEdgeCluster", value: "38", path: "/" }); worker.use(sgp3LocationHintHandler); @@ -121,9 +114,6 @@ describe("Location Hints", () => { }); await alloy("sendEvent", {}); - // The edge response's state:store sets the cluster cookie to sgp3; assert it - // explicitly so a storage failure surfaces here rather than as a confusing - // URL-path mismatch on the second request below. const clusterCookie = await cookieStore.get(MAIN_CLUSTER_COOKIE_NAME); expect(clusterCookie?.value).toBe("sgp3"); @@ -134,9 +124,7 @@ describe("Location Hints", () => { }); expect(calls.length).toBe(2); - // First request uses the legacy mboxEdgeCluster=38 hint (/t38/ in URL path) expect(calls[0].request.url).toMatch(/edge\.adobedc\.net\/ee\/t38\//); - // Second request uses the sgp3 hint returned in the edge response expect(calls[1].request.url).toMatch(/edge\.adobedc\.net\/ee\/sgp3\//); }); }); From 04be6b918a8ad9bab1f23d105fe8b6433fef54b0 Mon Sep 17 00:00:00 2001 From: Carter McBride <18412686+carterworks@users.noreply.github.com> Date: Tue, 16 Jun 2026 10:30:05 -0600 Subject: [PATCH 7/8] remove migrated functional tests --- .../specs/Location Hints/C6589015.js | 61 ----------------- .../specs/Location Hints/C6944931.js | 65 ------------------- 2 files changed, 126 deletions(-) delete mode 100644 packages/browser/test/functional/specs/Location Hints/C6589015.js delete mode 100644 packages/browser/test/functional/specs/Location Hints/C6944931.js diff --git a/packages/browser/test/functional/specs/Location Hints/C6589015.js b/packages/browser/test/functional/specs/Location Hints/C6589015.js deleted file mode 100644 index bc5413262..000000000 --- a/packages/browser/test/functional/specs/Location Hints/C6589015.js +++ /dev/null @@ -1,61 +0,0 @@ -/* -Copyright 2023 Adobe. All rights reserved. -This file is licensed to you under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. You may obtain a copy -of the License at http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under -the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS -OF ANY KIND, either express or implied. See the License for the specific language -governing permissions and limitations under the License. -*/ -import { t } from "testcafe"; -import createNetworkLogger from "../../helpers/networkLogger/index.js"; -import cookies from "../../helpers/cookies.js"; -import createFixture from "../../helpers/createFixture/index.js"; -import { - compose, - orgMainConfigMain, - thirdPartyCookiesDisabled, - debugEnabled, -} from "../../helpers/constants/configParts/index.js"; -import createAlloyProxy from "../../helpers/createAlloyProxy.js"; -import { MAIN_CLUSTER_COOKIE_NAME } from "../../helpers/constants/cookies.js"; - -const networkLogger = createNetworkLogger(); -const config = compose( - orgMainConfigMain, - debugEnabled, - thirdPartyCookiesDisabled, -); - -createFixture({ - title: - "C6589015: The Experience Edge location hint is used on the second request.", - requestHooks: [networkLogger.edgeEndpointLogs], -}); - -test.meta({ - ID: "C6589015", - SEVERITY: "P0", - TEST_RUN: "Regression", -}); - -test("Test C6589015: The Experience Edge location hint is used on the second request.", async () => { - const alloy = createAlloyProxy(); - await alloy.configure(config); - await alloy.sendEvent({}); - - const locationHint = await cookies.get(MAIN_CLUSTER_COOKIE_NAME); - await t.expect(locationHint).ok(); - - await alloy.sendEvent({}); - - const urls = networkLogger.edgeEndpointLogs.requests.map( - (r) => r.request.url, - ); - await t.expect(urls[0]).match(/^https:\/\/[^/]+\/[^/]+\/v1\/interact/); - await t - .expect(urls[1]) - .match(new RegExp(`^https://[^/]+/[^/]+/${locationHint}/v1/interact`)); -}); diff --git a/packages/browser/test/functional/specs/Location Hints/C6944931.js b/packages/browser/test/functional/specs/Location Hints/C6944931.js deleted file mode 100644 index 5b2f1473a..000000000 --- a/packages/browser/test/functional/specs/Location Hints/C6944931.js +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright 2023 Adobe. All rights reserved. -This file is licensed to you under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. You may obtain a copy -of the License at http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under -the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS -OF ANY KIND, either express or implied. See the License for the specific language -governing permissions and limitations under the License. -*/ -import { t } from "testcafe"; -import createNetworkLogger from "../../helpers/networkLogger/index.js"; -import cookies from "../../helpers/cookies.js"; -import createFixture from "../../helpers/createFixture/index.js"; -import { - compose, - orgMainConfigMain, - thirdPartyCookiesDisabled, - debugEnabled, -} from "../../helpers/constants/configParts/index.js"; -import createAlloyProxy from "../../helpers/createAlloyProxy.js"; -import { MAIN_CLUSTER_COOKIE_NAME } from "../../helpers/constants/cookies.js"; - -const networkLogger = createNetworkLogger(); -const config = compose( - orgMainConfigMain, - debugEnabled, - thirdPartyCookiesDisabled, -); - -createFixture({ - title: "C6944931: The legacy Adobe Target location hint is used.", - requestHooks: [networkLogger.edgeEndpointLogs], -}); - -test.meta({ - ID: "C6944931", - SEVERITY: "P0", - TEST_RUN: "Regression", -}); - -test("Test C6944931: The legacy Adobe Target location hint is used.", async () => { - // 38 = singapore, Konductor region ID 3 - await t.setCookies({ - name: "mboxEdgeCluster", - value: "38", - domain: "alloyio.com", - path: "/", - }); - const alloy = createAlloyProxy(); - await alloy.configure(config); - await alloy.sendEvent({}); - - const locationHint = await cookies.get(MAIN_CLUSTER_COOKIE_NAME); - await t.expect(locationHint).eql("sgp3"); - - await alloy.sendEvent({}); - - const urls = networkLogger.edgeEndpointLogs.requests.map( - (r) => r.request.url, - ); - await t.expect(urls[0]).match(/^https:\/\/[^/]+\/[^/]+\/t38\/v1\/interact/); - await t.expect(urls[1]).match(/^https:\/\/[^/]+\/[^/]+\/sgp3\/v1\/interact/); -}); From a20f511fa4d95a6dcb1ada069b468623110f02b0 Mon Sep 17 00:00:00 2001 From: Carter McBride <18412686+carterworks@users.noreply.github.com> Date: Fri, 26 Jun 2026 16:35:11 -0600 Subject: [PATCH 8/8] test(functional): restore migrated functional specs as review signal Keep the original testcafe functional specs alongside the new Vitest+Playwright+MSW integration suite until these migration branches merge, so reviewers retain the pre-migration signal. --- .../specs/Location Hints/C6589015.js | 61 +++++++++++++++++ .../specs/Location Hints/C6944931.js | 65 +++++++++++++++++++ 2 files changed, 126 insertions(+) create mode 100644 packages/browser/test/functional/specs/Location Hints/C6589015.js create mode 100644 packages/browser/test/functional/specs/Location Hints/C6944931.js diff --git a/packages/browser/test/functional/specs/Location Hints/C6589015.js b/packages/browser/test/functional/specs/Location Hints/C6589015.js new file mode 100644 index 000000000..bc5413262 --- /dev/null +++ b/packages/browser/test/functional/specs/Location Hints/C6589015.js @@ -0,0 +1,61 @@ +/* +Copyright 2023 Adobe. All rights reserved. +This file is licensed to you under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. You may obtain a copy +of the License at http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed under +the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +OF ANY KIND, either express or implied. See the License for the specific language +governing permissions and limitations under the License. +*/ +import { t } from "testcafe"; +import createNetworkLogger from "../../helpers/networkLogger/index.js"; +import cookies from "../../helpers/cookies.js"; +import createFixture from "../../helpers/createFixture/index.js"; +import { + compose, + orgMainConfigMain, + thirdPartyCookiesDisabled, + debugEnabled, +} from "../../helpers/constants/configParts/index.js"; +import createAlloyProxy from "../../helpers/createAlloyProxy.js"; +import { MAIN_CLUSTER_COOKIE_NAME } from "../../helpers/constants/cookies.js"; + +const networkLogger = createNetworkLogger(); +const config = compose( + orgMainConfigMain, + debugEnabled, + thirdPartyCookiesDisabled, +); + +createFixture({ + title: + "C6589015: The Experience Edge location hint is used on the second request.", + requestHooks: [networkLogger.edgeEndpointLogs], +}); + +test.meta({ + ID: "C6589015", + SEVERITY: "P0", + TEST_RUN: "Regression", +}); + +test("Test C6589015: The Experience Edge location hint is used on the second request.", async () => { + const alloy = createAlloyProxy(); + await alloy.configure(config); + await alloy.sendEvent({}); + + const locationHint = await cookies.get(MAIN_CLUSTER_COOKIE_NAME); + await t.expect(locationHint).ok(); + + await alloy.sendEvent({}); + + const urls = networkLogger.edgeEndpointLogs.requests.map( + (r) => r.request.url, + ); + await t.expect(urls[0]).match(/^https:\/\/[^/]+\/[^/]+\/v1\/interact/); + await t + .expect(urls[1]) + .match(new RegExp(`^https://[^/]+/[^/]+/${locationHint}/v1/interact`)); +}); diff --git a/packages/browser/test/functional/specs/Location Hints/C6944931.js b/packages/browser/test/functional/specs/Location Hints/C6944931.js new file mode 100644 index 000000000..5b2f1473a --- /dev/null +++ b/packages/browser/test/functional/specs/Location Hints/C6944931.js @@ -0,0 +1,65 @@ +/* +Copyright 2023 Adobe. All rights reserved. +This file is licensed to you under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. You may obtain a copy +of the License at http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed under +the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +OF ANY KIND, either express or implied. See the License for the specific language +governing permissions and limitations under the License. +*/ +import { t } from "testcafe"; +import createNetworkLogger from "../../helpers/networkLogger/index.js"; +import cookies from "../../helpers/cookies.js"; +import createFixture from "../../helpers/createFixture/index.js"; +import { + compose, + orgMainConfigMain, + thirdPartyCookiesDisabled, + debugEnabled, +} from "../../helpers/constants/configParts/index.js"; +import createAlloyProxy from "../../helpers/createAlloyProxy.js"; +import { MAIN_CLUSTER_COOKIE_NAME } from "../../helpers/constants/cookies.js"; + +const networkLogger = createNetworkLogger(); +const config = compose( + orgMainConfigMain, + debugEnabled, + thirdPartyCookiesDisabled, +); + +createFixture({ + title: "C6944931: The legacy Adobe Target location hint is used.", + requestHooks: [networkLogger.edgeEndpointLogs], +}); + +test.meta({ + ID: "C6944931", + SEVERITY: "P0", + TEST_RUN: "Regression", +}); + +test("Test C6944931: The legacy Adobe Target location hint is used.", async () => { + // 38 = singapore, Konductor region ID 3 + await t.setCookies({ + name: "mboxEdgeCluster", + value: "38", + domain: "alloyio.com", + path: "/", + }); + const alloy = createAlloyProxy(); + await alloy.configure(config); + await alloy.sendEvent({}); + + const locationHint = await cookies.get(MAIN_CLUSTER_COOKIE_NAME); + await t.expect(locationHint).eql("sgp3"); + + await alloy.sendEvent({}); + + const urls = networkLogger.edgeEndpointLogs.requests.map( + (r) => r.request.url, + ); + await t.expect(urls[0]).match(/^https:\/\/[^/]+\/[^/]+\/t38\/v1\/interact/); + await t.expect(urls[1]).match(/^https:\/\/[^/]+\/[^/]+\/sgp3\/v1\/interact/); +});