-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3732 from alphagov/add-user-research-banner
Add user research banner for One Login
- Loading branch information
Showing
4 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module ContentItem | ||
module RecruitmentBanner | ||
SURVEY_URL = "https://surveys.publishing.service.gov.uk/s/4J4QD4/".freeze | ||
SURVEY_URL_MAPPINGS = { | ||
"/check-national-insurance-record" => SURVEY_URL, | ||
"/check-state-pension" => SURVEY_URL, | ||
"/student-finance-register-login" => SURVEY_URL, | ||
"/sign-in-universal-credit" => SURVEY_URL, | ||
}.freeze | ||
|
||
def recruitment_survey_url | ||
user_research_test_url | ||
end | ||
|
||
def user_research_test_url | ||
key = content_item["base_path"] | ||
SURVEY_URL_MAPPINGS[key] | ||
end | ||
end | ||
end |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
require "integration_test_helper" | ||
|
||
class RecruitmentBannerTest < ActionDispatch::IntegrationTest | ||
test "User research banner is displayed on pages of interest" do | ||
transaction = GovukSchemas::Example.find("transaction", example_name: "transaction") | ||
|
||
pages_of_interest = | ||
[ | ||
"/check-national-insurance-record", | ||
"/check-state-pension", | ||
"/student-finance-register-login", | ||
"/sign-in-universal-credit", | ||
] | ||
|
||
pages_of_interest.each do |path| | ||
transaction["base_path"] = path | ||
stub_content_store_has_item(transaction["base_path"], transaction.to_json) | ||
visit transaction["base_path"] | ||
|
||
assert page.has_css?(".gem-c-intervention") | ||
assert page.has_link?("Take part in user research (opens in a new tab)", href: "https://surveys.publishing.service.gov.uk/s/4J4QD4/") | ||
end | ||
end | ||
|
||
test "User research banner is not displayed on all pages" do | ||
transaction = GovukSchemas::Example.find("transaction", example_name: "transaction") | ||
transaction["base_path"] = "/nothing-to-see-here" | ||
stub_content_store_has_item(transaction["base_path"], transaction.to_json) | ||
visit transaction["base_path"] | ||
|
||
assert_not page.has_css?(".gem-c-intervention") | ||
assert_not page.has_link?("Take part in user research", href: "https://surveys.publishing.service.gov.uk/s/4J4QD4/") | ||
end | ||
end |