Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@
end

get '/verify/v2(/:step)' => 'verify#show', as: :idv_app
get '/verify/v2/password_confirm/forgot_password' => 'verify#show'
get '/verify/v2/password_confirm/forgot_password' => 'verify#show', as: :idv_app_forgot_password

namespace :api do
post '/verify/v2/password_confirm' => 'verify/password_confirm#create'
Expand Down
41 changes: 41 additions & 0 deletions spec/features/idv/steps/forgot_password_step_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,45 @@

expect(current_path).to eq edit_user_password_path
end

context 'with idv app feature enabled', js: true do
before do
allow(IdentityConfig.store).to receive(:idv_api_enabled_steps).
and_return(['password_confirm', 'personal_key', 'personal_key_confirm'])
end

it 'goes to the forgot password page from the review page' do
start_idv_from_sp
complete_idv_steps_before_review_step

click_button t('idv.forgot_password.link_text')

expect(page.current_path).to eq(idv_app_forgot_password_path)
end

it 'goes back to the review page from the forgot password page' do
start_idv_from_sp
complete_idv_steps_before_review_step

click_button t('idv.forgot_password.link_text')
click_button t('idv.forgot_password.try_again')

expect(page.current_path).to eq "#{idv_app_path(step: :password_confirm)}/"
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.

Have to add the trailing slash here, since that's how the client-side routing currently behaves (recently revised in #6374). I'm looking to change this again as part of #6387 so that we won't need to do this (strip the trailing slash).

end

it 'allows the user to reset their password' do
start_idv_from_sp
complete_idv_steps_before_review_step

click_button t('idv.forgot_password.link_text')
click_button t('idv.forgot_password.reset_password')

expect(page).to have_current_path(forgot_password_path, ignore_query: true, wait: 10)

open_last_email
click_email_link_matching(/reset_password_token/)

expect(current_path).to eq edit_user_password_path
end
end
end
34 changes: 34 additions & 0 deletions spec/features/idv/steps/review_step_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,40 @@
end
end

context 'with idv app feature enabled', js: true do
before do
allow(IdentityConfig.store).to receive(:idv_api_enabled_steps).
and_return(['password_confirm', 'personal_key', 'personal_key_confirm'])
end

it 'redirects to personal key step after user enters their password', allow_browser_log: true do
start_idv_from_sp
complete_idv_steps_before_review_step

click_on t('idv.messages.review.intro')

expect(page).to have_content('FAKEY')
expect(page).to have_content('MCFAKERSON')
expect(page).to have_content('1 FAKE RD')
expect(page).to have_content('GREAT FALLS, MT 59010')
expect(page).to have_content('October 6, 1938')
expect(page).to have_content(DocAuthHelper::GOOD_SSN)
expect(page).to have_content('(202) 555-1212')
Comment on lines +131 to +133
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.

Note that the new implementation does format some content a bit different from before, but not different enough that we should care?

expect(page).to have_content('October 06, 1938')
expect(page).to have_content(DocAuthHelper::GOOD_SSN)
expect(page).to have_content('+1 202-555-1212')


fill_in t('components.password_toggle.label'), with: 'this is not the right password'
click_idv_continue

expect(page).to have_content(t('idv.errors.incorrect_password'))
expect(page).to have_current_path(idv_app_path(step: :password_confirm))

fill_in t('components.password_toggle.label'), with: user_password
click_idv_continue

expect(page).to have_content(t('headings.personal_key'))
expect(page).to have_current_path(idv_app_path(step: :personal_key))
end
end

context 'cancelling IdV' do
it_behaves_like 'cancel at idv step', :review
it_behaves_like 'cancel at idv step', :review, :oidc
Expand Down