From d8d83b73ad38b284e399aa74c2f5f6dda16c8f5b Mon Sep 17 00:00:00 2001 From: alex-magana Date: Mon, 5 Jan 2026 18:46:37 +0300 Subject: [PATCH 1/5] Reinstate idclient assertion for the Next.js page view e2es --- .../atiAnalytics/assertions/index.ts | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/ws-nextjs-app/cypress/e2e/specialFeatures/atiAnalytics/assertions/index.ts b/ws-nextjs-app/cypress/e2e/specialFeatures/atiAnalytics/assertions/index.ts index 04b25404e60..8269813cc3d 100644 --- a/ws-nextjs-app/cypress/e2e/specialFeatures/atiAnalytics/assertions/index.ts +++ b/ws-nextjs-app/cypress/e2e/specialFeatures/atiAnalytics/assertions/index.ts @@ -6,7 +6,7 @@ import { import { ATI_PAGE_VIEW, ATI_PAGE_VIEW_REVERB, - // ATI_USER_ID_COOKIE, + ATI_USER_ID_COOKIE, getATIParamsFromURL, interceptATIAnalyticsBeacons, getExpectedAtiDestination, @@ -14,7 +14,7 @@ import { import environment from '../../../../support/helpers/getAppEnv'; const usesReverbViewabilityModel = applicationType => - applicationType !== 'lite'; + !['lite', 'amp'].includes(applicationType); const getAppName = service => { if (service === 'ws') { @@ -183,7 +183,6 @@ const validateViewabilityEventDetails = ({ payload, actionType }) => { }; export const assertPageView = ({ - useReverb, pageIdentifier, applicationType, contentType, @@ -196,10 +195,9 @@ export const assertPageView = ({ cy.visit(path, { retryOnStatusCodeFailure: true }); const useViewabilty = usesReverbViewabilityModel(applicationType); - const atiPageViewAlias = - useReverb && useViewabilty && applicationType !== 'amp' - ? ATI_PAGE_VIEW_REVERB - : ATI_PAGE_VIEW; + const atiPageViewAlias = useViewabilty + ? ATI_PAGE_VIEW_REVERB + : ATI_PAGE_VIEW; cy.wait(`@${atiPageViewAlias}`).then(({ request }) => { const params = getATIParamsFromURL(request.url); @@ -210,13 +208,12 @@ export const assertPageView = ({ applicationType, }); - // TODO: Commenting out temporarily until old ATI code is removed - https://bbc.atlassian.net/browse/WS-222 - // if (['responsive', 'lite'].includes(applicationType)) { - // expect(params.idclient).to.equal( - // ATI_USER_ID_COOKIE, - // 'params.idclient (atuserid cookie value)', - // ); - // } + if (['responsive', 'lite'].includes(applicationType)) { + expect(params.idclient).to.equal( + ATI_USER_ID_COOKIE, + 'params.idclient (atuserid cookie value)', + ); + } expect(params.p).to.equal(pageIdentifier, 'params.p (page identifier)'); expect(parseInt(params.s2, 10)).to.equal( From 03b8ca0e0f22fe4eb53efd2522b6bf708e0c0d1e Mon Sep 17 00:00:00 2001 From: alex-magana Date: Mon, 5 Jan 2026 19:17:43 +0300 Subject: [PATCH 2/5] Remove idclient value assertion --- .../atiAnalytics/assertions/index.js | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/cypress/e2e/specialFeatures/atiAnalytics/assertions/index.js b/cypress/e2e/specialFeatures/atiAnalytics/assertions/index.js index 2cafe161fa8..ca1e9b046d0 100644 --- a/cypress/e2e/specialFeatures/atiAnalytics/assertions/index.js +++ b/cypress/e2e/specialFeatures/atiAnalytics/assertions/index.js @@ -94,6 +94,10 @@ const assertLocationSpecificPianoDestinationExists = ({ service }) => { }; const assertReverbViewabilityComponentEventParamsExist = ({ params }) => { + // if (['responsive', 'lite'].includes(applicationType)) { + // expect(params).to.have.property('idclient'); + // } + expect(params).to.have.property('s'); // destination expect(params).to.have.property('events'); // event details expect(params).to.have.property('context'); @@ -250,14 +254,6 @@ const assertViewabilityModelViewEvent = ({ assertReverbViewabilityComponentEventParamsExist({ params }); - // TODO: Commenting out temporarily until old ATI code is removed - https://bbc.atlassian.net/browse/WS-222 - // if (['responsive', 'lite'].includes(applicationType)) { - // expect(params.idclient).to.equal( - // ATI_USER_ID_COOKIE, - // 'params.idclient (atuserid cookie value)', - // ); - // } - expect(params.events).to.satisfy( payload => validateViewabilityEventDetails({ payload, actionType: VIEW_EVENT }), @@ -303,14 +299,6 @@ const assertViewabilityModelClickEvent = ({ params, }); - // TODO: Commenting out temporarily until old ATI code is removed - https://bbc.atlassian.net/browse/WS-222 - // if (['responsive', 'lite'].includes(applicationType)) { - // expect(params.idclient).to.equal( - // ATI_USER_ID_COOKIE, - // 'params.idclient (atuserid cookie value)', - // ); - // } - expect(params.events).to.satisfy( payload => validateViewabilityEventDetails({ From d72d1d92368b7b2ff39f2a912dd6aef037c68709 Mon Sep 17 00:00:00 2001 From: alex-magana Date: Mon, 5 Jan 2026 19:21:22 +0300 Subject: [PATCH 3/5] Ensure idclient exists in viewability events request --- .../atiAnalytics/assertions/index.js | 11 +++++--- .../atiAnalytics/assertions/index.ts | 25 ++++++------------- 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/cypress/e2e/specialFeatures/atiAnalytics/assertions/index.js b/cypress/e2e/specialFeatures/atiAnalytics/assertions/index.js index ca1e9b046d0..57a0387d576 100644 --- a/cypress/e2e/specialFeatures/atiAnalytics/assertions/index.js +++ b/cypress/e2e/specialFeatures/atiAnalytics/assertions/index.js @@ -93,10 +93,13 @@ const assertLocationSpecificPianoDestinationExists = ({ service }) => { }); }; -const assertReverbViewabilityComponentEventParamsExist = ({ params }) => { - // if (['responsive', 'lite'].includes(applicationType)) { - // expect(params).to.have.property('idclient'); - // } +const assertReverbViewabilityComponentEventParamsExist = ({ + params, + applicationType, +}) => { + if (['responsive', 'lite'].includes(applicationType)) { + expect(params).to.have.property('idclient'); + } expect(params).to.have.property('s'); // destination expect(params).to.have.property('events'); // event details diff --git a/ws-nextjs-app/cypress/e2e/specialFeatures/atiAnalytics/assertions/index.ts b/ws-nextjs-app/cypress/e2e/specialFeatures/atiAnalytics/assertions/index.ts index 8269813cc3d..07cd030fe9e 100644 --- a/ws-nextjs-app/cypress/e2e/specialFeatures/atiAnalytics/assertions/index.ts +++ b/ws-nextjs-app/cypress/e2e/specialFeatures/atiAnalytics/assertions/index.ts @@ -93,7 +93,14 @@ const assertLocationSpecificPianoDestinationExists = ({ service }) => { }); }; -const assertReverbViewabilityComponentEventParamsExist = ({ params }) => { +const assertReverbViewabilityComponentEventParamsExist = ({ + params, + applicationType, +}) => { + if (['responsive', 'lite'].includes(applicationType)) { + expect(params).to.have.property('idclient'); + } + expect(params).to.have.property('s'); // destination expect(params).to.have.property('events'); // event details expect(params).to.have.property('context'); @@ -250,14 +257,6 @@ const assertViewabilityModelViewEvent = ({ assertReverbViewabilityComponentEventParamsExist({ params }); - // TODO: Commenting out temporarily until old ATI code is removed - https://bbc.atlassian.net/browse/WS-222 - // if (['responsive', 'lite'].includes(applicationType)) { - // expect(params.idclient).to.equal( - // ATI_USER_ID_COOKIE, - // 'params.idclient (atuserid cookie value)', - // ); - // } - expect(params.events).to.satisfy( payload => validateViewabilityEventDetails({ payload, actionType: VIEW_EVENT }), @@ -300,14 +299,6 @@ const assertViewabilityModelClickEvent = ({ params, }); - // TODO: Commenting out temporarily until old ATI code is removed - https://bbc.atlassian.net/browse/WS-222 - // if (['responsive', 'lite'].includes(applicationType)) { - // expect(params.idclient).to.equal( - // ATI_USER_ID_COOKIE, - // 'params.idclient (atuserid cookie value)', - // ); - // } - expect(params.events).to.satisfy( payload => validateViewabilityEventDetails({ From 90f78f896e0925141e55ea86e55db76519662ee0 Mon Sep 17 00:00:00 2001 From: alex-magana Date: Mon, 5 Jan 2026 19:30:05 +0300 Subject: [PATCH 4/5] Pass applicationType in assertATIComponentClickEvent and assertATIComponentViewEvent --- .../specialFeatures/atiAnalytics/assertions/index.js | 11 ++++++++--- .../specialFeatures/atiAnalytics/assertions/index.ts | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/cypress/e2e/specialFeatures/atiAnalytics/assertions/index.js b/cypress/e2e/specialFeatures/atiAnalytics/assertions/index.js index 57a0387d576..1527fa9debf 100644 --- a/cypress/e2e/specialFeatures/atiAnalytics/assertions/index.js +++ b/cypress/e2e/specialFeatures/atiAnalytics/assertions/index.js @@ -250,12 +250,12 @@ export const assertPageView = ({ const assertViewabilityModelViewEvent = ({ pageIdentifier, params, - // applicationType, + applicationType, siteId, }) => { const eventContext = JSON.parse(params.context); - assertReverbViewabilityComponentEventParamsExist({ params }); + assertReverbViewabilityComponentEventParamsExist({ params, applicationType }); expect(params.events).to.satisfy( payload => @@ -271,6 +271,7 @@ export const assertATIComponentViewEvent = ({ component, pageIdentifier, contentType, + applicationType, siteId, }) => { const requestAlias = `@${component}-viewability-view`; @@ -285,6 +286,7 @@ export const assertATIComponentViewEvent = ({ pageIdentifier, contentType, params, + applicationType, siteId, }); }); @@ -293,13 +295,14 @@ export const assertATIComponentViewEvent = ({ const assertViewabilityModelClickEvent = ({ pageIdentifier, params, - // applicationType, + applicationType, siteId, }) => { const eventContext = JSON.parse(params.context); assertReverbViewabilityComponentEventParamsExist({ params, + applicationType, }); expect(params.events).to.satisfy( @@ -319,6 +322,7 @@ export const assertATIComponentClickEvent = ({ component, contentType, pageIdentifier, + applicationType, siteId, }) => { const requestAlias = `@${component}-viewability-click`; @@ -332,6 +336,7 @@ export const assertATIComponentClickEvent = ({ contentType, pageIdentifier, params, + applicationType, siteId, }); }); diff --git a/ws-nextjs-app/cypress/e2e/specialFeatures/atiAnalytics/assertions/index.ts b/ws-nextjs-app/cypress/e2e/specialFeatures/atiAnalytics/assertions/index.ts index 07cd030fe9e..00305b96af4 100644 --- a/ws-nextjs-app/cypress/e2e/specialFeatures/atiAnalytics/assertions/index.ts +++ b/ws-nextjs-app/cypress/e2e/specialFeatures/atiAnalytics/assertions/index.ts @@ -250,12 +250,12 @@ export const assertPageView = ({ const assertViewabilityModelViewEvent = ({ pageIdentifier, params, - // applicationType, + applicationType, siteId, }) => { const eventContext = JSON.parse(params.context); - assertReverbViewabilityComponentEventParamsExist({ params }); + assertReverbViewabilityComponentEventParamsExist({ params, applicationType }); expect(params.events).to.satisfy( payload => @@ -270,6 +270,7 @@ const assertViewabilityModelViewEvent = ({ export const assertATIComponentViewEvent = ({ component, pageIdentifier, + applicationType, siteId, }) => { const requestAlias = `@${component}-viewability-view`; @@ -282,6 +283,7 @@ export const assertATIComponentViewEvent = ({ assertViewabilityModelViewEvent({ pageIdentifier, params, + applicationType, siteId, }); }); @@ -290,13 +292,14 @@ export const assertATIComponentViewEvent = ({ const assertViewabilityModelClickEvent = ({ pageIdentifier, params, - // applicationType, + applicationType, siteId, }) => { const eventContext = JSON.parse(params.context); assertReverbViewabilityComponentEventParamsExist({ params, + applicationType, }); expect(params.events).to.satisfy( @@ -315,6 +318,7 @@ const assertViewabilityModelClickEvent = ({ export const assertATIComponentClickEvent = ({ component, pageIdentifier, + applicationType, siteId, }) => { const requestAlias = `@${component}-viewability-click`; @@ -326,6 +330,7 @@ export const assertATIComponentClickEvent = ({ assertViewabilityModelClickEvent({ pageIdentifier, params, + applicationType, siteId, }); }); From 91b918c6ef4f85b0359d3cae73615dad2d511bd3 Mon Sep 17 00:00:00 2001 From: alex-magana Date: Mon, 5 Jan 2026 19:53:46 +0300 Subject: [PATCH 5/5] Include applicationType in view and click tests where absent --- .../e2e/specialFeatures/atiAnalytics/assertions/billboard.ts | 4 ---- .../atiAnalytics/assertions/continueReadingButton.ts | 2 ++ .../e2e/specialFeatures/atiAnalytics/assertions/topBarOjs.ts | 4 ++++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ws-nextjs-app/cypress/e2e/specialFeatures/atiAnalytics/assertions/billboard.ts b/ws-nextjs-app/cypress/e2e/specialFeatures/atiAnalytics/assertions/billboard.ts index 9f68970a4ea..62478db2e98 100644 --- a/ws-nextjs-app/cypress/e2e/specialFeatures/atiAnalytics/assertions/billboard.ts +++ b/ws-nextjs-app/cypress/e2e/specialFeatures/atiAnalytics/assertions/billboard.ts @@ -5,7 +5,6 @@ const { BILLBOARD } = COMPONENTS; export const assertBillboardComponentView = ({ pageIdentifier, - contentType, path, applicationType, siteId, @@ -21,7 +20,6 @@ export const assertBillboardComponentView = ({ assertATIComponentViewEvent({ component: BILLBOARD, pageIdentifier, - contentType, applicationType, siteId, }); @@ -30,7 +28,6 @@ export const assertBillboardComponentView = ({ export const assertBillboardComponentClick = ({ pageIdentifier, - contentType, path, applicationType, siteId, @@ -49,7 +46,6 @@ export const assertBillboardComponentClick = ({ assertATIComponentClickEvent({ component: BILLBOARD, pageIdentifier, - contentType, applicationType, siteId, }); diff --git a/ws-nextjs-app/cypress/e2e/specialFeatures/atiAnalytics/assertions/continueReadingButton.ts b/ws-nextjs-app/cypress/e2e/specialFeatures/atiAnalytics/assertions/continueReadingButton.ts index fcaa7d4576e..fba47465733 100644 --- a/ws-nextjs-app/cypress/e2e/specialFeatures/atiAnalytics/assertions/continueReadingButton.ts +++ b/ws-nextjs-app/cypress/e2e/specialFeatures/atiAnalytics/assertions/continueReadingButton.ts @@ -32,6 +32,7 @@ export const assertContinueReadingButtonComponentView = ({ component: CONTINUE_READING_BUTTON, pageIdentifier, contentType, + applicationType, siteId, }); }, @@ -64,6 +65,7 @@ export const assertContinueReadingButtonComponentClick = ({ component: CONTINUE_READING_BUTTON, pageIdentifier, contentType, + applicationType, siteId, }); }, diff --git a/ws-nextjs-app/cypress/e2e/specialFeatures/atiAnalytics/assertions/topBarOjs.ts b/ws-nextjs-app/cypress/e2e/specialFeatures/atiAnalytics/assertions/topBarOjs.ts index 5ee6c57376a..777c896b868 100644 --- a/ws-nextjs-app/cypress/e2e/specialFeatures/atiAnalytics/assertions/topBarOjs.ts +++ b/ws-nextjs-app/cypress/e2e/specialFeatures/atiAnalytics/assertions/topBarOjs.ts @@ -12,6 +12,7 @@ export const assertTopBarOJComponentView = ({ pageIdentifier, contentType, path, + applicationType, siteId, }: AtiAssertionFnProps) => { it('should send a view event for the Top Bar OJ component', () => { @@ -27,6 +28,7 @@ export const assertTopBarOJComponentView = ({ component: TOP_BAR_OJ, pageIdentifier, contentType, + applicationType, siteId, }); }); @@ -36,6 +38,7 @@ export const assertTopBarOJComponentClick = ({ pageIdentifier, contentType, path, + applicationType, siteId, }: AtiAssertionFnProps) => { it('should send a click event for the Top Bar OJ component', () => { @@ -53,6 +56,7 @@ export const assertTopBarOJComponentClick = ({ component: TOP_BAR_OJ, pageIdentifier, contentType, + applicationType, siteId, }); });