From 1cfa214b7d21abba1dd2c3c64316c97ae4b354fc Mon Sep 17 00:00:00 2001 From: Abeer Salameh Date: Wed, 5 Jun 2024 08:17:58 +0100 Subject: [PATCH] Travel to current cohort to avoid the new cohort setup pages When registration opens we see different views to the current cohort. Travel to the time the current cohort opens so we don't see setup pages. --- .../ect_doing_cip/no_validation_spec.rb | 2 +- .../manage_cip_participants_spec.rb | 2 +- .../manage_fip_partnered_participants_spec.rb | 10 +++++----- .../manage_fip_unpartnered_participants_spec.rb | 2 +- .../not_mentoring_mentors_spec.rb | 2 +- .../unhappy_path_email_taken_spec.rb | 2 +- .../manage_no_ect_training_spec.rb | 2 +- .../schools/core_programme/materials_spec.rb | 2 +- .../schools/early_career_teachers_request_spec.rb | 2 +- spec/requests/schools/mentors_request_spec.rb | 2 +- spec/support/cohort_periods.rb | 13 +++++++++++++ 11 files changed, 27 insertions(+), 14 deletions(-) diff --git a/spec/features/scenarios/participants/ect_doing_cip/no_validation_spec.rb b/spec/features/scenarios/participants/ect_doing_cip/no_validation_spec.rb index 83c8f78b9fe..dc6744c777c 100644 --- a/spec/features/scenarios/participants/ect_doing_cip/no_validation_spec.rb +++ b/spec/features/scenarios/participants/ect_doing_cip/no_validation_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -RSpec.feature "ECT doing CIP: no validation", type: :feature do +RSpec.feature "ECT doing CIP: no validation", type: :feature, mid_cohort: true do let!(:participant_details) do NewSeeds::Scenarios::Participants::Ects::EctNoValidation .new(school_cohort:, full_name: participant_full_name) diff --git a/spec/features/schools/participant_dashboard/manage_cip_participants_spec.rb b/spec/features/schools/participant_dashboard/manage_cip_participants_spec.rb index 319936ebe4e..cebc5bb987b 100644 --- a/spec/features/schools/participant_dashboard/manage_cip_participants_spec.rb +++ b/spec/features/schools/participant_dashboard/manage_cip_participants_spec.rb @@ -3,7 +3,7 @@ require "rails_helper" require_relative "../training_dashboard/manage_training_steps" -RSpec.describe "Manage CIP participants", js: true, with_feature_flags: { eligibility_notifications: "active" } do +RSpec.describe "Manage CIP participants", js: true, with_feature_flags: { eligibility_notifications: "active" }, mid_cohort: true do include ManageTrainingSteps before do diff --git a/spec/features/schools/participant_dashboard/manage_fip_partnered_participants_spec.rb b/spec/features/schools/participant_dashboard/manage_fip_partnered_participants_spec.rb index 1a15ac09499..839fe978f39 100644 --- a/spec/features/schools/participant_dashboard/manage_fip_partnered_participants_spec.rb +++ b/spec/features/schools/participant_dashboard/manage_fip_partnered_participants_spec.rb @@ -3,7 +3,7 @@ require "rails_helper" require_relative "../training_dashboard/manage_training_steps" -RSpec.describe "Manage FIP partnered participants with no change of circumstances", js: true, with_feature_flags: { eligibility_notifications: "active" } do +RSpec.describe "Manage FIP partnered participants with no change of circumstances", js: true, with_feature_flags: { eligibility_notifications: "active" }, mid_cohort: true do include ManageTrainingSteps context "inactive change of circumstances flag" do @@ -14,11 +14,11 @@ RSpec.describe "Manage FIP partnered participants with change of circumstances", js: true, with_feature_flags: { eligibility_notifications: "active" } do include ManageTrainingSteps - context "active change of circumstances flag" do + context "active change of circumstances flag", mid_cohort: true do it_behaves_like "manage fip participants example" end - context "transferring participants" do + context "transferring participants", mid_cohort: true do before do given_there_is_a_school_that_has_chosen_fip_for_previous_cohort_and_partnered and_i_am_signed_in_as_an_induction_coordinator @@ -53,7 +53,7 @@ end end - context "participants that have transferred out" do + context "participants that have transferred out", mid_cohort: true do before do given_there_is_a_school_that_has_chosen_fip_and_partnered and_i_have_a_transferred_out_participant @@ -61,7 +61,7 @@ and_i_click(Cohort.current.description) end - scenario "Induction coordinator can view participants that have completed their transfer out" do + scenario "Induction coordinator can view participants that have completed their transfer out", mid_cohort: true do given_i_am_taken_to_fip_induction_dashboard when_i_navigate_to_ect_dashboard when_i_filter_by("No longer training (1)") diff --git a/spec/features/schools/participant_dashboard/manage_fip_unpartnered_participants_spec.rb b/spec/features/schools/participant_dashboard/manage_fip_unpartnered_participants_spec.rb index 6a0694fec32..84d82ccbd30 100644 --- a/spec/features/schools/participant_dashboard/manage_fip_unpartnered_participants_spec.rb +++ b/spec/features/schools/participant_dashboard/manage_fip_unpartnered_participants_spec.rb @@ -3,7 +3,7 @@ require "rails_helper" require_relative "../training_dashboard/manage_training_steps" -RSpec.describe "Manage FIP unpartnered participants", js: true, with_feature_flags: { eligibility_notifications: "active" } do +RSpec.describe "Manage FIP unpartnered participants", js: true, with_feature_flags: { eligibility_notifications: "active" }, mid_cohort: true do include ManageTrainingSteps before do diff --git a/spec/features/schools/participant_dashboard/not_mentoring_mentors_spec.rb b/spec/features/schools/participant_dashboard/not_mentoring_mentors_spec.rb index 66732a6dada..7a9167c27c1 100644 --- a/spec/features/schools/participant_dashboard/not_mentoring_mentors_spec.rb +++ b/spec/features/schools/participant_dashboard/not_mentoring_mentors_spec.rb @@ -3,7 +3,7 @@ require "rails_helper" require_relative "../training_dashboard/manage_training_steps" -RSpec.describe "Manage currently training participants", js: true do +RSpec.describe "Manage currently training participants", js: true, mid_cohort: true do include ManageTrainingSteps before do diff --git a/spec/features/schools/participants/add_participants/unhappy_path_email_taken_spec.rb b/spec/features/schools/participants/add_participants/unhappy_path_email_taken_spec.rb index e942a8c4918..59378a6d99c 100644 --- a/spec/features/schools/participants/add_participants/unhappy_path_email_taken_spec.rb +++ b/spec/features/schools/participants/add_participants/unhappy_path_email_taken_spec.rb @@ -16,7 +16,7 @@ set_dqt_validation_result end - scenario "Induction tutor cannot add existing ECT" do + scenario "Induction tutor cannot add existing ECT", mid_cohort: true do when_i_navigate_to_ect_dashboard when_i_click_to_add_a_new_ect then_i_should_be_on_the_who_to_add_page diff --git a/spec/features/schools/training_dashboard/manage_no_ect_training_spec.rb b/spec/features/schools/training_dashboard/manage_no_ect_training_spec.rb index cae6f9f2f2a..db229a134ed 100644 --- a/spec/features/schools/training_dashboard/manage_no_ect_training_spec.rb +++ b/spec/features/schools/training_dashboard/manage_no_ect_training_spec.rb @@ -3,7 +3,7 @@ require "rails_helper" require_relative "./manage_training_steps" -RSpec.describe "Manage No ECT training", js: true do +RSpec.describe "Manage No ECT training", js: true, mid_cohort: true do include ManageTrainingSteps scenario "Manage No ECT Induction Coordinator" do diff --git a/spec/requests/schools/core_programme/materials_spec.rb b/spec/requests/schools/core_programme/materials_spec.rb index 2909eea37a5..0c9f1349689 100644 --- a/spec/requests/schools/core_programme/materials_spec.rb +++ b/spec/requests/schools/core_programme/materials_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -RSpec.describe "Schools::CoreProgramme::Materials", type: :request do +RSpec.describe "Schools::CoreProgramme::Materials", type: :request, mid_cohort: true do let(:user) { create(:user, :induction_coordinator) } let(:school) { user.induction_coordinator_profile.schools.first } let!(:cohort) { Cohort.current || create(:cohort, :current) } diff --git a/spec/requests/schools/early_career_teachers_request_spec.rb b/spec/requests/schools/early_career_teachers_request_spec.rb index 52a5e263a3a..53a48bec4ad 100644 --- a/spec/requests/schools/early_career_teachers_request_spec.rb +++ b/spec/requests/schools/early_career_teachers_request_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "Schools::EarlyCareerTeachers", type: :request, js: true, with_feature_flags: { eligibility_notifications: "active" } do +RSpec.describe "Schools::EarlyCareerTeachers", type: :request, js: true, with_feature_flags: { eligibility_notifications: "active" }, mid_cohort: true do let(:user) { create(:user, :induction_coordinator, school_ids: [school.id]) } let!(:lead_provider) { create(:cpd_lead_provider, :with_lead_provider, name: "Lead Provider").lead_provider } diff --git a/spec/requests/schools/mentors_request_spec.rb b/spec/requests/schools/mentors_request_spec.rb index 4c8f0903913..e5d9c5c5882 100644 --- a/spec/requests/schools/mentors_request_spec.rb +++ b/spec/requests/schools/mentors_request_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "Schools::Participants", type: :request, js: true, with_feature_flags: { eligibility_notifications: "active" } do +RSpec.describe "Schools::Participants", type: :request, js: true, with_feature_flags: { eligibility_notifications: "active" }, mid_cohort: true do let(:user) { create(:user, :induction_coordinator, school_ids: [school.id]) } let!(:lead_provider) { create(:cpd_lead_provider, :with_lead_provider, name: "Lead Provider").lead_provider } diff --git a/spec/support/cohort_periods.rb b/spec/support/cohort_periods.rb index 900d42825b9..9b07251af7d 100644 --- a/spec/support/cohort_periods.rb +++ b/spec/support/cohort_periods.rb @@ -14,3 +14,16 @@ def inside_auto_assignment_window(cohort: Cohort.current, &block) def outside_auto_assignment_window(cohort: Cohort.current, &block) travel_to(cohort.automatic_assignment_period_end_date + 1.week, &block) end + +# time travel to after the current cohort opens +RSpec.configure do |config| + config.before(mid_cohort: true) do + travel_to( + Time.zone.local( + Cohort.current.start_year, + Cohort.current.academic_year_start_date.month, + Cohort.current.academic_year_start_date.day + 2, + ), + ) + end +end