Skip to content

Commit

Permalink
Merge pull request #6510 from alphagov/ETA-qatar-followup
Browse files Browse the repository at this point in the history
CA/SS/ACB - exclude qatar from conditional text in channel island or …
  • Loading branch information
cynthia-anya authored Aug 17, 2023
2 parents fcd4d22 + 6a49d49 commit 64889c8
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
<% end %>

<% govspeak_for :body do %>
You must either apply for:
<% if calculator.passport_country_requires_electronic_travel_authorisation? %>
If you do not have a visa (or wet ink stamp) for the Channel Islands or the Isle of Man, you must either apply for:
<% else %>
You must either apply for:
<% end %>

+ [an electronic visa waiver](/get-electronic-visa-waiver)
+ [a Standard Visitor visa](/standard-visitor) for courses up to 6 months
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
<% end %>

<% govspeak_for :body do %>
You must either apply for:
<% if calculator.passport_country_requires_electronic_travel_authorisation? %>
If you do not have a visa (or wet ink stamp) for the Channel Islands or the Isle of Man, you must either apply for:
<% else %>
You must either apply for:
<% end %>

+ an [electronic visa waiver](/get-electronic-visa-waiver)
+ a [Standard Visitor visa](/standard-visitor)

<%if calculator.passport_country_requires_electronic_travel_authorisation? %>
<% if calculator.passport_country_requires_electronic_travel_authorisation? %>
<%= render partial: 'electronic_travel_authorisation_advice'%>
<% end %>
<% end %>
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
<% end %>

<% govspeak_for :body do %>
<% if calculator.passport_country_in_british_overseas_territories_list? ||
calculator.passport_country_in_non_visa_national_list? %>
You might need a UK visa if you don’t have a visa (or a wet ink stamp) for the Channel Islands or the Isle of Man.
<% elsif calculator.passport_country_in_electronic_visa_waiver_list? %>
You’ll need a UK visa or an [Electronic Visa Waiver](/get-electronic-visa-waiver) if you don’t have a visa (or wet ink stamp) for the Channel Islands or the Isle of Man.
<% elsif calculator.passport_country_in_direct_airside_transit_visa_list? ||
calculator.passport_country_in_visa_national_list? %>
You’ll need a UK visa if you don’t have a visa (or a wet ink stamp) for the Channel Islands or the Isle of Man.
<% else %>
You’ll need a UK visa to come to the Channel Islands or the Isle of Man.
<% unless calculator.passport_country_requires_electronic_travel_authorisation? %>
<% if calculator.passport_country_in_british_overseas_territories_list? ||
calculator.passport_country_in_non_visa_national_list? %>
You might need a UK visa if you don’t have a visa (or a wet ink stamp) for the Channel Islands or the Isle of Man.
<% elsif calculator.passport_country_in_electronic_visa_waiver_list? %>
You’ll need a UK visa or an [Electronic Visa Waiver](/get-electronic-visa-waiver) if you don’t have a visa (or wet ink stamp) for the Channel Islands or the Isle of Man.
<% elsif calculator.passport_country_in_direct_airside_transit_visa_list? ||
calculator.passport_country_in_visa_national_list? %>
You’ll need a UK visa if you don’t have a visa (or a wet ink stamp) for the Channel Islands or the Isle of Man.
<% else %>
You’ll need a UK visa to come to the Channel Islands or the Isle of Man.
<% end %>
<% end %>
<% end %>

Expand Down
30 changes: 28 additions & 2 deletions test/flows/check_uk_visa_flow_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class CheckUkVisaFlowTest < ActiveSupport::TestCase
@youth_mobility_scheme_country = "canada"

@eta_text = "If you’re travelling on or after 15 November 2023, you’ll need to apply for an electronic travel authorisation (ETA) instead of an electronic visa waiver. You’ll be able to apply for an ETA from 25 October 2023."
@channel_island_isle_of_man_text = "If you do not have a visa (or wet ink stamp) for the Channel Islands or the Isle of Man, you must either apply for:"

# stub only the countries used in this test for less of a performance impact
stub_worldwide_api_has_locations(["china",
Expand Down Expand Up @@ -276,16 +277,25 @@ class CheckUkVisaFlowTest < ActiveSupport::TestCase
context "question: channel_islands_or_isle_of_man?" do
setup do
testing_node :channel_islands_or_isle_of_man?
add_responses what_passport_do_you_have?: @eea_country,
purpose_of_visit?: "transit",
add_responses purpose_of_visit?: "transit",
travelling_to_cta?: "channel_islands_or_isle_of_man"
end

should "render the question" do
add_responses what_passport_do_you_have?: @eea_country
assert_rendered_question
end

should "not render additional information in question body for ETA countries that are also EVW countries" do
add_responses what_passport_do_you_have?: @electronic_travel_authorisation_country
assert_no_rendered_question text: "You’ll need a UK visa or an Electronic Visa Waiver if you don’t have a visa (or wet ink stamp) for the Channel Islands or the Isle of Man."
end

context "next_node" do
setup do
add_responses what_passport_do_you_have?: @eea_country
end

test_shared_purpose_of_visit_next_nodes
end
end
Expand Down Expand Up @@ -941,6 +951,14 @@ class CheckUkVisaFlowTest < ActiveSupport::TestCase
add_responses what_passport_do_you_have?: @electronic_visa_waiver_country
assert_no_rendered_outcome text: @eta_text
end

should "render ETA specific instructions for visiting Channel Islands or Isle of Man" do
add_responses what_passport_do_you_have?: @electronic_travel_authorisation_country,
travelling_to_cta?: "channel_islands_or_isle_of_man"
assert_rendered_outcome text: @eta_text
assert_rendered_outcome text: @channel_island_isle_of_man_text
assert_no_rendered_outcome text: "You must either apply for:"
end
end

context "outcome: outcome_study_waiver" do
Expand All @@ -959,6 +977,14 @@ class CheckUkVisaFlowTest < ActiveSupport::TestCase
add_responses what_passport_do_you_have?: @electronic_visa_waiver_country
assert_no_rendered_outcome text: @eta_text
end

should "render ETA specific instructions for visiting Channel Islands or Isle of Man" do
add_responses what_passport_do_you_have?: @electronic_travel_authorisation_country,
travelling_to_cta?: "channel_islands_or_isle_of_man"
assert_rendered_outcome text: @eta_text
assert_rendered_outcome text: @channel_island_isle_of_man_text
assert_no_rendered_outcome text: "You must either apply for:"
end
end

context "outcome: outcome_work_waiver" do
Expand Down
30 changes: 24 additions & 6 deletions test/support/flow_test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,18 @@ def assert_rendered_start_page
assert_not_empty start_node_presenter.body, "Expected the start page to have a body"
end

def assert_rendered_question
def assert_rendered_question(text: nil)
ensure_valid_and_correct_node

assert_not_empty test_flow.question_title
assert_match text, test_flow.question_body_text if text
end

def assert_no_rendered_question(text: nil)
ensure_valid_and_correct_node

assert_not_empty test_flow.question_title
assert_no_match text, test_flow.question_body_text if text
end

def assert_rendered_question_hint
Expand Down Expand Up @@ -156,15 +164,19 @@ def current_node_type
end

def question_title
raise "#{state.current_node_name} is not a question" unless current_node_type == :question

QuestionPresenter.new(flow.node(state.current_node_name), nil, state).title
question_presenter.title
end

def question_hint
raise "#{state.current_node_name} is not a question" unless current_node_type == :question
question_presenter.hint
end

def question_body
question_presenter.body
end

QuestionPresenter.new(flow.node(state.current_node_name), nil, state).hint
def question_body_text
Nokogiri::HTML::DocumentFragment.parse(question_body).text
end

def outcome_body
Expand Down Expand Up @@ -196,5 +208,11 @@ def outcome_presenter

OutcomePresenter.new(flow.node(state.current_node_name), nil, state)
end

def question_presenter
raise "#{state.current_node_name} is not a question" unless current_node_type == :question

QuestionPresenter.new(flow.node(state.current_node_name), nil, state)
end
end
end

0 comments on commit 64889c8

Please sign in to comment.