Skip to content

Commit d8690c7

Browse files
authored
Merge pull request #242 from govuk-forms/fix-conditional-copy-page
Fix conditional copy page
2 parents 49aaf00 + 8098433 commit d8690c7

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

spec/end_to_end/end_to_end_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
add_a_single_line_of_text_question(question_text)
5757
add_a_single_line_of_text_question(alternate_question_text)
5858

59-
first(:link, "your questions").click
59+
click_link "your questions", match: :first
6060

6161
add_a_route selection_question, if_the_answer_selected_is: "Yes", skip_the_person_to: alternate_question_text
6262
add_a_secondary_skip last_question_before_skip: question_text, question_to_skip_to: "Check your answers before submitting"

spec/support/feature_helpers.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,13 @@ def form_is_filled_in_by_form_filler(live_form_link, yes_branch: false, confirma
359359
end
360360
# rubocop:enable Style/IdenticalConditionalBranches
361361

362+
if filler_answer_email_enabled?
363+
logger.info "And I am asked if I want a copy of my answers"
364+
expect(page.find("h1")).to have_content "Do you want to get an email with a copy of your answers?"
365+
choose "No", visible: false
366+
click_button "Continue"
367+
end
368+
362369
logger.info "Then I can check my answers before I submit them"
363370
expect(page).to have_content "Check your answers before submitting your form"
364371
expect(page).to have_content "What is your favourite colour?"
@@ -580,6 +587,10 @@ def skip_file_upload?
580587
ENV.fetch("SKIP_FILE_UPLOAD", false)
581588
end
582589

590+
def filler_answer_email_enabled?
591+
Settings.features.filler_answer_email_enabled
592+
end
593+
583594
def visit_product_page
584595
logger.info "Visiting product pages at #{forms_product_page_url}"
585596
visit forms_product_page_url

0 commit comments

Comments
 (0)