Skip to content
Merged
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
21 changes: 19 additions & 2 deletions dotcom-rendering/playwright/tests/banner.e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ test.describe('The banner', function () {
waitUntil: 'domcontentloaded',
region: 'GB',
preventSupportBanner: false,
overrides: {
switchOverrides: {
consentManagement: true,
},
},
});
await cmpAcceptAll(page);

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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,
}) => {
Expand All @@ -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,
Expand Down
Loading