-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ [#1537] Adding cookie-consent banner #681
Conversation
bd1209d
to
900d9dd
Compare
Codecov Report
@@ Coverage Diff @@
## develop #681 +/- ##
===========================================
- Coverage 96.20% 96.16% -0.04%
===========================================
Files 642 643 +1
Lines 22934 22959 +25
===========================================
+ Hits 22064 22079 +15
- Misses 870 880 +10
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
eb7551f
to
f367f91
Compare
0d811dc
to
4148b91
Compare
@Bartvaderkin and @pi-sigma I don't know too much about writing tests yet (so a review of what I did in |
d0f4a70
to
34607a6
Compare
cookiebanner_rejectbutton.click() | ||
# check cookie-banner state | ||
expect(cookiebanner_banner).to_be_hidden() | ||
|
||
# find action element and the dropdown widget |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- The test is for the action view, which has nothing specifically to do with cookies. This would need to be a separate test.
- If we're going to test the hiding of the cookie banner, we should also test that it's hidden when the 'accept' button is clicked.
However, I'm not sure this is even needed. We can confirm manually that the banner is hidden on click. What we do need to check automatically is that the analytics scripts are not rendered when the cookie is not set. You should modify the test in src/open_inwoner/configurations/tests/test_analytics.py
(I should have done this myself when I changed the test, but didn't think of it back then).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pi-sigma I didn't know what to do here, because this test was failing when I added the cookiebanner, because the cookiebanner is blocking all other clicks when it pops up so I add something-that-clicks-something but I definitely don't know what I am doing here (I would prefer to set " self.cookiebanner_enabled" to False but that didn't work.)
cookiebanner_rejectbutton.click() | ||
# check cookie-banner state | ||
expect(cookiebanner_banner).to_be_hidden() | ||
|
||
# expected anchors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See previous comment
Discussed with Jiro and Paul:
|
b2ff3d0
to
52c400b
Compare
def setUp(self): | ||
self.config = SiteConfiguration.get_solo() | ||
cms_tools.create_homepage() | ||
self.config.cookie_info_text = "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pi-sigma I've added the new tests here. Question: I am assuming that if cookie_info_text
is set to a string with content here, instead of empty, the tests below should actually be failing since analytics should then be off by default?
All other behaviour behaves conforming to the assertions.
52c400b
to
ec1e266
Compare
3 failing tests: 2023-08-01T09:02:21.1027134Z ERROR: test_action_status (open_inwoner.accounts.tests.test_action_views.ActionsPlaywrightTests) |
41d01a2
to
a4264ed
Compare
a4264ed
to
958298b
Compare
@@ -325,7 +336,9 @@ def setUp(self) -> None: | |||
) | |||
self.action_list_url = reverse("profile:action_list") | |||
|
|||
def test_action_status(self): | |||
def test_action_status(self, mock_solo): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! @pi-sigma I had no idea... now this is ready for review again.
Cookie-banner that respects the GDPR privacy laws, and gives the user the chance to dismiss the non-essential cookies only.
https://taiga.maykinmedia.nl/project/open-inwoner/task/1537
IF the Admin does NOT want to use the cookiebanner, THEN analytics cookies need to be set to true.
IF Admin wants to use the banner, THEN analytics need to be set to false when cookies are rejected by the local user, and to true when approved. + Analytics must be on by default, unless there is a cookiebanner set.
Challenge: (not in this issue) not making the cookie-banner appear on the Privacy policy page? Right now you first have to click it it in order to be able to read it; (if the cookie-banner is shown, it has to block all other interactions).