Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 67 additions & 36 deletions spec/features/idv/proofing_components_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,47 +5,78 @@
include IdvHelper
include SamlAuthHelper

let(:email) { 'test@test.com' }
let(:user) { User.find_with_email(email) }

before do
allow(IdentityConfig.store).to receive(:ruby_workers_idv_enabled).
and_return(ruby_workers_idv_enabled)
allow(IdentityConfig.store).to receive(:doc_auth_enable_presigned_s3_urls).
and_return(doc_auth_enable_presigned_s3_urls)

visit_idp_from_sp_with_ial2(:oidc)
register_user(email)

expect(current_path).to eq idv_doc_auth_step_path(step: :welcome)

complete_all_doc_auth_steps
click_continue
expect(page).to have_current_path('/verify/review', wait: 5)
fill_in 'Password', with: Features::SessionHelper::VALID_PASSWORD
click_continue
click_acknowledge_personal_key
end
describe 'proofing jobs' do
let(:email) { 'test@test.com' }
let(:user) { User.find_with_email(email) }

before do
allow(IdentityConfig.store).to receive(:ruby_workers_idv_enabled).
and_return(ruby_workers_idv_enabled)
allow(IdentityConfig.store).to receive(:doc_auth_enable_presigned_s3_urls).
and_return(doc_auth_enable_presigned_s3_urls)

context 'async proofing', js: true do
let(:ruby_workers_idv_enabled) { true }
let(:doc_auth_enable_presigned_s3_urls) { true }
visit_idp_from_sp_with_ial2(:oidc)
register_user(email)

it 'records proofing components' do
proofing_components = user.active_profile.proofing_components
expect(proofing_components['document_check']).to eq('mock')
expect(proofing_components['document_type']).to eq('state_id')
expect(current_path).to eq idv_doc_auth_step_path(step: :welcome)

complete_all_doc_auth_steps
click_continue
expect(page).to have_current_path('/verify/review', wait: 5)
fill_in 'Password', with: Features::SessionHelper::VALID_PASSWORD
click_continue
click_acknowledge_personal_key
end
end

context 'sync proofing', js: true do
let(:ruby_workers_idv_enabled) { false }
let(:doc_auth_enable_presigned_s3_urls) { false }
context 'async proofing', js: true do
let(:ruby_workers_idv_enabled) { true }
let(:doc_auth_enable_presigned_s3_urls) { true }

it 'records proofing components' do
proofing_components = user.active_profile.proofing_components
expect(proofing_components['document_check']).to eq('mock')
expect(proofing_components['document_type']).to eq('state_id')
it 'records proofing components' do
proofing_components = user.active_profile.proofing_components
expect(proofing_components['document_check']).to eq('mock')
expect(proofing_components['document_type']).to eq('state_id')
end
end

context 'sync proofing', js: true do
let(:ruby_workers_idv_enabled) { false }
let(:doc_auth_enable_presigned_s3_urls) { false }

it 'records proofing components' do
proofing_components = user.active_profile.proofing_components
expect(proofing_components['document_check']).to eq('mock')
expect(proofing_components['document_type']).to eq('state_id')
end
end
end

it 'clears the liveness enabled proofing component when a user re-proofs without liveness' do
allow(IdentityConfig.store).to receive(:liveness_checking_enabled).and_return(true)
user = user_with_2fa
sign_in_and_2fa_user(user)
visit_idp_from_oidc_sp_with_ial2_strict
complete_proofing_steps

expect(user.active_profile.includes_liveness_check?).to be_truthy

visit account_path
first(:link, t('links.sign_out')).click

trigger_reset_password_and_click_email_link(user.email)
reset_password_and_sign_back_in(user, user.password)
fill_in_code_with_last_phone_otp
click_submit_default

expect(user.reload.profiles.where(active: true)).to be_empty

visit_idp_from_oidc_sp_with_ial2
click_on t('links.account.reactivate.without_key')
click_on t('forms.buttons.continue')

complete_proofing_steps

user = User.find(user.id)
expect(user.active_profile.includes_liveness_check?).to be_falsy
Comment on lines +79 to +80
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason we have to re-find it here, as opposed to reload-ing it again?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the active profile gets memoized

end
end