diff --git a/app/forms/journeys/additional_payments_for_teaching/poor_performance_form.rb b/app/forms/journeys/additional_payments_for_teaching/poor_performance_form.rb deleted file mode 100644 index 715d10548b..0000000000 --- a/app/forms/journeys/additional_payments_for_teaching/poor_performance_form.rb +++ /dev/null @@ -1,21 +0,0 @@ -module Journeys - module AdditionalPaymentsForTeaching - class PoorPerformanceForm < Form - attribute :subject_to_formal_performance_action, :boolean - attribute :subject_to_disciplinary_action, :boolean - - validates :subject_to_formal_performance_action, inclusion: {in: [true, false], message: i18n_error_message("subject_to_formal_performance_action.inclusion")} - validates :subject_to_disciplinary_action, inclusion: {in: [true, false], message: i18n_error_message("subject_to_disciplinary_action.inclusion")} - - def save - return false unless valid? - - journey_session.answers.assign_attributes( - subject_to_formal_performance_action:, - subject_to_disciplinary_action: - ) - journey_session.save - end - end - end -end diff --git a/app/forms/poor_performance_form.rb b/app/forms/poor_performance_form.rb new file mode 100644 index 0000000000..0fe1032b07 --- /dev/null +++ b/app/forms/poor_performance_form.rb @@ -0,0 +1,39 @@ +class PoorPerformanceForm < Form + attribute :subject_to_formal_performance_action, :boolean + attribute :subject_to_disciplinary_action, :boolean + + validates :subject_to_formal_performance_action, + inclusion: { + in: [true, false], + message: i18n_error_message("performance.inclusion") + } + + validates :subject_to_disciplinary_action, + inclusion: { + in: [true, false], + message: i18n_error_message("disciplinary.inclusion") + } + + def radio_options + [ + OpenStruct.new( + id: true, + name: "Yes" + ), + OpenStruct.new( + id: false, + name: "No" + ) + ] + end + + def save + return false if invalid? + + journey_session.answers.assign_attributes( + subject_to_formal_performance_action:, + subject_to_disciplinary_action: + ) + journey_session.save + end +end diff --git a/app/models/journeys/additional_payments_for_teaching/answers_presenter.rb b/app/models/journeys/additional_payments_for_teaching/answers_presenter.rb index 4c3376a047..3e38d921f1 100644 --- a/app/models/journeys/additional_payments_for_teaching/answers_presenter.rb +++ b/app/models/journeys/additional_payments_for_teaching/answers_presenter.rb @@ -90,7 +90,7 @@ def employed_directly def subject_to_formal_performance_action [ - t("additional_payments.forms.poor_performance.questions.formal_performance_action"), + t("additional_payments.forms.poor_performance.questions.performance.question"), (journey_session.answers.subject_to_formal_performance_action? ? "Yes" : "No"), "poor-performance" ] @@ -98,7 +98,7 @@ def subject_to_formal_performance_action def subject_to_disciplinary_action [ - t("additional_payments.forms.poor_performance.questions.disciplinary_action"), + t("additional_payments.forms.poor_performance.questions.disciplinary.question"), (journey_session.answers.subject_to_disciplinary_action? ? "Yes" : "No"), "poor-performance" ] diff --git a/app/models/journeys/further_education_payments.rb b/app/models/journeys/further_education_payments.rb index f9e9e1444c..85089e3acf 100644 --- a/app/models/journeys/further_education_payments.rb +++ b/app/models/journeys/further_education_payments.rb @@ -16,7 +16,8 @@ module FurtherEducationPayments "teaching-hours-per-week" => TeachingHoursPerWeekForm, "further-education-teaching-start-year" => FurtherEducationTeachingStartYearForm, "subjects-taught" => SubjectsTaughtForm, - "teaching-qualification" => TeachingQualificationForm + "teaching-qualification" => TeachingQualificationForm, + "poor-performance" => PoorPerformanceForm } } end diff --git a/app/models/journeys/further_education_payments/session_answers.rb b/app/models/journeys/further_education_payments/session_answers.rb index dec3430f93..3ef62aa669 100644 --- a/app/models/journeys/further_education_payments/session_answers.rb +++ b/app/models/journeys/further_education_payments/session_answers.rb @@ -9,6 +9,8 @@ class SessionAnswers < Journeys::SessionAnswers attribute :further_education_teaching_start_year, :string attribute :subjects_taught, default: [] attribute :teaching_qualification, :string + attribute :subject_to_formal_performance_action, :boolean + attribute :subject_to_disciplinary_action, :boolean def school @school ||= School.find(school_id) diff --git a/app/views/additional_payments/claims/poor_performance.html.erb b/app/views/additional_payments/claims/poor_performance.html.erb index 07206acecd..6ce9afc512 100644 --- a/app/views/additional_payments/claims/poor_performance.html.erb +++ b/app/views/additional_payments/claims/poor_performance.html.erb @@ -1,89 +1,31 @@ -<% content_for(:page_title, page_title(t("#{@form.i18n_namespace}.forms.poor_performance.questions.poor_performance"), journey: current_journey_routing_name, show_error: @form.errors.any?)) %> +<% content_for(:page_title, page_title(@form.t(:heading), journey: current_journey_routing_name, show_error: @form.errors.any?)) %>
- <%= render("shared/error_summary", instance: @form, errored_field_id_overrides: { - "subject_to_formal_performance_action": "claim_subject_to_formal_performance_action_true", - "subject_to_disciplinary_action": "claim_subject_to_disciplinary_action_true" - }) if @form.errors.any? %> - <%= form_for @form, url: claim_path(current_journey_routing_name) do |form| %> + <%= form_for @form, url: claim_path(current_journey_routing_name), builder: GOVUKDesignSystemFormBuilder::FormBuilder do |f| %> + <%= f.govuk_error_summary %> +

- <%= t("#{@form.i18n_namespace}.forms.poor_performance.questions.poor_performance") %> + <%= @form.t(:heading) %>

- <%= form_group_tag @form, :subject_to_formal_performance_action do %> - - <%= form.hidden_field :subject_to_formal_performance_action %> - -
- - -

- <%= t("#{@form.i18n_namespace}.forms.poor_performance.questions.formal_performance_action") %> -

-
- - <%= errors_tag @form, :subject_to_formal_performance_action %> - -
- <%= t("#{@form.i18n_namespace}.forms.poor_performance.questions.formal_performance_action_hint") %> -
- -
- -
- <%= form.radio_button(:subject_to_formal_performance_action, true, class: "govuk-radios__input") %> - <%= form.label :subject_to_formal_performance_action_true, "Yes", class: "govuk-label govuk-radios__label" %> -
- -
- <%= form.radio_button(:subject_to_formal_performance_action, false, class: "govuk-radios__input") %> - <%= form.label :subject_to_formal_performance_action_false, "No", class: "govuk-label govuk-radios__label" %> -
- -
- -
- - <% end %> - - <%= form_group_tag @form, :subject_to_disciplinary_action do %> - - <%= form.hidden_field :subject_to_disciplinary_action %> - -
- - -

- <%= t("#{@form.i18n_namespace}.forms.poor_performance.questions.disciplinary_action") %> -

-
- - <%= errors_tag @form, :subject_to_disciplinary_action %> - -
- <%= t("#{@form.i18n_namespace}.forms.poor_performance.questions.disciplinary_action_hint") %> -
- -
- -
- <%= form.radio_button(:subject_to_disciplinary_action, true, class: "govuk-radios__input") %> - <%= form.label :subject_to_disciplinary_action_true, "Yes", class: "govuk-label govuk-radios__label" %> -
- -
- <%= form.radio_button(:subject_to_disciplinary_action, false, class: "govuk-radios__input") %> - <%= form.label :subject_to_disciplinary_action_false, "No", class: "govuk-label govuk-radios__label" %> -
- -
- -
- - <% end %> - - <%= form.submit "Continue", class: "govuk-button", data: {module: "govuk-button"} %> + <%= f.govuk_collection_radio_buttons :subject_to_formal_performance_action, @form.radio_options, :id, :name, + legend: { + text: @form.t("questions.performance.question"), + tag: "h2", + size: "m" + }, + hint: { text: @form.t("questions.performance.hint") } %> + + <%= f.govuk_collection_radio_buttons :subject_to_disciplinary_action, @form.radio_options, :id, :name, + legend: { + text: @form.t("questions.disciplinary.question"), + tag: "h2", + size: "m" + }, + hint: { text: @form.t("questions.disciplinary.hint") } %> + + <%= f.govuk_submit %> <% end %>
diff --git a/app/views/further_education_payments/claims/poor_performance.html.erb b/app/views/further_education_payments/claims/poor_performance.html.erb index f346f2a49f..48323259eb 100644 --- a/app/views/further_education_payments/claims/poor_performance.html.erb +++ b/app/views/further_education_payments/claims/poor_performance.html.erb @@ -1,7 +1,29 @@ -

- FE poor performance goes here -

+
+
+ <%= form_with model: @form, url: claim_path(current_journey_routing_name), method: :patch, builder: GOVUKDesignSystemFormBuilder::FormBuilder, html: { novalidate: false } do |f| %> + <%= f.govuk_error_summary %> -<%= form_with model: @form, url: claim_path(current_journey_routing_name), method: :patch, builder: GOVUKDesignSystemFormBuilder::FormBuilder, html: { novalidate: false } do |f| %> - <%= f.govuk_submit %> -<% end %> +

+ <%= @form.t(:heading) %> +

+ + <%= f.govuk_collection_radio_buttons :subject_to_formal_performance_action, @form.radio_options, :id, :name, + legend: { + text: @form.t("questions.performance.question"), + tag: "h2", + size: "m" + }, + hint: { text: @form.t("questions.performance.hint") } %> + + <%= f.govuk_collection_radio_buttons :subject_to_disciplinary_action, @form.radio_options, :id, :name, + legend: { + text: @form.t("questions.disciplinary.question"), + tag: "h2", + size: "m" + }, + hint: { text: @form.t("questions.disciplinary.hint") } %> + + <%= f.govuk_submit %> + <% end %> +
+
diff --git a/config/locales/en.yml b/config/locales/en.yml index 4a67ed96ca..1f6b38a59f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -486,21 +486,23 @@ en: errors: blank: "Select yes if you have completed your induction" poor_performance: + heading: Tell us if you are currently under any performance measures or disciplinary action questions: - poor_performance: Tell us if you are currently under any performance measures or disciplinary action - disciplinary_action: "Are you currently subject to disciplinary action?" - disciplinary_action_hint: - "This is more serious than performance measures and could be because of misconduct. It is something we may - check with your school as it will affect your eligibility." - formal_performance_action: "Have any performance measures been started against you?" - formal_performance_action_hint: - "This will be as a result of your underperformance as a teacher over a period of time. It could put your - employment at the school at risk and is something we may check with your school as it will affect your - eligibility." - errors: - subject_to_formal_performance_action: + performance: + question: "Have any performance measures been started against you?" + hint: + "This will be as a result of your underperformance as a teacher over a period of time. It could put your + employment at the school at risk and is something we may check with your school as it will affect your + eligibility." + disciplinary: + question: "Are you currently subject to disciplinary action?" + hint: + "This is more serious than performance measures and could be because of misconduct. It is something we may + check with your school as it will affect your eligibility." + errors: + performance: inclusion: Select yes if you are subject to formal action for poor performance at work - subject_to_disciplinary_action: + disciplinary: inclusion: Select yes if you are subject to disciplinary action qualification: questions: @@ -818,6 +820,20 @@ en: hint: Your response will be noted for future claims. If you don’t have a teaching qualification yet, make sure that you enrol on one or complete one in the next 12 months. errors: inclusion: Select whether you have, are currently enrolled or plan to enrol on a teaching qualification + poor_performance: + heading: Tell us if you are currently under any performance measures or disciplinary action + questions: + performance: + question: Have any performance measures been started against you? + hint: This will be as a result of your underperformance as a teacher over a period of time. It could put your employment at the further education (FE) provider at risk and is something we may check with them as it will affect your eligibility. + disciplinary: + question: Are you currently subject to disciplinary action? + hint: This is more serious than performance measures and could be because of misconduct. It is something we may check with your FE provider as it will affect your eligibility. + errors: + performance: + inclusion: Select yes if you are subject to formal action for poor performance at work + disciplinary: + inclusion: Select yes if you are subject to disciplinary action activerecord: errors: models: diff --git a/spec/features/backlink_spec.rb b/spec/features/backlink_spec.rb index 49dde0d14a..c63f82c992 100644 --- a/spec/features/backlink_spec.rb +++ b/spec/features/backlink_spec.rb @@ -24,8 +24,12 @@ click_on "Continue" expect(page).to have_content("Tell us if you are currently under any performance measures or disciplinary action") - choose "claim_subject_to_formal_performance_action_false" - choose "claim_subject_to_disciplinary_action_false" + within all(".govuk-fieldset")[0] do + choose("No") + end + within all(".govuk-fieldset")[1] do + choose("No") + end click_on "Continue" expect(page).to have_content("Which route into teaching did you take?") diff --git a/spec/features/combined_teacher_claim_journey_dependent_answers_spec.rb b/spec/features/combined_teacher_claim_journey_dependent_answers_spec.rb index 8eae020b23..47f964046e 100644 --- a/spec/features/combined_teacher_claim_journey_dependent_answers_spec.rb +++ b/spec/features/combined_teacher_claim_journey_dependent_answers_spec.rb @@ -32,10 +32,14 @@ click_on "Continue" # - Poor performance - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.formal_performance_action")) - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary_action")) - choose "claim_subject_to_formal_performance_action_false" - choose "claim_subject_to_disciplinary_action_false" + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.performance.question")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary.question")) + within all(".govuk-fieldset")[0] do + choose("No") + end + within all(".govuk-fieldset")[1] do + choose("No") + end click_on "Continue" # - What route into teaching did you take? diff --git a/spec/features/combined_teacher_claim_journey_spec.rb b/spec/features/combined_teacher_claim_journey_spec.rb index 148bdcbc5e..2d8e2a7bcf 100644 --- a/spec/features/combined_teacher_claim_journey_spec.rb +++ b/spec/features/combined_teacher_claim_journey_spec.rb @@ -59,11 +59,15 @@ click_on "Continue" # - Poor performance - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.formal_performance_action")) - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary_action")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.performance.question")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary.question")) - choose "claim_subject_to_formal_performance_action_false" - choose "claim_subject_to_disciplinary_action_false" + within all(".govuk-fieldset")[0] do + choose("No") + end + within all(".govuk-fieldset")[1] do + choose("No") + end click_on "Continue" # - What route into teaching did you take? @@ -278,11 +282,15 @@ click_on "Continue" # - Poor performance - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.formal_performance_action")) - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary_action")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.performance.question")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary.question")) - choose "claim_subject_to_formal_performance_action_false" - choose "claim_subject_to_disciplinary_action_false" + within all(".govuk-fieldset")[0] do + choose("No") + end + within all(".govuk-fieldset")[1] do + choose("No") + end click_on "Continue" # - What route into teaching did you take? diff --git a/spec/features/combined_teacher_claim_journey_with_teacher_id_check_email_spec.rb b/spec/features/combined_teacher_claim_journey_with_teacher_id_check_email_spec.rb index 117da10bcc..733201f095 100644 --- a/spec/features/combined_teacher_claim_journey_with_teacher_id_check_email_spec.rb +++ b/spec/features/combined_teacher_claim_journey_with_teacher_id_check_email_spec.rb @@ -102,11 +102,15 @@ def navigate_to_check_email_page(school:) click_on "Continue" # - Poor performance - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.formal_performance_action")) - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary_action")) - - choose "claim_subject_to_formal_performance_action_false" - choose "claim_subject_to_disciplinary_action_false" + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.performance.question")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary.question")) + + within all(".govuk-fieldset")[0] do + choose("No") + end + within all(".govuk-fieldset")[1] do + choose("No") + end click_on "Continue" # - What route into teaching did you take? diff --git a/spec/features/combined_teacher_claim_journey_with_teacher_id_check_mobile_spec.rb b/spec/features/combined_teacher_claim_journey_with_teacher_id_check_mobile_spec.rb index c69f5553d2..2e27ea0f0a 100644 --- a/spec/features/combined_teacher_claim_journey_with_teacher_id_check_mobile_spec.rb +++ b/spec/features/combined_teacher_claim_journey_with_teacher_id_check_mobile_spec.rb @@ -132,8 +132,12 @@ def navigate_to_check_mobile_page click_on "Continue" # - Performance Issues - choose "claim_subject_to_formal_performance_action_false" - choose "claim_subject_to_disciplinary_action_false" + within all(".govuk-fieldset")[0] do + choose("No") + end + within all(".govuk-fieldset")[1] do + choose("No") + end click_on "Continue" # - Check and confirm qualifications diff --git a/spec/features/combined_teacher_claim_journey_with_teacher_id_spec.rb b/spec/features/combined_teacher_claim_journey_with_teacher_id_spec.rb index a851a8289c..e2f5708dfa 100644 --- a/spec/features/combined_teacher_claim_journey_with_teacher_id_spec.rb +++ b/spec/features/combined_teacher_claim_journey_with_teacher_id_spec.rb @@ -362,10 +362,14 @@ def navigate_until_performance_related_questions(expect_induction_question: fals click_on "Continue" # - Performance Issues - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.poor_performance")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.heading")) - choose "claim_subject_to_formal_performance_action_false" - choose "claim_subject_to_disciplinary_action_false" + within all(".govuk-fieldset")[0] do + choose("No") + end + within all(".govuk-fieldset")[1] do + choose("No") + end click_on "Continue" end end diff --git a/spec/features/early_career_payments_claim_lupp_ineligible_spec.rb b/spec/features/early_career_payments_claim_lupp_ineligible_spec.rb index 9dc04b804f..e0361c4700 100644 --- a/spec/features/early_career_payments_claim_lupp_ineligible_spec.rb +++ b/spec/features/early_career_payments_claim_lupp_ineligible_spec.rb @@ -45,18 +45,20 @@ click_on "Continue" # - Performance Issues - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.poor_performance")) - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.formal_performance_action")) - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.formal_performance_action_hint")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.heading")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.performance.question")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.performance.hint")) - # No - choose "claim_subject_to_formal_performance_action_false" + within all(".govuk-fieldset")[0] do + choose("No") + end - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary_action")) - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary_action_hint")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary.question")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary.hint")) - # "No" - choose "claim_subject_to_disciplinary_action_false" + within all(".govuk-fieldset")[1] do + choose("No") + end click_on "Continue" diff --git a/spec/features/early_career_payments_claim_spec.rb b/spec/features/early_career_payments_claim_spec.rb index 75d65d87b5..485f96495c 100644 --- a/spec/features/early_career_payments_claim_spec.rb +++ b/spec/features/early_career_payments_claim_spec.rb @@ -46,18 +46,20 @@ click_on "Continue" # - Performance Issues - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.poor_performance")) - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.formal_performance_action")) - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.formal_performance_action_hint")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.heading")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.performance.question")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.performance.hint")) - # No - choose "claim_subject_to_formal_performance_action_false" + within all(".govuk-fieldset")[0] do + choose("No") + end - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary_action")) - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary_action_hint")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary.question")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary.hint")) - # "No" - choose "claim_subject_to_disciplinary_action_false" + within all(".govuk-fieldset")[1] do + choose("No") + end click_on "Continue" @@ -320,7 +322,7 @@ expect(journey_session.reload.answers.employed_directly).to eql true # - Are you currently subject to action for poor performance - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.formal_performance_action")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.performance.question")) end context "Route into teaching" do @@ -464,18 +466,20 @@ click_on "Continue" # - Performance Issues - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.poor_performance")) - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.formal_performance_action")) - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.formal_performance_action_hint")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.heading")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.performance.question")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.performance.hint")) - # No - choose "claim_subject_to_formal_performance_action_false" + within all(".govuk-fieldset")[0] do + choose("No") + end - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary_action")) - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary_action_hint")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary.question")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary.hint")) - # "No" - choose "claim_subject_to_disciplinary_action_false" + within all(".govuk-fieldset")[1] do + choose("No") + end click_on "Continue" # - What route into teaching did you take? @@ -1008,10 +1012,12 @@ click_on "Continue" # - Performance Issues - # No - choose "claim_subject_to_formal_performance_action_false" - # "No" - choose "claim_subject_to_disciplinary_action_false" + within all(".govuk-fieldset")[0] do + choose("No") + end + within all(".govuk-fieldset")[1] do + choose("No") + end click_on "Continue" # - What route into teaching did you take? diff --git a/spec/features/further_education_payments/happy_js_path_spec.rb b/spec/features/further_education_payments/happy_js_path_spec.rb index 9863de6557..65760be790 100644 --- a/spec/features/further_education_payments/happy_js_path_spec.rb +++ b/spec/features/further_education_payments/happy_js_path_spec.rb @@ -55,7 +55,14 @@ choose("Yes") click_button "Continue" - expect(page).to have_content("FE poor performance goes here") + expect(page).to have_content("Have any performance measures been started against you?") + within all(".govuk-fieldset")[0] do + choose("No") + end + expect(page).to have_content("Are you currently subject to disciplinary action?") + within all(".govuk-fieldset")[1] do + choose("No") + end click_button "Continue" expect(page).to have_content("FE check your answers goes here") diff --git a/spec/features/further_education_payments/happy_path_spec.rb b/spec/features/further_education_payments/happy_path_spec.rb index 6e52ea9f4b..4379d34daf 100644 --- a/spec/features/further_education_payments/happy_path_spec.rb +++ b/spec/features/further_education_payments/happy_path_spec.rb @@ -52,7 +52,14 @@ choose("Yes") click_button "Continue" - expect(page).to have_content("FE poor performance goes here") + expect(page).to have_content("Have any performance measures been started against you?") + within all(".govuk-fieldset")[0] do + choose("No") + end + expect(page).to have_content("Are you currently subject to disciplinary action?") + within all(".govuk-fieldset")[1] do + choose("No") + end click_button "Continue" expect(page).to have_content("FE check your answers goes here") diff --git a/spec/features/hmrc_bank_validation_spec.rb b/spec/features/hmrc_bank_validation_spec.rb index 13ae1f7bbd..64d3f354b1 100644 --- a/spec/features/hmrc_bank_validation_spec.rb +++ b/spec/features/hmrc_bank_validation_spec.rb @@ -34,8 +34,12 @@ def get_to_bank_details_page click_on "Continue" # - Poor performance - choose "claim_subject_to_formal_performance_action_false" - choose "claim_subject_to_disciplinary_action_false" + within all(".govuk-fieldset")[0] do + choose("No") + end + within all(".govuk-fieldset")[1] do + choose("No") + end click_on "Continue" # - What route into teaching did you take? diff --git a/spec/features/ineligibility_reason_spec.rb b/spec/features/ineligibility_reason_spec.rb index 958e4019b6..53cddade6e 100644 --- a/spec/features/ineligibility_reason_spec.rb +++ b/spec/features/ineligibility_reason_spec.rb @@ -39,24 +39,36 @@ end scenario "formal performance action" do - choose "claim_subject_to_formal_performance_action_true" - choose "claim_subject_to_disciplinary_action_false" + within all(".govuk-fieldset")[0] do + choose("Yes") + end + within all(".govuk-fieldset")[1] do + choose("No") + end click_on "Continue" expect(page).to have_css("div#generic") end scenario "disciplinary action" do - choose "claim_subject_to_formal_performance_action_false" - choose "claim_subject_to_disciplinary_action_true" + within all(".govuk-fieldset")[0] do + choose("No") + end + within all(".govuk-fieldset")[1] do + choose("Yes") + end click_on "Continue" expect(page).to have_css("div#generic") end scenario "formal performance and disciplinary action" do - choose "claim_subject_to_formal_performance_action_true" - choose "claim_subject_to_disciplinary_action_true" + within all(".govuk-fieldset")[0] do + choose("Yes") + end + within all(".govuk-fieldset")[1] do + choose("Yes") + end click_on "Continue" expect(page).to have_css("div#generic") @@ -305,8 +317,12 @@ def navigate_to_year_selection(school) click_on "Continue" # - Poor performance - choose "claim_subject_to_formal_performance_action_false" - choose "claim_subject_to_disciplinary_action_false" + within all(".govuk-fieldset")[0] do + choose("No") + end + within all(".govuk-fieldset")[1] do + choose("No") + end click_on "Continue" # - What route into teaching did you take? diff --git a/spec/features/ineligible_early_career_payments_claims_spec.rb b/spec/features/ineligible_early_career_payments_claims_spec.rb index 67b558c0de..11bec92a48 100644 --- a/spec/features/ineligible_early_career_payments_claims_spec.rb +++ b/spec/features/ineligible_early_career_payments_claims_spec.rb @@ -70,11 +70,15 @@ click_on "Continue" # - Poor performance - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.formal_performance_action")) - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary_action")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.performance.question")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary.question")) - choose "claim_subject_to_formal_performance_action_true" - choose "claim_subject_to_disciplinary_action_false" + within all(".govuk-fieldset")[0] do + choose("Yes") + end + within all(".govuk-fieldset")[1] do + choose("No") + end click_on "Continue" expect(page).to have_text(I18n.t("additional_payments.ineligible.heading")) @@ -110,11 +114,15 @@ click_on "Continue" # - Poor performance - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.formal_performance_action")) - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary_action")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.performance.question")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary.question")) - choose "claim_subject_to_formal_performance_action_false" - choose "claim_subject_to_disciplinary_action_true" + within all(".govuk-fieldset")[0] do + choose("No") + end + within all(".govuk-fieldset")[1] do + choose("Yes") + end click_on "Continue" expect(page).to have_text(I18n.t("additional_payments.ineligible.heading")) @@ -150,11 +158,15 @@ click_on "Continue" # - Poor performance - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.formal_performance_action")) - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary_action")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.performance.question")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary.question")) - choose "claim_subject_to_formal_performance_action_true" - choose "claim_subject_to_disciplinary_action_true" + within all(".govuk-fieldset")[0] do + choose("Yes") + end + within all(".govuk-fieldset")[1] do + choose("Yes") + end click_on "Continue" expect(page).to have_text(I18n.t("additional_payments.ineligible.heading")) @@ -276,11 +288,15 @@ click_on "Continue" # - Poor performance - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.formal_performance_action")) - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary_action")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.performance.question")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary.question")) - choose "claim_subject_to_formal_performance_action_false" - choose "claim_subject_to_disciplinary_action_false" + within all(".govuk-fieldset")[0] do + choose("No") + end + within all(".govuk-fieldset")[1] do + choose("No") + end click_on "Continue" # - What route into teaching did you take? @@ -341,11 +357,15 @@ click_on "Continue" # - Poor performance - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.formal_performance_action")) - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary_action")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.performance.question")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary.question")) - choose "claim_subject_to_formal_performance_action_false" - choose "claim_subject_to_disciplinary_action_false" + within all(".govuk-fieldset")[0] do + choose("No") + end + within all(".govuk-fieldset")[1] do + choose("No") + end click_on "Continue" # - What route into teaching did you take? @@ -413,11 +433,15 @@ click_on "Continue" # - Poor performance - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.formal_performance_action")) - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary_action")) - - choose "claim_subject_to_formal_performance_action_false" - choose "claim_subject_to_disciplinary_action_false" + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.performance.question")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary.question")) + + within all(".govuk-fieldset")[0] do + choose("No") + end + within all(".govuk-fieldset")[1] do + choose("No") + end click_on "Continue" # - What route into teaching did you take? diff --git a/spec/features/ineligible_levelling_up_premium_payments_spec.rb b/spec/features/ineligible_levelling_up_premium_payments_spec.rb index 6893a25f60..8f19bbe515 100644 --- a/spec/features/ineligible_levelling_up_premium_payments_spec.rb +++ b/spec/features/ineligible_levelling_up_premium_payments_spec.rb @@ -77,11 +77,15 @@ click_on "Continue" # - Poor performance - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.formal_performance_action")) - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary_action")) - - choose "claim_subject_to_formal_performance_action_false" - choose "claim_subject_to_disciplinary_action_false" + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.performance.question")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary.question")) + + within all(".govuk-fieldset")[0] do + choose("No") + end + within all(".govuk-fieldset")[1] do + choose("No") + end click_on "Continue" # - What route into teaching did you take? diff --git a/spec/features/itt_subject_selection_spec.rb b/spec/features/itt_subject_selection_spec.rb index 72f57f1bac..d507d699e4 100644 --- a/spec/features/itt_subject_selection_spec.rb +++ b/spec/features/itt_subject_selection_spec.rb @@ -206,11 +206,15 @@ def navigate_to_year_selection(school) click_on "Continue" # - Poor performance - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.formal_performance_action")) - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary_action")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.performance.question")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary.question")) - choose "claim_subject_to_formal_performance_action_false" - choose "claim_subject_to_disciplinary_action_false" + within all(".govuk-fieldset")[0] do + choose("No") + end + within all(".govuk-fieldset")[1] do + choose("No") + end click_on "Continue" # - What route into teaching did you take? diff --git a/spec/features/levelling_up_premium_payments_spec.rb b/spec/features/levelling_up_premium_payments_spec.rb index 9e716ec98f..ffb7232a1d 100644 --- a/spec/features/levelling_up_premium_payments_spec.rb +++ b/spec/features/levelling_up_premium_payments_spec.rb @@ -63,11 +63,15 @@ def check_eligibility_up_to_itt_subject click_on "Continue" # - Poor performance - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.formal_performance_action")) - expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary_action")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.performance.question")) + expect(page).to have_text(I18n.t("additional_payments.forms.poor_performance.questions.disciplinary.question")) - choose "claim_subject_to_formal_performance_action_false" - choose "claim_subject_to_disciplinary_action_false" + within all(".govuk-fieldset")[0] do + choose("No") + end + within all(".govuk-fieldset")[1] do + choose("No") + end click_on "Continue" # - What route into teaching did you take? diff --git a/spec/forms/journeys/additional_payments_for_teaching/poor_performance_form_spec.rb b/spec/forms/poor_performance_form_spec.rb similarity index 90% rename from spec/forms/journeys/additional_payments_for_teaching/poor_performance_form_spec.rb rename to spec/forms/poor_performance_form_spec.rb index 810f0cf84d..d4cf89040b 100644 --- a/spec/forms/journeys/additional_payments_for_teaching/poor_performance_form_spec.rb +++ b/spec/forms/poor_performance_form_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Journeys::AdditionalPaymentsForTeaching::PoorPerformanceForm do +RSpec.describe PoorPerformanceForm do subject(:form) { described_class.new(journey_session:, journey:, params:) } let(:journey) { Journeys::AdditionalPaymentsForTeaching } @@ -26,7 +26,7 @@ expect(form).to be_invalid expect(form.errors[:subject_to_formal_performance_action]) - .to eq([form.i18n_errors_path("subject_to_formal_performance_action.inclusion")]) + .to eq([form.i18n_errors_path("performance.inclusion")]) end it "can be true or false" do @@ -44,7 +44,7 @@ expect(form).to be_invalid expect(form.errors[:subject_to_disciplinary_action]) - .to eq([form.i18n_errors_path("subject_to_disciplinary_action.inclusion")]) + .to eq([form.i18n_errors_path("disciplinary.inclusion")]) end it "can be true or false" do