diff --git a/dotcom-rendering/playwright/tests/banner.e2e.spec.ts b/dotcom-rendering/playwright/tests/banner.e2e.spec.ts index 830c2f02899..0715aaed426 100644 --- a/dotcom-rendering/playwright/tests/banner.e2e.spec.ts +++ b/dotcom-rendering/playwright/tests/banner.e2e.spec.ts @@ -58,6 +58,11 @@ test.describe('The banner', function () { waitUntil: 'domcontentloaded', region: 'GB', preventSupportBanner: false, + overrides: { + switchOverrides: { + consentManagement: true, + }, + }, }); await cmpAcceptAll(page); @@ -147,6 +152,13 @@ test.describe('Banner browserId targeting', function () { waitUntil: 'domcontentloaded', region: 'GB', preventSupportBanner: false, + overrides: { + switchOverrides: { + consentManagement: true, + }, + }, + queryParamsOn: true, + queryParams: { _sp_geo_override: 'GB-XX' }, }); if (acceptConsent) { @@ -177,8 +189,7 @@ test.describe('Banner browserId targeting', function () { expect(browserId).toBe('test-browser-id'); }); - // Skip this test because it doesn't work in the github actions run. It does however work locally - test.skip('does not send browserId when user has not consented, even if in the auxia variant', async ({ + test('does not send browserId when user has not consented, even if in the auxia variant', async ({ page, context, }) => { @@ -189,6 +200,12 @@ test.describe('Banner browserId targeting', function () { inAuxiaVariant: true, }); + // CI/CD runs these tests with US geolocation, and fixing the origin to GB in loadPage is not enough for CMP initialization to conclude that the country is GDPR-applied. + // If gdprApplies is false, TCData is allowed to be minimal. If GDPR does not apply to this user in this context then only gdprApplies, tcfPolicyVersion, cmpId and cmpVersion shall exist in the object. (If GDPR does not apply to this user in this context then only gdprApplies, tcfPolicyVersion, cmpId and cmpVersion shall exist in the object.) + // @Guardian/content-management-platform uses the _sp_geo_override query parameter to override geo location in non-production environments. + const currentUrl = new URL(page.url()); + expect(currentUrl.searchParams.get('_sp_geo_override')).toBe('GB-XX'); + const browserId = getBannerRequestField( bannerRequest, RR_BANNER_URL,