1
1
require "test_helper"
2
2
3
3
class RecruitmentBannerTest < ActionDispatch ::IntegrationTest
4
+ def hmrc_banner_survey_url
5
+ "https://survey.take-part-in-research.service.gov.uk/jfe/form/SV_74GjifgnGv6GsMC?Source=BannerList_HMRC_CCG_Compliance"
6
+ end
7
+
4
8
test "MOD banner 20/08/2024 is displayed on page of interest" do
5
9
detailed_guide = GovukSchemas ::Example . find ( "detailed_guide" , example_name : "detailed_guide" )
6
10
path = "/guidance/medals-campaigns-descriptions-and-eligibility"
@@ -22,4 +26,78 @@ class RecruitmentBannerTest < ActionDispatch::IntegrationTest
22
26
assert_not page . has_css? ( ".gem-c-intervention" )
23
27
assert_not page . has_link? ( "Take part in user research" , href : "https://submit.forms.service.gov.uk/form/3874/give-feedback-on-medals-information-on-gov-uk/13188" )
24
28
end
29
+
30
+ test "HMRC banner 29/08/2024 is displayed on detailed guides of interest" do
31
+ detailed_guide = GovukSchemas ::Example . find ( "detailed_guide" , example_name : "detailed_guide" )
32
+ detailed_guide_paths = [
33
+ "/guidance/voluntary-and-community-sector-organisations-who-can-give-you-extra-support" ,
34
+ "/guidance/how-to-get-a-review-of-an-hmrc-decision" ,
35
+ "/guidance/tax-disputes-alternative-dispute-resolution-adr" ,
36
+ ]
37
+
38
+ detailed_guide_paths . each do |path |
39
+ detailed_guide [ "base_path" ] = path
40
+ stub_content_store_has_item ( detailed_guide [ "base_path" ] , detailed_guide . to_json )
41
+ visit detailed_guide [ "base_path" ]
42
+
43
+ assert page . has_css? ( ".gem-c-intervention" )
44
+ assert page . has_link? ( "Sign up to take part in user research (opens in a new tab)" , href : hmrc_banner_survey_url )
45
+ end
46
+ end
47
+
48
+ test "HMRC banner 29/08/2024 is displayed on document collections of interest" do
49
+ document_collection = GovukSchemas ::Example . find ( "document_collection" , example_name : "document_collection" )
50
+ document_collection_paths = [
51
+ "/government/collections/tax-compliance-detailed-information" ,
52
+ "/government/collections/hm-revenue-and-customs-compliance-checks-factsheets" ,
53
+ ]
54
+
55
+ document_collection_paths . each do |path |
56
+ document_collection [ "base_path" ] = path
57
+ stub_content_store_has_item ( document_collection [ "base_path" ] , document_collection . to_json )
58
+ visit document_collection [ "base_path" ]
59
+
60
+ assert page . has_css? ( ".gem-c-intervention" )
61
+ assert page . has_link? ( "Sign up to take part in user research (opens in a new tab)" , href : hmrc_banner_survey_url )
62
+ end
63
+ end
64
+
65
+ test "HMRC banner 29/08/2024 is displayed on guides of interest" do
66
+ guide = GovukSchemas ::Example . find ( "guide" , example_name : "guide" )
67
+ guide_paths = [
68
+ "/difficulties-paying-hmrc" ,
69
+ "/tax-help" ,
70
+ "/get-help-hmrc-extra-support" ,
71
+ "/tax-appeals" ,
72
+ ]
73
+
74
+ guide_paths . each do |path |
75
+ guide [ "base_path" ] = path
76
+ stub_content_store_has_item ( guide [ "base_path" ] , guide . to_json )
77
+ visit guide [ "base_path" ]
78
+
79
+ assert page . has_css? ( ".gem-c-intervention" )
80
+ assert page . has_link? ( "Sign up to take part in user research (opens in a new tab)" , href : hmrc_banner_survey_url )
81
+ end
82
+ end
83
+
84
+ test "HMRC banner 29/08/2024 is displayed on answer pages of interest" do
85
+ answer = GovukSchemas ::Example . find ( "answer" , example_name : "answer" )
86
+
87
+ answer [ "base_path" ] = "/tax-help"
88
+ stub_content_store_has_item ( answer [ "base_path" ] , answer . to_json )
89
+ visit answer [ "base_path" ]
90
+
91
+ assert page . has_css? ( ".gem-c-intervention" )
92
+ assert page . has_link? ( "Sign up to take part in user research (opens in a new tab)" , href : hmrc_banner_survey_url )
93
+ end
94
+
95
+ test "HMRC banner 29/08/2024 is not displayed on all pages" do
96
+ detailed_guide = GovukSchemas ::Example . find ( "detailed_guide" , example_name : "detailed_guide" )
97
+ detailed_guide [ "base_path" ] = "/nothing-to-see-here"
98
+ stub_content_store_has_item ( detailed_guide [ "base_path" ] , detailed_guide . to_json )
99
+ visit detailed_guide [ "base_path" ]
100
+
101
+ assert_not page . has_css? ( ".gem-c-intervention" )
102
+ end
25
103
end
0 commit comments