From e14342f98a4406f9955a392cdf7018ffd8a342ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20J=C3=A4ggi?= Date: Tue, 17 Dec 2024 16:46:26 +0100 Subject: [PATCH] Add feature spec for all abo wizards --- spec/features/signup/abo_basic_login_spec.rb | 13 +++++++++++++ spec/features/signup/abo_magazin_spec.rb | 15 +++++++++++++++ spec/features/signup/abo_touren_portal_spec.rb | 14 ++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/spec/features/signup/abo_basic_login_spec.rb b/spec/features/signup/abo_basic_login_spec.rb index 6ef7441af..c9516e0c7 100644 --- a/spec/features/signup/abo_basic_login_spec.rb +++ b/spec/features/signup/abo_basic_login_spec.rb @@ -102,4 +102,17 @@ def expect_validation_error(message) expect(page).to have_link("Anmelden") end end + + it "has prefilled form when logged in" do + people(:admin).update!(country: "CH") + sign_in(people(:admin)) + visit group_self_registration_path(group_id: group) + expect(page).to have_text "SAC-KONTO ERSTELLEN" + expect(page).not_to have_text "Weiter" + check "Ich habe die Datenschutzerklärung gelesen und stimme dieser zu" + expect do + click_button "SAC-KONTO ERSTELLEN" + expect(page).to have_css "#error_explanation, #flash > .alert" + end.to change { Role.count }.by(1) + end end diff --git a/spec/features/signup/abo_magazin_spec.rb b/spec/features/signup/abo_magazin_spec.rb index e7b9c1eca..e9ed13ef3 100644 --- a/spec/features/signup/abo_magazin_spec.rb +++ b/spec/features/signup/abo_magazin_spec.rb @@ -155,4 +155,19 @@ def complete_last_page(date: Date.tomorrow, submit: true) expect(page).to have_field("Geburtsdatum", with: "03.01.1924") end end + + it "has prefilled form when logged in" do + people(:admin).update!(country: "CH") + sign_in(people(:admin)) + visit group_self_registration_path(group_id: group) + expect_active_step "Personendaten" + click_button "Weiter" + expect(page).to have_text "support@hitobito.example.com" + check "Ich habe die AGB gelesen und stimme diesen zu" + check "Ich habe die Datenschutzerklärung gelesen und stimme dieser zu" + expect do + click_button "ABO KOSTENPFLICHTIG BESTELLEN" + expect(page).to have_css "#error_explanation, #flash > .alert" + end.to change { Role.count }.by(1) + end end diff --git a/spec/features/signup/abo_touren_portal_spec.rb b/spec/features/signup/abo_touren_portal_spec.rb index 65f5b86c0..ae8bf8f61 100644 --- a/spec/features/signup/abo_touren_portal_spec.rb +++ b/spec/features/signup/abo_touren_portal_spec.rb @@ -114,4 +114,18 @@ def expect_validation_error(message) expect(page).to have_text "Person muss 18 Jahre oder älter sein" end.not_to change { Person.count } end + + it "has prefilled form when logged in" do + people(:admin).update!(country: "CH") + sign_in(people(:admin)) + visit group_self_registration_path(group_id: group) + expect(page).to have_text "Registrieren" + expect(page).not_to have_text "Weiter" + check "Ich habe die Statuten gelesen und stimme diesen zu" + check "Ich habe die Datenschutzerklärung gelesen und stimme dieser zu" + expect do + click_button "Registrieren" + expect(page).to have_css "#error_explanation, #flash > .alert" + end.to change { Role.count }.by(1) + end end