Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
238 changes: 230 additions & 8 deletions ws-nextjs-app/cypress/e2e/articlePage/index.cy.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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,
Expand Down Expand Up @@ -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'],
Expand All @@ -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,
Comment on lines +322 to +336
Copy link
Contributor

@amoore108 amoore108 Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do some of these need excluded if its the Lite version being requested?

I can see we have this logic currently in the specialFeatures/atiAnalytics/ tests:

const liteTestSuites = canonicalTestSuites
.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
assertDropdownNavigationComponentView, // Dropdown navigation removed from all pages, as it requires JS
assertDropdownNavigationComponentClick, // Dropdown navigation removed from all pages, as it requires JS
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
];

],
},
{
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'],
Expand All @@ -260,7 +413,11 @@ const atiAnalyticsTestSuites = [
applicationType: 'responsive',
contentType: 'article',
useReverb: true,
tests: [assertTopBarOJComponentClick, assertTopBarOJComponentView],
tests: [
assertPageView,
assertTopBarOJComponentClick,
assertTopBarOJComponentView,
],
},
] as unknown as TestDataType[];

Expand Down Expand Up @@ -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],
});

Expand Down
Loading
Loading