From aec198e7cffd8c1a3b1c4c80104cc5bf5e0e7fdf Mon Sep 17 00:00:00 2001 From: Kat Date: Mon, 27 Jun 2022 14:50:00 +0100 Subject: [PATCH] Add more tests for back button --- spec/features/schemes_spec.rb | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/spec/features/schemes_spec.rb b/spec/features/schemes_spec.rb index 713fca2ac..3d43f7c48 100644 --- a/spec/features/schemes_spec.rb +++ b/spec/features/schemes_spec.rb @@ -281,8 +281,7 @@ RSpec.describe "Schemes scheme Features" do context "when we amend scheme details" do it "returns to the primary client group question" do click_button "Save and continue" - expect(page).to have_content "What client group is this scheme intended for?" - end + expect(page).to have_current_path("/schemes/#{scheme.id}/primary-client-group") end end end @@ -305,6 +304,12 @@ RSpec.describe "Schemes scheme Features" do expect(page).to have_current_path("/schemes/#{scheme.id}/primary-client-group") expect(page).to have_content "What client group is this scheme intended for?" end + + context "when we amend primary client group" do + it "returns to the confirm secondary client group question" do + click_button "Save and continue" + expect(page).to have_current_path("/schemes/#{scheme.id}/confirm-secondary-client-group") end + end end context "when I confirm the secondary group" do @@ -326,6 +331,12 @@ RSpec.describe "Schemes scheme Features" do expect(page).to have_current_path("/schemes/#{scheme.id}/confirm-secondary-client-group") expect(page).to have_content "Does this scheme provide for another client group?" end + + context "when we amend confirm secondary client" do + it "returns to the secondary client group question" do + click_button "Save and continue" + expect(page).to have_current_path("/schemes/#{scheme.id}/secondary-client-group") end + end end context "when I select the secondary group" do @@ -347,6 +358,12 @@ RSpec.describe "Schemes scheme Features" do expect(page).to have_current_path("/schemes/#{scheme.id}/secondary-client-group") expect(page).to have_content "What is the other client group?" end + + context "when we amend secondary client" do + it "returns to the support question" do + click_button "Save and continue" + expect(page).to have_current_path("/schemes/#{scheme.id}/support") end + end end context "when I select the support answers" do