-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit adds User Research Banner to: - /browse/business/setting-up - /browse/business/business-tax - /browse/business/finance-support - /browse/business/limited-company - /browse/business/expenses-employee-benefits - /browse/business/funding-debt - /browse/business/premises-rates - /browse/business/food - /browse/business/imports - /browse/business/exports - /browse/business/licences - /browse/business/selling-closing - /browse/business/sale-goods-services-data - /browse/business/childcare-providers - /browse/business/manufacturing - /browse/business/intellectual-property - /browse/business/waste-environment - /browse/business/science - /browse/business/maritime - /browse/business
- Loading branch information
1 parent
428a35e
commit 79f8b0f
Showing
8 changed files
with
144 additions
and
3 deletions.
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,34 @@ | ||
module RecruitmentBannerHelper | ||
SURVEY_URL = "https://surveys.publishing.service.gov.uk/s/ur-ttm/".freeze | ||
|
||
SURVEY_URL_MAPPINGS = { | ||
"/browse/business/setting-up" => SURVEY_URL, | ||
"/browse/business/business-tax" => SURVEY_URL, | ||
"/browse/business/finance-support" => SURVEY_URL, | ||
"/browse/business/limited-company" => SURVEY_URL, | ||
"/browse/business/expenses-employee-benefits" => SURVEY_URL, | ||
"/browse/business/funding-debt" => SURVEY_URL, | ||
"/browse/business/premises-rates" => SURVEY_URL, | ||
"/browse/business/food" => SURVEY_URL, | ||
"/browse/business/imports" => SURVEY_URL, | ||
"/browse/business/exports" => SURVEY_URL, | ||
"/browse/business/licences" => SURVEY_URL, | ||
"/browse/business/selling-closing" => SURVEY_URL, | ||
"/browse/business/sale-goods-services-data" => SURVEY_URL, | ||
"/browse/business/childcare-providers" => SURVEY_URL, | ||
"/browse/business/manufacturing" => SURVEY_URL, | ||
"/browse/business/intellectual-property" => SURVEY_URL, | ||
"/browse/business/waste-environment" => SURVEY_URL, | ||
"/browse/business/science" => SURVEY_URL, | ||
"/browse/business/maritime" => SURVEY_URL, | ||
"/browse/business" => SURVEY_URL, | ||
}.freeze | ||
|
||
def recruitment_survey_url | ||
user_research_test_url | ||
end | ||
|
||
def user_research_test_url | ||
SURVEY_URL_MAPPINGS[base_path] | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
class MainstreamBrowsePage | ||
include RecruitmentBannerHelper | ||
|
||
attr_reader :content_item | ||
|
||
delegate( | ||
|
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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
class Topic | ||
include RecruitmentBannerHelper | ||
|
||
attr_reader :content_item | ||
|
||
delegate( | ||
|
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
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,58 @@ | ||
require "integration_spec_helper" | ||
|
||
RSpec.feature "Research panel banner" do | ||
include SearchApiHelpers | ||
include RecruitmentBannerHelper | ||
|
||
scenario "browse pages where we want to display User Research banner" do | ||
schema = GovukSchemas::Example.find("mainstream_browse_page", example_name: "level_2_page") | ||
|
||
pages_of_interest = | ||
[ | ||
"/browse/business/setting-up", | ||
"/browse/business/business-tax", | ||
"/browse/business/finance-support", | ||
"/browse/business/limited-company", | ||
"/browse/business/expenses-employee-benefits", | ||
"/browse/business/funding-debt", | ||
"/browse/business/premises-rates", | ||
"/browse/business/food", | ||
"/browse/business/imports", | ||
"/browse/business/exports", | ||
"/browse/business/licences", | ||
"/browse/business/selling-closing", | ||
"/browse/business/sale-goods-services-data", | ||
"/browse/business/childcare-providers", | ||
"/browse/business/manufacturing", | ||
"/browse/business/intellectual-property", | ||
"/browse/business/waste-environment", | ||
"/browse/business/science", | ||
"/browse/business/maritime", | ||
"/browse/business", | ||
] | ||
|
||
pages_of_interest.each do |path| | ||
schema["base_path"] = path | ||
stub_content_store_has_item(schema["base_path"], schema.to_json) | ||
search_api_has_documents_for_browse_page(schema["content_id"], [schema["base_path"]], page_size: SearchApiSearch::PAGE_SIZE_TO_GET_EVERYTHING) | ||
|
||
visit schema["base_path"] | ||
|
||
expect(page.status_code).to eq(200) | ||
|
||
assert page.has_css?(".gem-c-intervention") | ||
assert page.has_link?("Take part in user research", href: "https://signup.take-part-in-research.service.gov.uk/home?utm_campaign=Content_History&utm_source=Hold_gov_to_account&utm_medium=gov.uk&t=GDS&id=16") | ||
end | ||
end | ||
|
||
scenario "pages where we don't want to display User Research banner" do | ||
schema = GovukSchemas::Example.find("mainstream_browse_page", example_name: "level_2_page") | ||
stub_content_store_has_item(schema["base_path"], schema) | ||
search_api_has_documents_for_browse_page(schema["content_id"], [schema["base_path"]], page_size: SearchApiSearch::PAGE_SIZE_TO_GET_EVERYTHING) | ||
|
||
visit schema["base_path"] | ||
|
||
expect(page.status_code).to eq(200) | ||
expect(page).to_not have_selector(".gem-c-intervention") | ||
end | ||
end |