From 94e41f5eeca136ce5b7bf6d3fa491aaed1e1d67c Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire Date: Wed, 30 Nov 2022 09:18:01 +0000 Subject: [PATCH] test: wip tests --- spec/features/schemes_helpers.rb | 45 +++++++++++++++++++++++++++----- spec/features/schemes_spec.rb | 5 ++-- 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/spec/features/schemes_helpers.rb b/spec/features/schemes_helpers.rb index 0592a8ef2..2cd48acf6 100644 --- a/spec/features/schemes_helpers.rb +++ b/spec/features/schemes_helpers.rb @@ -55,15 +55,48 @@ module SchemesHelpers end def fill_in_and_save_location - fill_in "Postcode", with: "AA11AA" - fill_in "Location name (optional)", with: "Some name" - fill_in "Total number of units at this location", with: 5 + fill_in_and_save_postcode + fill_in_and_save_local_authority + fill_in_and_save_name + fill_in_and_save_units + fill_in_and_save_type_of_unit + fill_in_and_save_mobility_standards + fill_in_and_save_availability + end + + def fill_in_and_save_postcode + fill_in with: "AA11AA" + click_button "Save and continue" + end + + def fill_in_and_save_local_authority + fill_in with: "Adur" + end + + def fill_in_and_save_name + fill_in with: "Some name" + click_button "Save and continue" + end + + def fill_in_and_save_units + fill_in with: 5 + click_button "Save and continue" + end + + def fill_in_and_save_type_of_unit + choose "Self-contained house" + click_button "Save and continue" + end + + def fill_in_and_save_mobility_standards + choose "location-mobility-type-none-field" + click_button "Save and continue" + end + + def fill_in_and_save_availability fill_in "Day", with: 2 fill_in "Month", with: 2 fill_in "Year", with: 2022 - choose "Self-contained house" - choose "location-add-another-location-no-field" - choose "location-mobility-type-none-field" click_button "Save and continue" end diff --git a/spec/features/schemes_spec.rb b/spec/features/schemes_spec.rb index 797b718af..e68893153 100644 --- a/spec/features/schemes_spec.rb +++ b/spec/features/schemes_spec.rb @@ -324,6 +324,7 @@ RSpec.describe "Schemes scheme Features" do context "when creating a new scheme" do let(:organisation_name) { "FooBar" } let(:scheme) { Scheme.first } + let(:location) { Location.first } before do FactoryBot.create(:organisation, name: organisation_name) @@ -472,8 +473,8 @@ RSpec.describe "Schemes scheme Features" do it "lets me check my answers after adding a location" do fill_in_and_save_location - expect(page).to have_current_path("/schemes/#{scheme.id}/check-answers") - expect(page).to have_content "Check your changes before creating this scheme" + expect(page).to have_current_path("/schemes/#{scheme.id}/locations/#{location.id}/check-answers") + expect(page).to have_content "Check your answers" end it "lets me check my answers after adding a second location" do