Skip to content

Fix banner e2e test#16347

Merged
AnastasiiaBalenko merged 4 commits into
mainfrom
ab-banner-e2e-test-fix
Jul 10, 2026
Merged

Fix banner e2e test#16347
AnastasiiaBalenko merged 4 commits into
mainfrom
ab-banner-e2e-test-fix

Conversation

@AnastasiiaBalenko

@AnastasiiaBalenko AnastasiiaBalenko commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

What does this change?

This change fixes the banner e2e test, which passed successfully in PROD environment, but failed when running in CI/CD or locally.
The cause of failure was the error, which could be seen in browser console.log:
Cannot read properties of undefined (reading 'consents')
It prevented the script execution to continue. The reason for this was in the way the cmp was initialised in CI/CD environment. The loadPage call was setting region to 'GB' explicitly, but CI runs in the US. Apparently setting region to "GB" in loadPage was not enough for cmp initialisation to correctly determine geo-location and during debugging by pinging window.__tsfapi it was detected that gdprApplies was false. According to this document

If GDPR does not apply to this user in this context then only gdprApplies, tcfPolicyVersion, cmpId and cmpVersion shall exist in the object

This is why consents was null, which caused the error.
In @guardian/consent-manager platform there is an opportunity to force geo-location in non-prod environment with query parameter https://github.com/guardian/csnx/blob/a3a7bbe55e74811d79c943381eb31c4d8520313a/libs/%40guardian/consent-manager/src/export.ts#L67
With this query parameters in place the test successfully passes.
Also explicit override overrides: { switchOverrides: { consentManagement: true, }, }, was added to guaranty that the switch is on.

Why?

e2e test for banner failed

@AnastasiiaBalenko AnastasiiaBalenko added the fix Departmental tracking: fix label Jul 8, 2026
@AnastasiiaBalenko AnastasiiaBalenko self-assigned this Jul 9, 2026
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

@akash1810

akash1810 commented Jul 9, 2026

Copy link
Copy Markdown
Member

Please rebase this branch against main before deploying to CODE. #16321 made some changes to CI and infrastructure. Deploying this branch without these changes present will either:

  • Fail when using Riff-Raff's default update strategy
  • OR delete the new infrastructure if using Riff-Raff's "dangerous" mode

Please rebase this branch against main before deploying to CODE.

@AnastasiiaBalenko AnastasiiaBalenko force-pushed the ab-banner-e2e-test-fix branch from af04489 to c9b1c7a Compare July 9, 2026 13:57
@AnastasiiaBalenko AnastasiiaBalenko marked this pull request as ready for review July 9, 2026 14:13
@AnastasiiaBalenko AnastasiiaBalenko added the run_chromatic Runs chromatic when label is applied label Jul 9, 2026
@AnastasiiaBalenko AnastasiiaBalenko merged commit 9df889b into main Jul 10, 2026
26 checks passed
@AnastasiiaBalenko AnastasiiaBalenko deleted the ab-banner-e2e-test-fix branch July 10, 2026 09:53
@gu-prout

gu-prout Bot commented Jul 10, 2026

Copy link
Copy Markdown

Seen on PROD (merged by @AnastasiiaBalenko 20 minutes and 33 seconds ago) Please check your changes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Departmental tracking: fix run_chromatic Runs chromatic when label is applied Seen-on-PROD

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants