|
| 1 | +require_relative '../spec_helper' |
| 2 | + |
| 3 | +feature 'Questionnaire' do |
| 4 | + let(:editor) { EditorApp.new } |
| 5 | + |
| 6 | + scenario 'Building a form and ruling out GOV.UK Forms' do |
| 7 | + given_I_am_logged_in(admin: false) |
| 8 | + click_link I18n.t('services.create') |
| 9 | + |
| 10 | + # get_started |
| 11 | + expect(page).to have_content(I18n.t('questionnaire.get_started_form.heading')) |
| 12 | + choose I18n.t('activemodel.attributes.questionnaire/get_started_form/new_form_reason.building'), allow_label_click: true |
| 13 | + click_button I18n.t('dialogs.button_continue') |
| 14 | + |
| 15 | + # gov_forms |
| 16 | + expect(page).to have_content(I18n.t('questionnaire.gov_forms_form.heading')) |
| 17 | + choose I18n.t('activemodel.attributes.questionnaire/gov_forms/govuk_forms_ruled_out.true'), allow_label_click: true |
| 18 | + click_button I18n.t('dialogs.button_continue') |
| 19 | + |
| 20 | + # form_features |
| 21 | + expect(page).to have_content(I18n.t('questionnaire.form_features_form.heading')) |
| 22 | + check I18n.t('activemodel.attributes.questionnaire/form_features_form/required_moj_forms_features.multiple_questions'), allow_label_click: true |
| 23 | + fill_in I18n.t('questionnaire.form_features_form.label.text'), with: 'Because I want to use MoJ Forms' |
| 24 | + click_button I18n.t('dialogs.button_continue') |
| 25 | + |
| 26 | + # new_form |
| 27 | + expect(page).to have_content(I18n.t('questionnaire.new_form_form.heading')) |
| 28 | + choose I18n.t('activemodel.attributes.questionnaire/new_form_form/estimated_page_count.under_20'), allow_label_click: true |
| 29 | + choose I18n.t('activemodel.attributes.questionnaire/new_form_form/estimated_first_year_submissions_count.under_10000'), allow_label_click: true |
| 30 | + choose I18n.t('activemodel.attributes.questionnaire/new_form_form/submission_delivery_method.email'), allow_label_click: true |
| 31 | + click_button I18n.t('dialogs.button_continue') |
| 32 | + |
| 33 | + # requirements |
| 34 | + expect(page).to have_content(I18n.t('questionnaire.requirements.heading')) |
| 35 | + click_link I18n.t('dialogs.button_continue') |
| 36 | + |
| 37 | + # services/new |
| 38 | + expect(page).to have_content(I18n.t('activemodel.attributes.service_creation.service_name')) |
| 39 | + end |
| 40 | + |
| 41 | + scenario 'Building a form and NOT ruling out GOV.UK Forms but continuing anyway' do |
| 42 | + given_I_am_logged_in(admin: false) |
| 43 | + click_link I18n.t('services.create') |
| 44 | + |
| 45 | + # get_started |
| 46 | + choose I18n.t('activemodel.attributes.questionnaire/get_started_form/new_form_reason.building'), allow_label_click: true |
| 47 | + click_button I18n.t('dialogs.button_continue') |
| 48 | + |
| 49 | + # gov_forms |
| 50 | + choose I18n.t('activemodel.attributes.questionnaire/gov_forms/govuk_forms_ruled_out.false'), allow_label_click: true |
| 51 | + click_button I18n.t('dialogs.button_continue') |
| 52 | + |
| 53 | + # continue |
| 54 | + expect(page).to have_content(I18n.t('questionnaire.continue_form.heading')) |
| 55 | + choose I18n.t('activemodel.attributes.questionnaire/continue_form/continue_with_moj_forms.true'), allow_label_click: true |
| 56 | + click_button I18n.t('dialogs.button_continue') |
| 57 | + |
| 58 | + # new_form |
| 59 | + expect(page).to have_content(I18n.t('questionnaire.new_form_form.heading')) |
| 60 | + choose I18n.t('activemodel.attributes.questionnaire/new_form_form/estimated_page_count.under_20'), allow_label_click: true |
| 61 | + choose I18n.t('activemodel.attributes.questionnaire/new_form_form/estimated_first_year_submissions_count.under_10000'), allow_label_click: true |
| 62 | + choose I18n.t('activemodel.attributes.questionnaire/new_form_form/submission_delivery_method.email'), allow_label_click: true |
| 63 | + click_button I18n.t('dialogs.button_continue') |
| 64 | + |
| 65 | + # requirements |
| 66 | + expect(page).to have_content(I18n.t('questionnaire.requirements.heading')) |
| 67 | + click_link I18n.t('dialogs.button_continue') |
| 68 | + |
| 69 | + # services/new |
| 70 | + expect(page).to have_content(I18n.t('activemodel.attributes.service_creation.service_name')) |
| 71 | + end |
| 72 | + |
| 73 | + scenario 'Just experimenting' do |
| 74 | + given_I_am_logged_in(admin: false) |
| 75 | + click_link I18n.t('services.create') |
| 76 | + |
| 77 | + # get_started |
| 78 | + choose I18n.t('activemodel.attributes.questionnaire/get_started_form/new_form_reason.experiment'), allow_label_click: true |
| 79 | + click_button I18n.t('dialogs.button_continue') |
| 80 | + |
| 81 | + # great_choice |
| 82 | + expect(page).to have_content(I18n.t('questionnaire.great_choice.heading')) |
| 83 | + click_link I18n.t('dialogs.button_continue') |
| 84 | + |
| 85 | + # services/new |
| 86 | + expect(page).to have_content(I18n.t('activemodel.attributes.service_creation.service_name')) |
| 87 | + end |
| 88 | + |
| 89 | + scenario 'Building a form and NOT ruling out GOV.UK Forms and NOT continuing' do |
| 90 | + given_I_am_logged_in(admin: false) |
| 91 | + click_link I18n.t('services.create') |
| 92 | + |
| 93 | + # get_started |
| 94 | + choose I18n.t('activemodel.attributes.questionnaire/get_started_form/new_form_reason.building'), allow_label_click: true |
| 95 | + click_button I18n.t('dialogs.button_continue') |
| 96 | + |
| 97 | + # gov_forms |
| 98 | + choose I18n.t('activemodel.attributes.questionnaire/gov_forms/govuk_forms_ruled_out.false'), allow_label_click: true |
| 99 | + click_button I18n.t('dialogs.button_continue') |
| 100 | + |
| 101 | + # continue |
| 102 | + choose I18n.t('activemodel.attributes.questionnaire/continue_form/continue_with_moj_forms.false'), allow_label_click: true |
| 103 | + click_button I18n.t('dialogs.button_continue') |
| 104 | + |
| 105 | + # exit |
| 106 | + expect(page).to have_content(I18n.t('questionnaire.exit.heading')) |
| 107 | + click_link I18n.t('dialogs.link_back_to_your_forms') |
| 108 | + |
| 109 | + # services index |
| 110 | + expect(page).to have_content(I18n.t('services.heading')) |
| 111 | + end |
| 112 | +end |
0 commit comments