diff --git a/spec/end_to_end/end_to_end_spec.rb b/spec/end_to_end/end_to_end_spec.rb index e1ba86c..1d81654 100644 --- a/spec/end_to_end/end_to_end_spec.rb +++ b/spec/end_to_end/end_to_end_spec.rb @@ -56,7 +56,7 @@ add_a_single_line_of_text_question(question_text) add_a_single_line_of_text_question(alternate_question_text) - first(:link, "your questions").click + click_link "your questions", match: :first add_a_route selection_question, if_the_answer_selected_is: "Yes", skip_the_person_to: alternate_question_text add_a_secondary_skip last_question_before_skip: question_text, question_to_skip_to: "Check your answers before submitting" diff --git a/spec/support/feature_helpers.rb b/spec/support/feature_helpers.rb index 41ce1a2..16cd540 100644 --- a/spec/support/feature_helpers.rb +++ b/spec/support/feature_helpers.rb @@ -359,6 +359,13 @@ def form_is_filled_in_by_form_filler(live_form_link, yes_branch: false, confirma end # rubocop:enable Style/IdenticalConditionalBranches + if filler_answer_email_enabled? + logger.info "And I am asked if I want a copy of my answers" + expect(page.find("h1")).to have_content "Do you want to get an email with a copy of your answers?" + choose "No", visible: false + click_button "Continue" + end + logger.info "Then I can check my answers before I submit them" expect(page).to have_content "Check your answers before submitting your form" expect(page).to have_content "What is your favourite colour?" @@ -580,6 +587,10 @@ def skip_file_upload? ENV.fetch("SKIP_FILE_UPLOAD", false) end + def filler_answer_email_enabled? + Settings.features.filler_answer_email_enabled + end + def visit_product_page logger.info "Visiting product pages at #{forms_product_page_url}" visit forms_product_page_url