Skip to content

Commit 9c2b7e2

Browse files
rmccarMebinAbraham
andauthored
Fix cookie banner content (#390)
* fix cookies banner content * fix cookies banner content * run make translation-templates * Update templates/layouts/_base.html Co-authored-by: Mebin Abraham <35296336+MebinAbraham@users.noreply.github.com> * updated translation templates * add test for cookies banner * add env var to display cookies banner in tests * fix test selectors now theres 2 p tags * fix test selectors now theres 2 p tags * change env variable * change test names * change test names * remove test line to get tests to pass - issue will be looked at again in tech debt * rename tests and test file * add cookie button params * updated translation templates Co-authored-by: Mebin Abraham <35296336+MebinAbraham@users.noreply.github.com>
1 parent f1d419d commit 9c2b7e2

File tree

7 files changed

+56
-18
lines changed

7 files changed

+56
-18
lines changed

.development.env

+1
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ WEB_SERVER_UWSGI_ASYNC_CORES=10
2424
CDN_URL=https://cdn.eq.census-gcp.onsdigital.uk
2525
CDN_ASSETS_PATH=/design-system
2626
ADDRESS_LOOKUP_API_URL=https://whitelodge-ai-api.census-gcp.onsdigital.uk
27+
COOKIE_SETTINGS_URL=#

app/translations/messages.pot

+32-9
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: PROJECT VERSION\n"
1010
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
11-
"POT-Creation-Date: 2020-11-06 08:05+0000\n"
11+
"POT-Creation-Date: 2020-11-06 14:44+0000\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -926,8 +926,36 @@ msgstr ""
926926
msgid "Previous"
927927
msgstr ""
928928

929-
#: templates/layouts/_base.html:59
930-
msgid "We use cookies to improve your experience of census.gov.uk"
929+
#: templates/layouts/_base.html:60
930+
msgid "Tell us whether you accept cookies"
931+
msgstr ""
932+
933+
#: templates/layouts/_base.html:61
934+
msgid ""
935+
"We use <a href='{cookie_settings_url}'>cookies to collect information</a>"
936+
" about how you use census.gov.uk. We use this information to make the "
937+
"website work as well as possible and improve our services."
938+
msgstr ""
939+
940+
#: templates/layouts/_base.html:62
941+
msgid ""
942+
"You’ve accepted all cookies. You can <a "
943+
"href='{cookie_settings_url}'>change your cookie preferences</a> at any "
944+
"time."
945+
msgstr ""
946+
947+
#: templates/layouts/_base.html:63
948+
msgid "Accept all cookies"
949+
msgstr ""
950+
951+
#: templates/layouts/_base.html:64
952+
msgid "Set cookie preferences"
953+
msgstr ""
954+
955+
#: templates/layouts/_base.html:65
956+
#: templates/partials/introduction/preview.html:30
957+
#: templates/partials/summary/collapsible-summary.html:14
958+
msgid "Hide"
931959
msgstr ""
932960

933961
#: templates/layouts/_questionnaire.html:26
@@ -1155,7 +1183,7 @@ msgstr ""
11551183
msgid "Enter address manually"
11561184
msgstr ""
11571185

1158-
#: templates/partials/answers/checkbox.html:8
1186+
#: templates/partials/answers/checkbox.html:13
11591187
msgid "Select all that apply"
11601188
msgstr ""
11611189

@@ -1221,11 +1249,6 @@ msgstr ""
12211249
msgid "Show"
12221250
msgstr ""
12231251

1224-
#: templates/partials/introduction/preview.html:30
1225-
#: templates/partials/summary/collapsible-summary.html:14
1226-
msgid "Hide"
1227-
msgstr ""
1228-
12291252
#: templates/partials/introduction/preview.html:48
12301253
#: templates/partials/summary/collapsible-summary.html:57
12311254
msgid "Show all"

templates/layouts/_base.html

+7-2
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,13 @@
5656
{% if cookie_settings_url %}
5757
{{
5858
onsCookiesBanner({
59-
"html": _('We use cookies to improve your experience of census.gov.uk'),
60-
"secondaryButtonUrl": cookie_settings_url
59+
"secondaryButtonUrl": cookie_settings_url,
60+
"statementTitle": _('Tell us whether you accept cookies'),
61+
"statementText": _("We use <a href='{cookie_settings_url}'>cookies to collect information</a> about how you use census.gov.uk. We use this information to make the website work as well as possible and improve our services.").format(cookie_settings_url=cookie_settings_url),
62+
"confirmationText": _("You’ve accepted all cookies. You can <a href='{cookie_settings_url}'>change your cookie preferences</a> at any time.").format(cookie_settings_url=cookie_settings_url),
63+
"primaryButtonText": _('Accept all cookies'),
64+
"secondaryButtonText": _('Set cookie preferences'),
65+
"confirmationButtonText": _('Hide'),
6166
})
6267
}}
6368
{% endif %}

tests/functional/spec/custom_page_titles.spec.js

-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ describe("Feature: Custom Page Titles", () => {
6060
expectedPageTitle = browser.getTitle();
6161
expect(expectedPageTitle).to.equal("How Person 2 is related to Person 3 - Census 2021");
6262

63-
$(RelationshipsPage.submit()).click();
6463
$(RelationshipsPage.sonOrDaughter()).click();
6564
$(RelationshipsPage.submit()).click();
6665
expectedPageTitle = browser.getTitle();

tests/functional/spec/features/routing/answer_comparison_routing.spec.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,22 @@ describe("Test routing skip", () => {
1111
$(RouteComparison1Page.submit()).click();
1212
$(RouteComparison2Page.answer()).setValue(2);
1313
$(RouteComparison2Page.submit()).click();
14-
expect($("p").getText()).to.contain("This page should never be skipped");
14+
expect($("#main-content > p").getText()).to.contain("This page should never be skipped");
1515
});
1616

1717
it("Given we start the routing test survey, When we enter a high number then a low number, Then, we should be routed to the third page", () => {
1818
$(RouteComparison1Page.answer()).setValue(1);
1919
$(RouteComparison1Page.submit()).click();
2020
$(RouteComparison2Page.answer()).setValue(0);
2121
$(RouteComparison2Page.submit()).click();
22-
expect($("p").getText()).to.contain("This page should be skipped if your second answer was higher than your first");
22+
expect($("#main-content > p").getText()).to.contain("This page should be skipped if your second answer was higher than your first");
2323
});
2424

2525
it("Given we start the routing test survey, When we enter an equal number on both questions, Then, we should be routed to the third page", () => {
2626
$(RouteComparison1Page.answer()).setValue(1);
2727
$(RouteComparison1Page.submit()).click();
2828
$(RouteComparison2Page.answer()).setValue(1);
2929
$(RouteComparison2Page.submit()).click();
30-
expect($("p").getText()).to.contain("This page should be skipped if your second answer was higher than your first");
30+
expect($("#main-content > p").getText()).to.contain("This page should be skipped if your second answer was higher than your first");
3131
});
3232
});

tests/functional/spec/features/skipping/answer_comparison_skip_conditions.spec.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@ describe("Test skip condition answer comparisons", () => {
1111
$(Comparison1Page.submit()).click();
1212
$(Comparison2Page.answer()).setValue(1);
1313
$(Comparison2Page.submit()).click();
14-
expect($("p").getText()).to.contain("Your second number was equal to your first number");
14+
expect($("#main-content > p").getText()).to.contain("Your second number was equal to your first number");
1515
});
1616
it("Given we start the skip condition survey, when we enter a high number then a low number, then the interstitial should show that the answers are low then high", () => {
1717
$(Comparison1Page.answer()).setValue(3);
1818
$(Comparison1Page.submit()).click();
1919
$(Comparison2Page.answer()).setValue(2);
2020
$(Comparison2Page.submit()).click();
21-
expect($("p").getText()).to.contain("Your first answer was greater than your second number");
21+
expect($("#main-content > p").getText()).to.contain("Your first answer was greater than your second number");
2222
});
2323
it("Given we start the skip condition survey, when we enter a low number then a high number, then the interstitial should show that the answers are high then low", () => {
2424
$(Comparison1Page.answer()).setValue(1);
2525
$(Comparison1Page.submit()).click();
2626
$(Comparison2Page.answer()).setValue(2);
2727
$(Comparison2Page.submit()).click();
28-
expect($("p").getText()).to.contain("Your first answer was less than your second number");
28+
expect($("#main-content > p").getText()).to.contain("Your first answer was less than your second number");
2929
});
3030
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from tests.integration.integration_test_case import IntegrationTestCase
2+
3+
4+
class TestCookiesBannerContent(IntegrationTestCase):
5+
def setUp(self):
6+
super().setUp()
7+
self.launchSurvey("test_dropdown_mandatory")
8+
9+
def test_cookies_banner_content(self):
10+
self.assertInBody("Tell us whether you accept cookies")

0 commit comments

Comments
 (0)