diff --git a/spec/features/verification/level_three_verification_spec.rb b/spec/features/verification/level_three_verification_spec.rb index 617065379..4f7cc9bf3 100644 --- a/spec/features/verification/level_three_verification_spec.rb +++ b/spec/features/verification/level_three_verification_spec.rb @@ -14,14 +14,7 @@ feature 'Level three verification' do visit account_path click_link 'Verify my account' - select 'Spanish ID', from: 'residence_document_type' - fill_in 'residence_document_number', with: "12345678Z" - select_date '31-December-1980', from: 'residence_date_of_birth' - fill_in 'residence_postal_code', with: '28013' - - click_button 'Verify' - - expect(page).to have_content 'Residence verified' + verify_residence within("#verified_user_#{verified_user.id}_phone") do click_button "Send" @@ -54,14 +47,7 @@ feature 'Level three verification' do visit account_path click_link 'Verify my account' - select 'Spanish ID', from: 'residence_document_type' - fill_in 'residence_document_number', with: "12345678Z" - select_date '31-December-1980', from: 'residence_date_of_birth' - fill_in 'residence_postal_code', with: '28013' - - click_button 'Verify' - - expect(page).to have_content 'Residence verified' + verify_residence within("#verified_user_#{verified_user.id}_email") do click_button "Send" @@ -86,14 +72,7 @@ feature 'Level three verification' do visit account_path click_link 'Verify my account' - select 'Spanish ID', from: 'residence_document_type' - fill_in 'residence_document_number', with: "12345678Z" - select_date '31-December-1980', from: 'residence_date_of_birth' - fill_in 'residence_postal_code', with: '28013' - - click_button 'Verify' - - expect(page).to have_content 'Residence verified' + verify_residence fill_in 'sms_phone', with: "611111111" click_button 'Send' diff --git a/spec/features/verification/level_two_verification_spec.rb b/spec/features/verification/level_two_verification_spec.rb index 8358d33fe..dfb1e29c2 100644 --- a/spec/features/verification/level_two_verification_spec.rb +++ b/spec/features/verification/level_two_verification_spec.rb @@ -9,14 +9,7 @@ feature 'Level two verification' do visit account_path click_link 'Verify my account' - select 'Spanish ID', from: 'residence_document_type' - fill_in 'residence_document_number', with: "12345678Z" - select_date '31-December-1980', from: 'residence_date_of_birth' - fill_in 'residence_postal_code', with: '28013' - - click_button 'Verify' - - expect(page).to have_content 'Residence verified' + verify_residence fill_in 'sms_phone', with: "611111111" click_button 'Send' diff --git a/spec/support/common_actions.rb b/spec/support/common_actions.rb index 01aa85cdd..b773ca269 100644 --- a/spec/support/common_actions.rb +++ b/spec/support/common_actions.rb @@ -97,4 +97,15 @@ module CommonActions select month, from: "#{selector}_2i" select year, from: "#{selector}_1i" end + + def verify_residence + select 'Spanish ID', from: 'residence_document_type' + fill_in 'residence_document_number', with: "12345678Z" + select_date '31-December-1980', from: 'residence_date_of_birth' + fill_in 'residence_postal_code', with: '28013' + check 'residence_terms_of_service' + + click_button 'Verify' + expect(page).to have_content 'Residence verified' + end end