diff --git a/ws-nextjs-app/cypress/e2e/articlePage/index.cy.ts b/ws-nextjs-app/cypress/e2e/articlePage/index.cy.ts index a86339d19b4..7183bf2233d 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,48 @@ 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'; +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, @@ -238,6 +281,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 +309,101 @@ 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: '/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'], @@ -260,7 +413,11 @@ const atiAnalyticsTestSuites = [ applicationType: 'responsive', contentType: 'article', useReverb: true, - tests: [assertTopBarOJComponentClick, assertTopBarOJComponentView], + tests: [ + assertPageView, + assertTopBarOJComponentClick, + assertTopBarOJComponentView, + ], }, ] as unknown as TestDataType[]; @@ -304,17 +461,82 @@ const liteTestSuites = canonicalTestSuites }; }); +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') + .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 3148b756c10..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, @@ -97,48 +70,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', @@ -166,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 }) => @@ -257,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')