Skip to content

Commit 3e3fd20

Browse files
committed
Merge branch 'main' into ph-20250218-1305-30-percent
2 parents a598825 + fd46652 commit 3e3fd20

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+804
-453
lines changed

dotcom-rendering/fixtures/manual/trails.ts

Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,3 +560,215 @@ export const trails: [
560560
showMainVideo: true,
561561
},
562562
];
563+
564+
export const audioTrails: [DCRFrontCard, DCRFrontCard] = [
565+
{
566+
format: { design: 3, display: 0, theme: 0 },
567+
url: '/news/audio/2025/feb/19/from-the-archive-was-it-inevitable-a-short-history-of-russias-war-on-ukraine-podcast',
568+
headline:
569+
'Was it inevitable? A short history of Russia’s war on Ukraine',
570+
showQuotedHeadline: false,
571+
dataLinkName: 'media | group-0 | card-@1',
572+
discussionApiUrl: '',
573+
isExternalLink: false,
574+
showLivePlayable: false,
575+
trailText:
576+
'This week, from 2022: To understand the tragedy of this war, it is worth going back beyond the last few weeks and months, and even beyond Vladimir Putin. By Keith Gessen. Read by Andrew McGregor',
577+
webPublicationDate: '2025-02-19T05:00:25.000Z',
578+
kickerText: 'The Audio Long Read',
579+
mainMedia: {
580+
type: 'Audio',
581+
duration: '46:12',
582+
podcastImage: {
583+
src: 'https://uploads.guim.co.uk/2021/01/22/AudioLongReadJan2021.jpg',
584+
altText: 'The Audio Long Read',
585+
},
586+
},
587+
image: {
588+
src: 'https://media.guim.co.uk/3c630f4309d8063a5b849bdcd5e57665f837fe13/0_147_4405_2643/master/4405.jpg',
589+
altText:
590+
'A military facility destroyed by shelling near Kyiv, 1 March 2022. Photograph: Genya Savilov/AFP/Getty Images',
591+
},
592+
},
593+
{
594+
format: { design: 3, display: 0, theme: 2 },
595+
url: '/football/audio/2025/feb/19/celtic-bayern-munich-champions-league-chaos-football-weekly-podcast',
596+
headline: 'Celtic’s heartbreak and Champions League playoff chaos ',
597+
showQuotedHeadline: false,
598+
dataLinkName: 'media | group-0 | card-@1',
599+
discussionApiUrl: '',
600+
isExternalLink: false,
601+
showLivePlayable: false,
602+
trailText:
603+
'Max Rushden is joined by Barry Glendenning, Paul Watson, Nick Ames, Ewan Murray and Jim Burke to discuss the latest Champions League playoff games, Everton’s new ground and much more',
604+
webPublicationDate: '2025-02-19T14:11:54.000Z',
605+
kickerText: 'Football Weekly',
606+
mainMedia: {
607+
type: 'Audio',
608+
duration: '54:52',
609+
podcastImage: {
610+
src: 'https://uploads.guim.co.uk/2024/08/01/FootballWeekly_FINAL_3000_(1).jpg',
611+
altText: 'Football Weekly',
612+
},
613+
},
614+
image: {
615+
src: 'https://media.guim.co.uk/01ded462d3dd730467bdfd652decda4117d925da/0_0_2074_1244/master/2074.jpg',
616+
altText:
617+
"TOPSHOT-FBL-EUR-C1-MILAN-FEYENOORD<br>TOPSHOT - Polish referee Szymon Marciniak gives a red card to AC Milan's French defender #19 Theo Hernandez (R) during the UEFA Champions League knockout round play-off second leg football match between AC Milan and Feyenoord at San Siro stadium in Milan, on February 18, 2025. (Photo by Piero CRUCIATTI / AFP) (Photo by PIERO CRUCIATTI/AFP via Getty Images)",
618+
},
619+
},
620+
];
621+
622+
export const galleryTrails: [DCRFrontCard, DCRFrontCard] = [
623+
{
624+
format: { design: 2, display: 1, theme: 4 },
625+
dataLinkName: 'media | group-0 | card-@5',
626+
url: '/fashion/gallery/2025/feb/01/we-love-fashion-fixes-for-the-week-ahead-in-pictures',
627+
headline: 'On trend hoods and eye-catching tights',
628+
trailText:
629+
'On trend hoods, eye-catching tights and David Beckham models for Boss',
630+
webPublicationDate: '2025-02-01T23:45:55.000Z',
631+
kickerText: 'Fashion fixes',
632+
supportingContent: [],
633+
discussionApiUrl: 'https://discussion.theguardian.com/discussion-api',
634+
mainMedia: { type: 'Gallery', count: '6' },
635+
image: {
636+
src: 'https://media.guim.co.uk/003d9dbe35c7a64a1e109a38450f3704deaeac24/2_240_3598_2159/master/3598.jpg',
637+
altText:
638+
'Barbour X Erdem Dhalia Wax Jacket RRP £519.00 Available at Barbour.com (1)',
639+
},
640+
showQuotedHeadline: false,
641+
isExternalLink: false,
642+
showLivePlayable: false,
643+
},
644+
{
645+
format: { design: 2, display: 1, theme: 0 },
646+
dataLinkName: 'media | group-0 | card-@2',
647+
url: '/global-development/gallery/2025/feb/07/goma-congolese-photographer-arlette-bashizi-home-city-rwandan-backed-m23-rebels',
648+
headline: 'The fall of Goma: 16 days of chaos and fear – in pictures',
649+
trailText:
650+
'Congolese photographer Arlette Bashizi documented for Reuters the lead-up to and aftermath of the seizure of her home city by Rwandan-backed M23 rebels',
651+
webPublicationDate: '2025-02-07T05:00:36.000Z',
652+
kickerText: 'Democratic Republic of the Congo',
653+
discussionApiUrl: 'https://discussion.theguardian.com/discussion-api',
654+
mainMedia: { type: 'Gallery', count: '27' },
655+
showMainVideo: false,
656+
image: {
657+
src: 'https://media.guim.co.uk/69ac2383ea611126b54373865dac3e7e77981d7e/0_39_5500_3302/master/5500.jpg',
658+
altText: 'A group of people in the street, some looking worried',
659+
},
660+
showQuotedHeadline: false,
661+
isExternalLink: false,
662+
showLivePlayable: false,
663+
},
664+
];
665+
666+
export const videoTrails: [DCRFrontCard, DCRFrontCard] = [
667+
{
668+
format: { design: 4, display: 0, theme: 2 },
669+
dataLinkName: 'media | group-0 | card-@3',
670+
url: '/football/video/2024/dec/16/rashford-and-garnacho-omission-from-team-to-push-them-harder-says-amorim-video',
671+
headline:
672+
"Rashford and Garnacho omission from team to 'push them harder' says Amorim – video ",
673+
trailText:
674+
"Amorim said the team proved by the victory against City that they 'can leave anyone outside the squad and manage to win'",
675+
webPublicationDate: '2024-12-16T15:21:02.000Z',
676+
discussionApiUrl:
677+
'https://discussion.code.dev-theguardian.com/discussion-api',
678+
mainMedia: {
679+
type: 'Video',
680+
id: 'fa2ee832-c5e7-4305-8387-f0277d2d9e27',
681+
videoId: '9kIN--VV2LQ',
682+
duration: 117,
683+
title: "Rashford and Garnacho omission from team to 'push them harder' says Amorim – video ",
684+
width: 500,
685+
height: 300,
686+
origin: 'SNTV',
687+
expired: false,
688+
images: [
689+
{
690+
url: 'https://media.guim.co.uk/0cab2d745b3423b0fac318c9ee09b79678f568f8/0_56_3000_1688/2000.jpg',
691+
width: 2000,
692+
},
693+
{
694+
url: 'https://media.guim.co.uk/0cab2d745b3423b0fac318c9ee09b79678f568f8/0_56_3000_1688/1000.jpg',
695+
width: 1000,
696+
},
697+
{
698+
url: 'https://media.guim.co.uk/0cab2d745b3423b0fac318c9ee09b79678f568f8/0_56_3000_1688/500.jpg',
699+
width: 500,
700+
},
701+
{
702+
url: 'https://media.guim.co.uk/0cab2d745b3423b0fac318c9ee09b79678f568f8/0_56_3000_1688/140.jpg',
703+
width: 140,
704+
},
705+
{
706+
url: 'https://media.guim.co.uk/0cab2d745b3423b0fac318c9ee09b79678f568f8/0_56_3000_1688/3000.jpg',
707+
width: 3000,
708+
},
709+
],
710+
},
711+
showMainVideo: true,
712+
image: {
713+
src: 'https://media.guim.co.uk/0cab2d745b3423b0fac318c9ee09b79678f568f8/0_47_3000_1800/master/3000.jpg',
714+
altText:
715+
"Amorim said the team proved by the victory against City that they 'can leave anyone outside the squad and manage to win'",
716+
},
717+
showQuotedHeadline: false,
718+
isExternalLink: false,
719+
showLivePlayable: false,
720+
},
721+
{
722+
format: { design: 0, display: 0, theme: 0 },
723+
dataLinkName: 'news | group-0 | card-@2',
724+
url: '/uk-news/2025/jan/22/prince-harry-says-sun-publisher-made-historic-admission-as-he-settles-case',
725+
headline:
726+
'Prince Harry says Sun publisher made ‘historic admission’ as he settles case',
727+
trailText:
728+
'News Group Newspapers offered Harry ‘full and unequivocal apology’ for ‘serious intrusion’ by the paper',
729+
webPublicationDate: '2025-01-22T18:51:14.000Z',
730+
discussionApiUrl:
731+
'https://discussion.code.dev-theguardian.com/discussion-api',
732+
mainMedia: {
733+
type: 'Video',
734+
id: '03ac0c90-3a66-448c-8562-b66a9ca9360e',
735+
videoId: '_2wsSKq6yAk',
736+
duration: 71,
737+
title: "Prince Harry's lawyer says settlement is 'monumental victory' – video ",
738+
width: 500,
739+
height: 300,
740+
origin: 'Reuters',
741+
expired: false,
742+
images: [
743+
{
744+
url: 'https://media.guim.co.uk/908aa315f66a09bc6ea607b6049cd72decd2dfa6/0_0_5358_3014/2000.jpg',
745+
width: 2000,
746+
},
747+
{
748+
url: 'https://media.guim.co.uk/908aa315f66a09bc6ea607b6049cd72decd2dfa6/0_0_5358_3014/1000.jpg',
749+
width: 1000,
750+
},
751+
{
752+
url: 'https://media.guim.co.uk/908aa315f66a09bc6ea607b6049cd72decd2dfa6/0_0_5358_3014/500.jpg',
753+
width: 500,
754+
},
755+
{
756+
url: 'https://media.guim.co.uk/908aa315f66a09bc6ea607b6049cd72decd2dfa6/0_0_5358_3014/140.jpg',
757+
width: 140,
758+
},
759+
{
760+
url: 'https://media.guim.co.uk/908aa315f66a09bc6ea607b6049cd72decd2dfa6/0_0_5358_3014/5358.jpg',
761+
width: 5358,
762+
},
763+
],
764+
},
765+
showMainVideo: true,
766+
image: {
767+
src: 'https://media.guim.co.uk/4612af5f4667888fa697139cf570b6373d93a710/2446_345_3218_1931/master/3218.jpg',
768+
altText: 'Prince Harry leaves the high court in June 2023',
769+
},
770+
showQuotedHeadline: false,
771+
isExternalLink: false,
772+
showLivePlayable: false,
773+
},
774+
];

dotcom-rendering/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@
4747
"@guardian/eslint-config-typescript": "9.0.1",
4848
"@guardian/identity-auth": "6.0.1",
4949
"@guardian/identity-auth-frontend": "8.1.0",
50-
"@guardian/libs": "20.0.0",
50+
"@guardian/libs": "21.1.0",
5151
"@guardian/ophan-tracker-js": "2.2.5",
5252
"@guardian/react-crossword": "2.0.2",
53-
"@guardian/react-crossword-next": "npm:@guardian/[email protected]20250218102215",
53+
"@guardian/react-crossword-next": "npm:@guardian/[email protected]20250220133624",
5454
"@guardian/shimport": "1.0.2",
5555
"@guardian/source": "8.0.0",
5656
"@guardian/source-development-kitchen": "12.0.0",
@@ -129,7 +129,7 @@
129129
"cpy": "11.0.0",
130130
"css-loader": "7.1.2",
131131
"curlyquotes": "1.5.5",
132-
"dompurify": "3.1.3",
132+
"dompurify": "3.2.4",
133133
"dynamic-import-polyfill": "0.1.1",
134134
"eslint": "8.56.0",
135135
"eslint-config-airbnb-base": "15.0.0",

dotcom-rendering/playwright/lib/cmp.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { BrowserContext, Page } from '@playwright/test';
2+
import { ALLOW_REJECT_ALL_COOKIE } from '../../src/client/userFeatures/cookies/allowRejectAll';
23
import { addCookie } from './cookies';
34
import { waitForIsland } from './islands';
45

@@ -40,6 +41,15 @@ const cmpRejectAll = async (page: Page): Promise<void> => {
4041
await new Promise((r) => setTimeout(r, 2000));
4142
};
4243

44+
const allowRejectAll = (context: BrowserContext): Promise<void> => {
45+
const expires = new Date();
46+
expires.setMonth(expires.getMonth() + 6);
47+
return addCookie(context, {
48+
name: ALLOW_REJECT_ALL_COOKIE,
49+
value: expires.getTime().toString(),
50+
});
51+
};
52+
4353
/**
4454
* Reconsent on the Sourcepoint CMP banner
4555
*
@@ -72,6 +82,7 @@ export {
7282
cmpAcceptAll,
7383
cmpReconsent,
7484
cmpRejectAll,
85+
allowRejectAll,
7586
disableCMP,
7687
CMP_LAYER1_IFRAME,
7788
};

dotcom-rendering/playwright/lib/load-page.ts

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,60 @@ import type { FEArticleType } from '../../src/types/frontend';
66
const BASE_URL = `http://localhost:${PORT}`;
77

88
/**
9-
* Loads a page and centralises setup:
10-
* - default the base url and port
11-
* - default the geo region to GB
12-
* - prevent the support banner from showing
9+
* Loads a page in Playwright and centralises setup
1310
*/
14-
const loadPage = async (
15-
page: Page,
16-
path: string,
17-
waitUntil: 'load' | 'domcontentloaded' = 'domcontentloaded',
11+
const loadPage = async ({
12+
page,
13+
path,
14+
queryParams = {},
15+
queryParamsOn = true,
16+
fragment,
17+
waitUntil = 'domcontentloaded',
1818
region = 'GB',
1919
preventSupportBanner = true,
20-
): Promise<void> => {
20+
}: {
21+
page: Page;
22+
path: string;
23+
queryParams?: Record<string, string>;
24+
queryParamsOn?: boolean;
25+
fragment?: `#${string}`;
26+
waitUntil?: 'domcontentloaded' | 'load';
27+
region?: 'GB' | 'US' | 'AU' | 'INT';
28+
preventSupportBanner?: boolean;
29+
}): Promise<void> => {
2130
await page.addInitScript(
2231
(args) => {
23-
// force geo region
32+
// Set the geo region, defaults to GB
2433
window.localStorage.setItem(
2534
'gu.geo.override',
2635
JSON.stringify({ value: args.region }),
2736
);
37+
// Prevent the support banner from showing
2838
if (args.preventSupportBanner) {
2939
window.localStorage.setItem(
3040
'gu.prefs.engagementBannerLastClosedAt',
3141
`{"value":"${new Date().toISOString()}"}`,
3242
);
3343
}
3444
},
35-
{ region, preventSupportBanner },
45+
{
46+
region,
47+
preventSupportBanner,
48+
},
3649
);
50+
// Add an adtest query param to ensure we get a fixed test ad
51+
const paramsString = queryParamsOn
52+
? `?${new URLSearchParams({
53+
adtest: 'fixed-puppies-ci',
54+
...queryParams,
55+
}).toString()}`
56+
: '';
57+
3758
// The default Playwright waitUntil: 'load' ensures all requests have completed
3859
// Use 'domcontentloaded' to speed up tests and prevent hanging requests from timing out tests
39-
await page.goto(`${BASE_URL}${path}`, { waitUntil });
60+
await page.goto(`${BASE_URL}${path}${paramsString}${fragment ?? ''}`, {
61+
waitUntil,
62+
});
4063
};
4164

4265
/**
@@ -72,7 +95,7 @@ const loadPageWithOverrides = async (
7295
postData,
7396
});
7497
});
75-
await loadPage(page, path);
98+
await loadPage({ page, path, queryParamsOn: false });
7699
};
77100

78101
/**

dotcom-rendering/playwright/tests/article.e2e.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ test.describe('E2E Page rendering', () => {
5555
),
5656
);
5757

58-
await loadPage(
58+
await loadPage({
5959
page,
60-
`/Article/https://www.theguardian.com/commentisfree/2019/oct/16/impostor-syndrome-class-unfairness`,
61-
);
60+
path: `/Article/https://www.theguardian.com/commentisfree/2019/oct/16/impostor-syndrome-class-unfairness`,
61+
});
6262

6363
await expect(page.locator('[data-gu-name="title"]')).toContainText(
6464
'Opinion',

0 commit comments

Comments
 (0)