From 5299c5715f454b70445352ec24e6a8ab930baf15 Mon Sep 17 00:00:00 2001 From: mechrm02 Date: Tue, 30 Dec 2025 17:31:23 +0000 Subject: [PATCH 1/4] refactor:move ATIAnalytics tests to article page --- .../cypress/e2e/articlePage/index.cy.ts | 75 +++++++++++++++++++ .../specialFeatures/atiAnalytics/index.cy.ts | 42 ----------- 2 files changed, 75 insertions(+), 42 deletions(-) diff --git a/ws-nextjs-app/cypress/e2e/articlePage/index.cy.ts b/ws-nextjs-app/cypress/e2e/articlePage/index.cy.ts index a86339d19b4..773e09c28be 100644 --- a/ws-nextjs-app/cypress/e2e/articlePage/index.cy.ts +++ b/ws-nextjs-app/cypress/e2e/articlePage/index.cy.ts @@ -1,5 +1,6 @@ /* eslint-disable import/no-relative-packages */ import { ARTICLE_PAGE } from '#app/routes/utils/pageTypes'; +import { assertPageView } from '#cypress/e2e/specialFeatures/atiAnalytics/assertions'; import runTestsForPage, { TestDataType, } from '../../support/helpers/runTestsForPage'; @@ -20,6 +21,38 @@ import { assertTopBarOJComponentView, } from '../specialFeatures/atiAnalytics/assertions/topBarOjs'; import { setUserIDCookie } from '../specialFeatures/atiAnalytics/helpers'; +import { + assertArticleLiteSiteLinkComponentClick, + assertArticleLiteSiteLinkComponentView, +} from '../specialFeatures/atiAnalytics/assertions/articleLiteSiteLink'; +import { + assertTopStoriesComponentClick, + assertTopStoriesComponentView, +} from '../specialFeatures/atiAnalytics/assertions/topStories'; +import { + assertFeaturesAnalysisComponentClick, + assertFeaturesAnalysisComponentView, +} from '../specialFeatures/atiAnalytics/assertions/featuresAnalysis'; +import { + assertPodcastPromoComponentClick, + assertPodcastPromoComponentView, +} from '../specialFeatures/atiAnalytics/assertions/podcastPromo'; +import { + assertRelatedTopicsComponentClick, + assertRelatedTopicsComponentView, +} from '../specialFeatures/atiAnalytics/assertions/relatedTopics'; +import { + assertRelatedContentComponentClick, + assertRelatedContentComponentView, +} from '../specialFeatures/atiAnalytics/assertions/relatedContent'; +import { + assertMostReadComponentClick, + assertMostReadComponentView, +} from '../specialFeatures/atiAnalytics/assertions/mostRead'; +import { + assertLatestMediaComponentClick, + assertLatestMediaComponentView, +} from '../specialFeatures/atiAnalytics/assertions/latestMedia'; const canonicalTests = [ testsForAllPages, @@ -238,6 +271,21 @@ const nonSmokeCanonicalTestSuites = [ ]; const atiAnalyticsTestSuites = [ + { + path: '/hausa/articles/cw43vy8zdjvo', + runforEnv: ['local', 'live'], + service: 'hausa', + pageIdentifier: 'hausa.articles.cw43vy8zdjvo.page', + siteId: 51, + applicationType: 'responsive', + contentType: 'article-sfv', + useReverb: true, + tests: [ + assertPageView, + assertLatestMediaComponentView, + assertLatestMediaComponentClick, + ], + }, { path: '/hindi/articles/cn8xe1llnyyo', runforEnv: ['live'], @@ -251,6 +299,33 @@ const atiAnalyticsTestSuites = [ assertContinueReadingButtonComponentView, ], }, + { + path: '/gahuza/articles/c5y51yxeg53o', + runforEnv: ['local'], + service: 'gahuza', + pageIdentifier: 'gahuza.articles.c5y51yxeg53o.page', + siteId: 40, + applicationType: 'responsive', + contentType: 'article', + useReverb: true, + tests: [ + assertPageView, + assertArticleLiteSiteLinkComponentView, + assertArticleLiteSiteLinkComponentClick, + assertFeaturesAnalysisComponentView, + assertFeaturesAnalysisComponentClick, + assertMostReadComponentView, + assertMostReadComponentClick, + assertPodcastPromoComponentView, + assertPodcastPromoComponentClick, + assertRelatedTopicsComponentView, + assertRelatedTopicsComponentClick, + assertRelatedContentComponentView, + assertRelatedContentComponentClick, + assertTopStoriesComponentView, + assertTopStoriesComponentClick, + ], + }, { path: '/polska/articles/c639526lxlro', runforEnv: ['local'], diff --git a/ws-nextjs-app/cypress/e2e/specialFeatures/atiAnalytics/index.cy.ts b/ws-nextjs-app/cypress/e2e/specialFeatures/atiAnalytics/index.cy.ts index 3148b756c10..905264bfeb6 100644 --- a/ws-nextjs-app/cypress/e2e/specialFeatures/atiAnalytics/index.cy.ts +++ b/ws-nextjs-app/cypress/e2e/specialFeatures/atiAnalytics/index.cy.ts @@ -97,48 +97,6 @@ const canonicalTestSuites = [ assertScrollableNavigationComponentClick, ], }, - { - path: '/gahuza/articles/c5y51yxeg53o', - runforEnv: ['local'], - service: 'gahuza', - pageIdentifier: 'gahuza.articles.c5y51yxeg53o.page', - siteId: 40, - applicationType: 'responsive', - contentType: 'article', - useReverb: true, - tests: [ - assertPageView, - assertArticleLiteSiteLinkComponentView, - assertArticleLiteSiteLinkComponentClick, - assertTopStoriesComponentView, - assertTopStoriesComponentClick, - assertFeaturesAnalysisComponentView, - assertFeaturesAnalysisComponentClick, - assertPodcastPromoComponentView, - assertPodcastPromoComponentClick, - assertRelatedTopicsComponentView, - assertRelatedTopicsComponentClick, - assertRelatedContentComponentView, - assertRelatedContentComponentClick, - assertMostReadComponentView, - assertMostReadComponentClick, - ], - }, - { - path: '/hausa/articles/cw43vy8zdjvo', - runforEnv: ['local', 'live'], - service: 'hausa', - pageIdentifier: 'hausa.articles.cw43vy8zdjvo.page', - siteId: 51, - applicationType: 'responsive', - contentType: 'article-sfv', - useReverb: true, - tests: [ - assertPageView, - assertLatestMediaComponentView, - assertLatestMediaComponentClick, - ], - }, // TODO: Resolve error which is preventing e2e tests to run - https://bbc.atlassian.net/browse/WS-1745 // { // path: '/hindi/articles/c9w59wnx27ro', From 027c7be7493e9999f3fafd022d39a4ac1838b8fe Mon Sep 17 00:00:00 2001 From: mechrm02 Date: Tue, 6 Jan 2026 11:23:14 +0000 Subject: [PATCH 2/4] refactor:add .amp and .lite tests coverage --- .../cypress/e2e/articlePage/index.cy.ts | 160 +++++++++++++++++- .../specialFeatures/atiAnalytics/index.cy.ts | 152 ++--------------- 2 files changed, 162 insertions(+), 150 deletions(-) diff --git a/ws-nextjs-app/cypress/e2e/articlePage/index.cy.ts b/ws-nextjs-app/cypress/e2e/articlePage/index.cy.ts index 773e09c28be..28e198e9ac3 100644 --- a/ws-nextjs-app/cypress/e2e/articlePage/index.cy.ts +++ b/ws-nextjs-app/cypress/e2e/articlePage/index.cy.ts @@ -53,6 +53,16 @@ import { assertLatestMediaComponentClick, assertLatestMediaComponentView, } from '../specialFeatures/atiAnalytics/assertions/latestMedia'; +import { + assertSocialEmbedComponentClick, + assertSocialEmbedComponentView, +} from '../specialFeatures/atiAnalytics/assertions/socialEmbed'; +import { + assertScrollablePromoComponentClick, + assertScrollablePromoComponentView, +} from '../specialFeatures/atiAnalytics/assertions/scrollablePromo'; +import getPathWithSuffix from '../../support/helpers/getPathWithSuffix'; +import { assertLiteSiteSummaryComponentToMainSiteClick } from '../specialFeatures/atiAnalytics/assertions/liteSiteSummary'; const canonicalTests = [ testsForAllPages, @@ -326,6 +336,96 @@ const atiAnalyticsTestSuites = [ assertTopStoriesComponentClick, ], }, + { + path: 'news/articles/c0g992jmmkko', + runforEnv: ['local', 'test'], + service: 'news', + pageIdentifier: 'news.articles.c0g992jmmkko.page', + siteId: 64, + applicationType: 'amp', + contentType: 'article', + useReverb: true, + tests: [assertPageView], + }, + { + path: '/news/articles/c9djwv3q6w9o', + runforEnv: ['live'], + service: 'news', + pageIdentifier: 'news.articles.c9djwv3q6w9o.page', + siteId: 64, + applicationType: 'amp', + contentType: 'article', + useReverb: true, + tests: [assertPageView], + }, + { + path: '/pidgin/articles/ce9wk6glg4lo', + runforEnv: ['local', 'live'], + service: 'pidgin', + pageIdentifier: 'pidgin.articles.ce9wk6glg4lo.page', + siteId: 70, + applicationType: 'responsive', + contentType: 'article', + useReverb: true, + tests: [ + assertPageView, + assertFeaturesAnalysisComponentView, + assertMostReadComponentView, + assertMostReadComponentClick, + assertRelatedTopicsComponentView, + assertRelatedTopicsComponentClick, + assertRelatedContentComponentView, + assertRelatedContentComponentClick, + assertTopStoriesComponentView, + assertTopStoriesComponentClick, + assertSocialEmbedComponentView, + assertSocialEmbedComponentClick, + ], + }, + { + path: '/pidgin/articles/cyv3zm4y428o', + runforEnv: ['live'], + service: 'pidgin', + pageIdentifier: 'pidgin.articles.cyv3zm4y428o.page', + siteId: 70, + applicationType: 'responsive', + contentType: 'article', + useReverb: true, + tests: [ + assertPageView, + assertFeaturesAnalysisComponentView, + assertFeaturesAnalysisComponentClick, + assertMostReadComponentView, + assertMostReadComponentClick, + assertRelatedTopicsComponentView, + assertRelatedTopicsComponentClick, + assertRelatedContentComponentView, + assertRelatedContentComponentClick, + assertTopStoriesComponentView, + assertTopStoriesComponentClick, + assertScrollablePromoComponentClick, + assertScrollablePromoComponentView, + ], + }, + { + path: '/pidgin/articles/cw0x29n2pvqo', + runforEnv: ['local', 'live'], + service: 'pidgin', + pageIdentifier: 'pidgin.articles.cw0x29n2pvqo.page', + siteId: 70, + applicationType: 'responsive', + contentType: 'article-sfv', + useReverb: true, + tests: [ + assertPageView, + assertLatestMediaComponentClick, + assertLatestMediaComponentView, + assertRelatedTopicsComponentView, + assertRelatedTopicsComponentClick, + assertRelatedContentComponentView, + assertRelatedContentComponentClick, + ], + }, { path: '/polska/articles/c639526lxlro', runforEnv: ['local'], @@ -335,7 +435,11 @@ const atiAnalyticsTestSuites = [ applicationType: 'responsive', contentType: 'article', useReverb: true, - tests: [assertTopBarOJComponentClick, assertTopBarOJComponentView], + tests: [ + assertPageView, + assertTopBarOJComponentClick, + assertTopBarOJComponentView, + ], }, ] as unknown as TestDataType[]; @@ -379,17 +483,57 @@ const liteTestSuites = canonicalTestSuites }; }); +const atiAmpTestSuites = atiAnalyticsTestSuites.map(testSuite => { + return { + ...testSuite, + path: getPathWithSuffix({ path: testSuite.path, suffix: '.amp' }), + useReverb: true, + applicationType: 'amp', + tests: [assertPageView], + }; +}); + +const atiLiteTestSuites = atiAnalyticsTestSuites + .filter(({ path }) => path !== '/ws/languages') + .map(testSuite => { + const excludedLiteTests = [ + assertPodcastPromoComponentView, // Podcast promo removed from lite article pages + assertPodcastPromoComponentClick, // Podcast promo removed from lite article pages + assertSocialEmbedComponentView, // Social embeds removed from lite article pages + assertSocialEmbedComponentClick, // Social embeds removed from lite article pages + assertArticleLiteSiteLinkComponentView, // Lite Site Link only displayed on canonical article pages + assertArticleLiteSiteLinkComponentClick, // Lite Site Link only displayed on canonical article pages + assertFeaturesAnalysisComponentClick, // Features & Analysis component click event test not working on lite pages + ]; + + const liteSiteTests = testSuite.tests + .filter(test => !excludedLiteTests.includes(test)) + .filter( + test => + // Exclude component click tests, as component click support is not supported on all components yet + !test.name.toLowerCase().includes('click'), + ); + + // All lite enabled pages should have the Lite Site Summary component + liteSiteTests.push(assertLiteSiteSummaryComponentToMainSiteClick); + + return { + ...testSuite, + path: getPathWithSuffix({ path: testSuite.path, suffix: '.lite' }), + applicationType: 'lite', + useReverb: true, + tests: [...liteSiteTests], + }; + }); + runTestsForPage({ pageType: ARTICLE_PAGE, beforeEachFns: [], testSuites: [ - ...atiAnalyticsTestSuites, - ...atiAnalyticsTestSuites.map(testSuite => ({ - ...testSuite, - path: `${testSuite.path}.lite`, - applicationType: 'lite', - })), - ], + ...atiAmpTestSuites, + ...atiAnalyticsTestSuites.filter(({ service }) => service !== 'news'), + ...atiLiteTestSuites, + ] as unknown as TestDataType[], beforeAll: [setUserIDCookie], }); diff --git a/ws-nextjs-app/cypress/e2e/specialFeatures/atiAnalytics/index.cy.ts b/ws-nextjs-app/cypress/e2e/specialFeatures/atiAnalytics/index.cy.ts index 905264bfeb6..97528437185 100644 --- a/ws-nextjs-app/cypress/e2e/specialFeatures/atiAnalytics/index.cy.ts +++ b/ws-nextjs-app/cypress/e2e/specialFeatures/atiAnalytics/index.cy.ts @@ -8,35 +8,12 @@ import { setUserIDCookie } from '../../../../../cypress/e2e/specialFeatures/atiA // assertRecommendationsComponentClick, // assertRecommendationsComponentView, // } from './assertions/recommendations'; -import { - assertRelatedContentComponentClick, - assertRelatedContentComponentView, -} from './assertions/relatedContent'; -import { - assertFeaturesAnalysisComponentView, - assertFeaturesAnalysisComponentClick, -} from './assertions/featuresAnalysis'; +import { assertFeaturesAnalysisComponentClick } from './assertions/featuresAnalysis'; import { assertScrollableNavigationComponentView, assertScrollableNavigationComponentClick, } from '../../../../../cypress/e2e/specialFeatures/atiAnalytics/assertions/navigation'; import { assertLiteSiteSummaryComponentToMainSiteClick } from '../../../../../cypress/e2e/specialFeatures/atiAnalytics/assertions/liteSiteSummary'; -import { - assertLatestMediaComponentClick, - assertLatestMediaComponentView, -} from './assertions/latestMedia'; -import { - assertRelatedTopicsComponentClick, - assertRelatedTopicsComponentView, -} from './assertions/relatedTopics'; -import { - assertScrollablePromoComponentClick, - assertScrollablePromoComponentView, -} from './assertions/scrollablePromo'; -import { - assertTopStoriesComponentClick, - assertTopStoriesComponentView, -} from './assertions/topStories'; import { assertArticleLiteSiteLinkComponentClick, assertArticleLiteSiteLinkComponentView, @@ -49,10 +26,6 @@ import { assertPodcastPromoComponentClick, assertPodcastPromoComponentView, } from './assertions/podcastPromo'; -import { - assertMostReadComponentClick, - assertMostReadComponentView, -} from './assertions/mostRead'; import { assertSocialEmbedComponentClick, assertSocialEmbedComponentView, @@ -124,85 +97,6 @@ const canonicalTestSuites = [ // assertMostReadComponentClick, // ], // }, - { - path: '/pidgin/articles/ce9wk6glg4lo', - runforEnv: ['local', 'live'], - service: 'pidgin', - pageIdentifier: 'pidgin.articles.ce9wk6glg4lo.page', - siteId: 70, - applicationType: 'responsive', - contentType: 'article', - useReverb: true, - tests: [ - assertPageView, - assertTopStoriesComponentView, - assertTopStoriesComponentClick, - assertFeaturesAnalysisComponentView, - assertSocialEmbedComponentView, - assertSocialEmbedComponentClick, - assertRelatedTopicsComponentView, - assertRelatedTopicsComponentClick, - assertRelatedContentComponentView, - assertRelatedContentComponentClick, - assertMostReadComponentView, - assertMostReadComponentClick, - ], - }, - { - path: '/pidgin/articles/cyv3zm4y428o', - runforEnv: ['live'], - service: 'pidgin', - pageIdentifier: 'pidgin.articles.cyv3zm4y428o.page', - siteId: 70, - applicationType: 'responsive', - contentType: 'article', - useReverb: true, - tests: [ - assertPageView, - assertTopStoriesComponentView, - assertTopStoriesComponentClick, - assertFeaturesAnalysisComponentView, - assertFeaturesAnalysisComponentClick, - assertScrollablePromoComponentClick, - assertScrollablePromoComponentView, - assertRelatedTopicsComponentView, - assertRelatedTopicsComponentClick, - assertRelatedContentComponentView, - assertRelatedContentComponentClick, - assertMostReadComponentView, - assertMostReadComponentClick, - ], - }, - { - path: '/pidgin/articles/cw0x29n2pvqo', - runforEnv: ['local', 'live'], - service: 'pidgin', - pageIdentifier: 'pidgin.articles.cw0x29n2pvqo.page', - siteId: 70, - applicationType: 'responsive', - contentType: 'article-sfv', - useReverb: true, - tests: [ - assertPageView, - assertLatestMediaComponentClick, - assertLatestMediaComponentView, - assertRelatedTopicsComponentView, - assertRelatedTopicsComponentClick, - assertRelatedContentComponentView, - assertRelatedContentComponentClick, - ], - }, - { - path: '/polska/articles/c639526lxlro', - runforEnv: ['local'], - service: 'polska', - pageIdentifier: 'polska.articles.c639526lxlro.page', - siteId: 135, - applicationType: 'responsive', - contentType: 'article', - useReverb: true, - tests: [assertPageView], - }, ]; const supportsAmp = ({ contentType }: { contentType: string }) => @@ -215,41 +109,15 @@ const supportsAmp = ({ contentType }: { contentType: string }) => 'static', ].includes(contentType); -const ampTestSuites = canonicalTestSuites - .filter(supportsAmp) - .map(testSuite => { - return { - ...testSuite, - path: getPathWithSuffix({ path: testSuite.path, suffix: '.amp' }), - useReverb: true, - applicationType: 'amp', - tests: [assertPageView], - }; - }) - .concat([ - { - path: 'news/articles/c0g992jmmkko.amp', - runforEnv: ['local', 'test'], - service: 'news', - pageIdentifier: 'news.articles.c0g992jmmkko.page', - siteId: 64, - applicationType: 'amp', - contentType: 'article', - useReverb: true, - tests: [assertPageView], - }, - { - path: '/news/articles/c9djwv3q6w9o.amp', - runforEnv: ['live'], - service: 'news', - pageIdentifier: 'news.articles.c9djwv3q6w9o.page', - siteId: 64, - applicationType: 'amp', - contentType: 'article', - useReverb: true, - tests: [assertPageView], - }, - ]); +const ampTestSuites = canonicalTestSuites.filter(supportsAmp).map(testSuite => { + return { + ...testSuite, + path: getPathWithSuffix({ path: testSuite.path, suffix: '.amp' }), + useReverb: true, + applicationType: 'amp', + tests: [assertPageView], + }; +}); const liteTestSuites = canonicalTestSuites .filter(({ path }) => path !== '/ws/languages') From 72643c76d67650db7b7f77011f16d2cf84ee45d2 Mon Sep 17 00:00:00 2001 From: mechrm02 Date: Tue, 6 Jan 2026 11:28:33 +0000 Subject: [PATCH 3/4] refactor:remove news from lite tests --- ws-nextjs-app/cypress/e2e/articlePage/index.cy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ws-nextjs-app/cypress/e2e/articlePage/index.cy.ts b/ws-nextjs-app/cypress/e2e/articlePage/index.cy.ts index 28e198e9ac3..f37834e51cf 100644 --- a/ws-nextjs-app/cypress/e2e/articlePage/index.cy.ts +++ b/ws-nextjs-app/cypress/e2e/articlePage/index.cy.ts @@ -494,7 +494,7 @@ const atiAmpTestSuites = atiAnalyticsTestSuites.map(testSuite => { }); const atiLiteTestSuites = atiAnalyticsTestSuites - .filter(({ path }) => path !== '/ws/languages') + .filter(({ path, service }) => path !== '/ws/languages' && service !== 'news') .map(testSuite => { const excludedLiteTests = [ assertPodcastPromoComponentView, // Podcast promo removed from lite article pages From 7e7ceee26ad36db2c03a86401f4ae0f5a11795c0 Mon Sep 17 00:00:00 2001 From: mechrm02 Date: Tue, 6 Jan 2026 12:04:19 +0000 Subject: [PATCH 4/4] refactor:update news logic for amp tests --- .../cypress/e2e/articlePage/index.cy.ts | 65 ++++++++++--------- 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/ws-nextjs-app/cypress/e2e/articlePage/index.cy.ts b/ws-nextjs-app/cypress/e2e/articlePage/index.cy.ts index f37834e51cf..7183bf2233d 100644 --- a/ws-nextjs-app/cypress/e2e/articlePage/index.cy.ts +++ b/ws-nextjs-app/cypress/e2e/articlePage/index.cy.ts @@ -336,28 +336,6 @@ const atiAnalyticsTestSuites = [ assertTopStoriesComponentClick, ], }, - { - path: 'news/articles/c0g992jmmkko', - runforEnv: ['local', 'test'], - service: 'news', - pageIdentifier: 'news.articles.c0g992jmmkko.page', - siteId: 64, - applicationType: 'amp', - contentType: 'article', - useReverb: true, - tests: [assertPageView], - }, - { - path: '/news/articles/c9djwv3q6w9o', - runforEnv: ['live'], - service: 'news', - pageIdentifier: 'news.articles.c9djwv3q6w9o.page', - siteId: 64, - applicationType: 'amp', - contentType: 'article', - useReverb: true, - tests: [assertPageView], - }, { path: '/pidgin/articles/ce9wk6glg4lo', runforEnv: ['local', 'live'], @@ -483,15 +461,40 @@ const liteTestSuites = canonicalTestSuites }; }); -const atiAmpTestSuites = atiAnalyticsTestSuites.map(testSuite => { - return { - ...testSuite, - path: getPathWithSuffix({ path: testSuite.path, suffix: '.amp' }), - useReverb: true, - applicationType: 'amp', - tests: [assertPageView], - }; -}); +const atiAmpTestSuites = atiAnalyticsTestSuites + .map(testSuite => { + return { + ...testSuite, + path: getPathWithSuffix({ path: testSuite.path, suffix: '.amp' }), + useReverb: true, + applicationType: 'amp', + tests: [assertPageView], + }; + }) + .concat([ + { + path: 'news/articles/c0g992jmmkko.amp', + runforEnv: ['local', 'test'], + service: 'news', + pageIdentifier: 'news.articles.c0g992jmmkko.page', + siteId: 64, + applicationType: 'amp', + contentType: 'article', + useReverb: true, + tests: [assertPageView], + }, + { + path: '/news/articles/c9djwv3q6w9o.amp', + runforEnv: ['live'], + service: 'news', + pageIdentifier: 'news.articles.c9djwv3q6w9o.page', + siteId: 64, + applicationType: 'amp', + contentType: 'article', + useReverb: true, + tests: [assertPageView], + }, + ]); const atiLiteTestSuites = atiAnalyticsTestSuites .filter(({ path, service }) => path !== '/ws/languages' && service !== 'news')