Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

admin verification display logic for american indian status self attestation #4815

Merged
merged 14 commits into from
Dec 17, 2024
4 changes: 3 additions & 1 deletion app/helpers/verification_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,9 @@ def ridp_admin_actions(ridp_type, person)
end

def build_admin_actions_list(v_type, f_member)
if f_member.consumer_role.aasm_state == 'unverified' || VerificationType::ADMIN_CALL_HUB_VERIFICATION_TYPES.exclude?(v_type.type_name)
if EnrollRegistry.feature_enabled?(:ai_an_self_attestation) && v_type.type_name == VerificationType::AMERICAN_INDIAN_STATUS
[::VlpDocument::VIEW_HISTORY]
elsif f_member.consumer_role.aasm_state == 'unverified' || VerificationType::ADMIN_CALL_HUB_VERIFICATION_TYPES.exclude?(v_type.type_name)
::VlpDocument::ADMIN_VERIFICATION_ACTIONS.reject{ |el| el == 'Call HUB' }
elsif verification_type_status(v_type, f_member) == 'outstanding'
::VlpDocument::ADMIN_VERIFICATION_ACTIONS.reject{|el| el == "Reject" }
Expand Down
10 changes: 8 additions & 2 deletions app/models/vlp_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class VlpDocument < Document
#list of the documents user can provide to verify Immigration status
VLP_DOCUMENT_KINDS = EnrollRegistry[:vlp_documents].setting(:vlp_document_kind_options).item

VLP_DOCUMENTS_VERIF_STATUS = ['not submitted', 'downloaded', 'verified', 'rejected']
VLP_DOCUMENTS_VERIF_STATUS = ['not submitted', 'downloaded', 'verified', 'rejected'].freeze

COUNTRIES_LIST = ["Afghanistan", "Albania", "Algeria", "Andorra", "Angola", "Antigua and Barbuda",
"Argentina", "Armenia", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh",
Expand Down Expand Up @@ -60,8 +60,14 @@ class VlpDocument < Document
"United States", "Uruguay", "Uzbekistan", "Vanuatu", "Vatican City", "Venezuela", "Viet nam",
"Yemen", "Zambia","Zimbabwe"].freeze

VERIFY = 'Verify'.freeze
REJECT = 'Reject'.freeze
VIEW_HISTORY = 'View History'.freeze
CALL_HUB = 'Call HUB'.freeze
EXTEND = 'Extend'.freeze

# admin action list for verification process, dropdown for each verification type
ADMIN_VERIFICATION_ACTIONS = ["Verify", "Reject", "View History", "Call HUB", "Extend"]
ADMIN_VERIFICATION_ACTIONS = [VERIFY, REJECT, VIEW_HISTORY, CALL_HUB, EXTEND].freeze

# reasons admin can provide when verifying type
VERIFICATION_REASONS = EnrollRegistry[:verification_reasons].item
Expand Down
47 changes: 24 additions & 23 deletions features/admin/admin_ai_an_attestation.feature
Original file line number Diff line number Diff line change
@@ -1,36 +1,37 @@
@qa-done
Feature: Admin attempts to view their American Indian or Alaska Native status

Background:
Given bs4_consumer_flow feature is enabled
Given Hbx Admin exists
And Hbx Admin logs on the Hbx portal
When Hbx Admin logs on to the Hbx Portal

Scenario: Admin creates a New User with American Indian or Alaska Native status with feature enabled
Given the ai_an_self_attestation feature is enabled
When admin creates a new user with attested American Indian or Alaska Native status
And admin navigates to the user documents page
Then admin should see an American Indian or Alaska Native status on the documents page
When admin navigates to new user who has attested to American Indian or Alaska Native tribe membership
And admin navigates to the user's documents page
Then admin should see an American Indian or Alaska Native status
And admin clicks on the Actions dropdown for the American Indian Status
Then admin should see only View History action available

Scenario: Admin changes the American Indian or Alaska Native attestation of an existing user
Given the ai_an_self_attestation feature is enabled
When admin navigates to an existing user's profile who does not have American Indian or Alaska Native status
And admin changes the American Indian or Alaska Native attestation
And admin navigates to the documents page
Then admin should see an American Indian or Alaska Native status on the documents page

Scenario: Admin adds a dependent with American Indian or Alaska Native status during the FAA process
Given the ai_an_self_attestation feature is enabled
When admin navigates to an existing user's profile
And admin starts a new financial assistance application
And admin adds a dependent with attested American Indian or Alaska Native status
And admin navigates to the documents page
Then admin should see an American Indian or Alaska Native status on the dependent's documents page
When admin navigates to existing user who has not attested to American Indian or Alaska Native tribe membership
And admin navigates to the user's families page
And admin updates the user's American Indian or Alaska Native attestation
And admin navigates to the user's documents page
Then admin should see an American Indian or Alaska Native status
And admin clicks on the Actions dropdown for the American Indian Status
Then admin should see only View History action available

Scenario: View History is the only Admin Action available for the American Indian Status
Scenario: Admin adds a dependent with American Indian or Alaska Native status during the FAA process
Given the ai_an_self_attestation feature is enabled
When admin creates a new user with attested American Indian or Alaska Native status
And admin navigates to the user documents page
When admin navigates to existing user who has attested to American Indian or Alaska Native tribe membership
And admin navigates to the user's applications page
And admin accesses the user's financial assistance application
And admin adds a dependent to the user's family
And admin updates the dependent's American Indian or Alaska Native attestation
And admin returns to the applications page
And admin navigates to the user's documents page
Then admin should see an American Indian or Alaska Native status
And admin clicks on the Actions dropdown for the American Indian Status
Then admin should see only View History action available for the American Indian Status

Then admin should see only View History action available
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,100 @@
expect(page).to have_content('Identity')
end

When(/^admin navigates to .+ user who has (.*) to American Indian or Alaska Native tribe membership$/) do |attest|
@person = FactoryBot.create(:person, :with_consumer_role, :with_active_consumer_role, first_name: "Patrick")
@family = FactoryBot.create(:family, :with_primary_family_member, person: @person)
FactoryBot.create(:user, person: @person)

case attest
when 'attested'
@person.update_attributes!(tribal_id: '123456789', tribal_name: 'Navajo', tribal_state: 'ME')
@person.verification_types.create!(type_name: 'American Indian Status', validation_status: 'verified')
when 'not attested'
@person.update_attributes!(tribal_id: nil)
else
raise 'Step only accepts "attested" or "not_attested" for attestation'
end

visit family_index_dt_exchanges_hbx_profiles_path
find('[class^="interaction-click-control-patrick-smith"]').click
end

And(/^.+ navigates to the user's (.*) page$/) do |tab|
sleep 2
case tab
when 'documents'
find('.interaction-click-control-verifications').click
when 'applications'
if ENV['CLIENT'] == 'me'
find('[class$="applications"]').click
else
find('.interaction-click-control-cost-savings').click
end
when 'families'
find('.interaction-click-control-my-household').click
else
raise 'Step only accepts navigation tab names as tab'
end
end

And(/^.+ updates the (.*)'s American Indian or Alaska Native attestation$/) do |user|
case user
when 'user'
find('.interaction-click-control-edit-member').click
find('#indian_tribe_member_yes').click
find('#tribal-id').set('123456789')
find('#save_personal').click
when 'dependent'
find('#indian_tribe_member_yes').click
find('#tribal-id').set('123456789')
find('#confirm-dependent').click
else
raise 'Step only accepts user or dependent'
end
end

And(/^.+ adds a dependent to the user's family$/) do
find('#household_info_add_member').click
find('#applicant_first_name').set('Cathy')
find('#applicant_last_name').set('Smith3')
find('#applicant_dob').set('10/10/1984')
find('#applicant_gender').set('Female')
options_gender = find('#applicant_gender').all('option')
options_gender[2].select_option
find('#dependent_ssn').set('123456543')
options_relationship = find('#applicant_relationship').all('option')
options_relationship[1].select_option
find('#us_citizen_true').click
find('#naturalized_citizen_false').click
find('#is_incarcerated_false').click
end

And(/^admin accesses the user's financial assistance application$/) do
FactoryBot.create(:financial_assistance_application, family_id: @family.id, aasm_state: 'determined')
FactoryBot.create(
:financial_assistance_applicant,
application: application,
is_primary_applicant: true,
family_member_id: @person.id,
person_hbx_id: @person.hbx_id
)
first('.interaction-click-control-actions').click
find('.interaction-click-control-copy-to-new-application').click
end

And(/^.+ clicks on the Actions dropdown for the American Indian Status$/) do
first('select[id^="v-action"][id*="American-Indian-Status"]').click
end

Then(/^.+ should see only View History action available$/) do
select_element = first('select[id^="v-action"][id*="American-Indian-Status"]')
expect(select_element).to have_selector('option', count: 2)
options = select_element.all('option')
expect(options[1].value).to eq('View History')
end

And(/^.+ returns to the applications page$/) do
sleep 2
find('.interaction-click-control-view-my-applications').click
end
30 changes: 18 additions & 12 deletions spec/helpers/verification_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@
end

describe "#build_admin_actions_list" do
shared_examples_for "admin actions dropdown list" do |type, status, state, actions|
shared_examples_for "admin actions dropdown list" do |type, status, state, actions, ai_an_self_attestation|
before do
allow(EnrollRegistry[:indian_alaskan_tribe_details].feature).to receive(:is_enabled).and_return(true)
allow(EnrollRegistry[:indian_alaskan_tribe_codes].feature).to receive(:is_enabled).and_return(true)
Expand All @@ -603,6 +603,11 @@

allow(helper).to receive(:verification_type_status).and_return status
allow(EnrollRegistry[:alive_status].feature).to receive(:is_enabled).and_return(true)
if ai_an_self_attestation
allow(EnrollRegistry[:ai_an_self_attestation].feature).to receive(:is_enabled).and_return(true)
else
allow(EnrollRegistry[:ai_an_self_attestation].feature).to receive(:is_enabled).and_return(false)
end
end
it "returns admin actions array" do
person.consumer_role.update_attributes(aasm_state: "#{state}")
Expand All @@ -611,16 +616,17 @@
end
end

it_behaves_like "admin actions dropdown list", "Citizenship", "outstanding","unverified", ["Verify","Reject", "View History", "Extend"]
it_behaves_like "admin actions dropdown list", "Citizenship", "verified","unverified", ["Verify", "Reject", "View History", "Extend"]
it_behaves_like "admin actions dropdown list", "Citizenship", "verified","verification_outstanding", ["Verify", "Reject", "View History", "Call HUB", "Extend"]
it_behaves_like "admin actions dropdown list", "Citizenship", "in review","unverified", ["Verify", "Reject", "View History", "Extend"]
it_behaves_like "admin actions dropdown list", "Citizenship", "outstanding","verification_outstanding", ["Verify", "View History", "Call HUB", "Extend"]
it_behaves_like "admin actions dropdown list", EnrollRegistry[:enroll_app].setting(:state_residency).item, "attested", "unverified",["Verify", "Reject", "View History", "Extend"]
it_behaves_like "admin actions dropdown list", EnrollRegistry[:enroll_app].setting(:state_residency).item, "outstanding", "verification_outstanding",["Verify", "View History", "Call HUB", "Extend"]
it_behaves_like "admin actions dropdown list", EnrollRegistry[:enroll_app].setting(:state_residency).item, "in review","verification_outstanding", ["Verify", "Reject", "View History", "Call HUB", "Extend"]
it_behaves_like "admin actions dropdown list", "Alive Status", "unverified", "verification_outstanding", ["Verify", "Reject", "View History", "Extend"]
it_behaves_like "admin actions dropdown list", "American Indian Status", "unverified", "verification_outstanding", ["Verify", "Reject", "View History", "Extend"]
it_behaves_like "admin actions dropdown list", "Citizenship", "outstanding","unverified", ["Verify","Reject", "View History", "Extend"], true
it_behaves_like "admin actions dropdown list", "Citizenship", "verified","unverified", ["Verify", "Reject", "View History", "Extend"], false
it_behaves_like "admin actions dropdown list", "Citizenship", "verified","verification_outstanding", ["Verify", "Reject", "View History", "Call HUB", "Extend"], false
it_behaves_like "admin actions dropdown list", "Citizenship", "in review","unverified", ["Verify", "Reject", "View History", "Extend"], true
it_behaves_like "admin actions dropdown list", "Citizenship", "outstanding","verification_outstanding", ["Verify", "View History", "Call HUB", "Extend"], false
it_behaves_like "admin actions dropdown list", EnrollRegistry[:enroll_app].setting(:state_residency).item, "attested", "unverified",["Verify", "Reject", "View History", "Extend"], true
it_behaves_like "admin actions dropdown list", EnrollRegistry[:enroll_app].setting(:state_residency).item, "outstanding", "verification_outstanding",["Verify", "View History", "Call HUB", "Extend"], true
it_behaves_like "admin actions dropdown list", EnrollRegistry[:enroll_app].setting(:state_residency).item, "in review","verification_outstanding", ["Verify", "Reject", "View History", "Call HUB", "Extend"], false
it_behaves_like "admin actions dropdown list", "Alive Status", "unverified", "verification_outstanding", ["Verify", "Reject", "View History", "Extend"], false
it_behaves_like "admin actions dropdown list", "American Indian Status", "unverified", "verification_outstanding", ["Verify", "Reject", "View History", "Extend"], false
it_behaves_like "admin actions dropdown list", "American Indian Status", "attested", "verified", ["View History"], true
end

describe "#request response details" do
Expand Down Expand Up @@ -818,7 +824,7 @@
it 'returns true' do
allow(current_user).to receive(:has_hbx_staff_role?).and_return(false)
allow(helper).to receive(:had_outstanding_status?).with(verif_type).and_return(false)
verif_type.stub(:type_name).and_return(VerificationType::AMERICAN_INDIAN_STATUS)
verif_type.stub(:type_name).and_return(VerificationType::CITIZENSHIP)
expect(helper.can_display_type?(verif_type)).to be true
end
end
Expand Down
Loading