Fix banner e2e test#16347
Open
AnastasiiaBalenko wants to merge 3 commits into
Open
Conversation
Member
|
Please rebase this branch against
Please rebase this branch against |
af04489 to
c9b1c7a
Compare
juabara
approved these changes
Jul 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
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