From edb1080fdc8608aa418c348d36233ad6b5c7dfec Mon Sep 17 00:00:00 2001 From: Craig Reese Date: Tue, 9 Jul 2024 16:52:04 -0500 Subject: [PATCH 01/31] refactoring edit_spec --- spec/feature/intake/appeal/edit_spec.rb | 845 ++++++++++++------------ 1 file changed, 409 insertions(+), 436 deletions(-) diff --git a/spec/feature/intake/appeal/edit_spec.rb b/spec/feature/intake/appeal/edit_spec.rb index 19af59ccbf4..d7ce5f829b0 100644 --- a/spec/feature/intake/appeal/edit_spec.rb +++ b/spec/feature/intake/appeal/edit_spec.rb @@ -18,9 +18,7 @@ last_name: "Merica") end - let!(:current_user) do - User.authenticate!(roles: ["Mail Intake"]) - end + let!(:current_user) { User.authenticate!(roles: ["Mail Intake"]) } let!(:non_comp_org) { create(:business_line, name: "Non-Comp Org", url: "nco") } let(:last_week) { Time.zone.now - 7.days } @@ -83,74 +81,114 @@ let!(:rating_request_issue) { create(:request_issue, rating_request_issue_attributes) } - scenario "allows adding/removing issues" do - visit "appeals/#{appeal.uuid}/edit/" + let(:vet_no_history) { create(:veteran) } + let(:appeal3) do + create(:appeal, + veteran_file_number: vet_no_history.file_number, + receipt_date: receipt_date, + docket_type: Constants.AMA_DOCKETS.evidence_submission, + veteran_is_not_claimant: false, + legacy_opt_in_approved: legacy_opt_in_approved).tap(&:create_tasks_on_intake_success!) + end + + scenario "editing issues" do + step "allows adding/removing issues" do + visit "appeals/#{appeal.uuid}/edit/" - expect(page).to have_content(nonrating_request_issue.description) + expect(page).to have_content(nonrating_request_issue.description) - # remove an issue - click_remove_intake_issue_dropdown(nonrating_request_issue.description) - expect(page.has_no_content?(nonrating_request_issue.description)).to eq(true) - expect(page).to have_content("When you finish making changes, click \"Save\" to continue") + # remove an issue + click_remove_intake_issue_dropdown(nonrating_request_issue.description) + expect(page.has_no_content?(nonrating_request_issue.description)).to eq(true) + expect(page).to have_content("When you finish making changes, click \"Save\" to continue") - # add a different issue - click_intake_add_issue - add_intake_rating_issue("Left knee granted") - # save flash should still occur because issues are different - expect(page).to have_content("When you finish making changes, click \"Save\" to continue") + # add a different issue + click_intake_add_issue + add_intake_rating_issue("Left knee granted") + # save flash should still occur because issues are different + expect(page).to have_content("When you finish making changes, click \"Save\" to continue") + + # save + expect(page).to have_content("Left knee granted") + safe_click("#button-submit-update") - # save - expect(page).to have_content("Left knee granted") - safe_click("#button-submit-update") + # should redirect to queue + expect(page).to have_current_path("/queue/appeals/#{appeal.uuid}") - # should redirect to queue - expect(page).to have_current_path("/queue/appeals/#{appeal.uuid}") + # going back to edit page should show those issues + visit "appeals/#{appeal.uuid}/edit/" + expect(page).to have_content("Left knee granted") + expect(page.has_no_content?("nonrating description")).to eq(true) - # going back to edit page should show those issues - visit "appeals/#{appeal.uuid}/edit/" - expect(page).to have_content("Left knee granted") - expect(page.has_no_content?("nonrating description")).to eq(true) + # canceling should redirect to queue + click_on "Cancel" + expect(page).to have_current_path("/queue/appeals/#{appeal.uuid}") + end - # canceling should redirect to queue - click_on "Cancel" - expect(page).to have_current_path("/queue/appeals/#{appeal.uuid}") - end + step "allows removing and re-adding same issue" do + issue_description = rating_request_issue.description - scenario "allows removing and re-adding same issue" do - issue_description = rating_request_issue.description + visit "appeals/#{appeal.uuid}/edit/" - visit "appeals/#{appeal.uuid}/edit/" + expect(page).to have_content(issue_description) + expect(page).to have_button("Save", disabled: true) + # remove + click_remove_intake_issue_dropdown(issue_description) + expect(page.has_no_content?(issue_description)).to eq(true) + expect(page).to have_content("When you finish making changes, click \"Save\" to continue") - expect(page).to have_content(issue_description) - expect(page).to have_button("Save", disabled: true) - # remove - click_remove_intake_issue_dropdown(issue_description) - expect(page.has_no_content?(issue_description)).to eq(true) - expect(page).to have_content("When you finish making changes, click \"Save\" to continue") + # re-add + click_intake_add_issue + add_intake_rating_issue(issue_description, "a new comment") + expect(page).to have_content(issue_description) + expect(page).to_not have_content( + Constants.INELIGIBLE_REQUEST_ISSUES.duplicate_of_rating_issue_in_active_review.gsub("{review_title}", "Appeal") + ) + expect(page).to have_content("When you finish making changes, click \"Save\" to continue") - # re-add - click_intake_add_issue - add_intake_rating_issue(issue_description, "a new comment") - expect(page).to have_content(issue_description) - expect(page).to_not have_content( - Constants.INELIGIBLE_REQUEST_ISSUES.duplicate_of_rating_issue_in_active_review.gsub("{review_title}", "Appeal") - ) - expect(page).to have_content("When you finish making changes, click \"Save\" to continue") - - # issue note was added - expect(page).to have_button("Save", disabled: false) + # issue note was added + expect(page).to have_button("Save", disabled: false) + end + + step "allows all request issues to be removed and saved" do + visit "appeals/#{appeal.uuid}/edit/" + # remove all issues + click_remove_intake_issue_dropdown("PTSD denied") + click_remove_intake_issue_dropdown("Left knee granted") + expect(page).to have_button("Save", disabled: false) + end + + # this validates a bug fix from https://github.com/department-of-veterans-affairs/caseflow/pull/10197 + step "adding an issue with a non-comp benefit type returns to case details page" do + visit "appeals/#{appeal.uuid}/edit/" + + # Add issue that is not a VBMS issue + click_intake_add_issue + click_intake_no_matching_issues + add_intake_nonrating_issue( + benefit_type: "Education", + category: "Accrued", + description: "Description for Accrued", + date: 1.day.ago.to_date.mdY + ) + + expect(page).to_not have_content("Check the Veteran's profile for invalid information") + expect(page).to have_button("Save", disabled: false) + + click_edit_submit_and_confirm + expect(page).to have_current_path("/queue/appeals/#{appeal.uuid}") + page.find("a", text: "refresh the page").click if page.has_text?("Unable to load this case") + expect(page).not_to have_content("Loading this case") + expect(page).to have_content(veteran.name) + expect(RequestIssue.find_by( + benefit_type: "education", + decision_review: appeal + )).to_not be_nil + end end scenario "when selecting a new benefit type the issue category dropdown should return to a default state" do - new_vet = create(:veteran, first_name: "Ed", last_name: "Merica") - new_appeal = create(:appeal, - veteran_file_number: new_vet.file_number, - receipt_date: receipt_date, - docket_type: Constants.AMA_DOCKETS.evidence_submission, - veteran_is_not_claimant: false, - legacy_opt_in_approved: legacy_opt_in_approved).tap(&:create_tasks_on_intake_success!) - - visit "appeals/#{new_appeal.uuid}/edit/" + visit "appeals/#{appeal3.uuid}/edit/" click_intake_add_issue @@ -176,16 +214,6 @@ expect(page).to have_content(dropdown_select_string) end - context "with remove decision review enabled" do - scenario "allows all request issues to be removed and saved" do - visit "appeals/#{appeal.uuid}/edit/" - # remove all issues - click_remove_intake_issue_dropdown("PTSD denied") - click_remove_intake_issue_dropdown("Military Retired Pay") - expect(page).to have_button("Save", disabled: false) - end - end - context "ratings with disabiliity codes" do let(:disabiliity_receive_date) { receipt_date - 1.day } let(:disability_profile_date) { receipt_date - 10.days } @@ -387,7 +415,6 @@ def add_contested_claim_issue User.authenticate!(user: current_user) FeatureToggle.enable!(:cc_appeal_workflow) FeatureToggle.enable!(:indicator_for_contested_claims) - FeatureToggle.enable!(:indicator_for_contested_claims) ClerkOfTheBoard.singleton end @@ -490,7 +517,7 @@ def add_contested_claim_issue end end - context "A cc issue is added to a cc appeal with the initial letter task" do + context "A cc issue is added to a cc appeal" do let!(:cc_appeal) do create(:appeal, veteran_file_number: veteran.file_number, @@ -500,10 +527,10 @@ def add_contested_claim_issue legacy_opt_in_approved: legacy_opt_in_approved).tap(&:create_tasks_on_intake_success!) end - let(:initial_letter_task) do + let!(:initial_letter_task) do SendInitialNotificationLetterTask.create!( appeal: cc_appeal, - parent: appeal.tasks.find_by(type: "DistributionTask"), + parent: cc_appeal.tasks.find_by(type: "DistributionTask"), assigned_to: ClerkOfTheBoard.singleton, assigned_by: current_user ) @@ -513,335 +540,323 @@ def add_contested_claim_issue User.authenticate!(user: current_user) FeatureToggle.enable!(:cc_appeal_workflow) FeatureToggle.enable!(:indicator_for_contested_claims) - FeatureToggle.enable!(:indicator_for_contested_claims) ClerkOfTheBoard.singleton end - scenario "if the first task is open, a 2nd SendInitialNotificationLetterTask is not created" do - visit("/appeals/#{cc_appeal.uuid}/edit") - add_contested_claim_issue + scenario "when initial notification letter task already exists" do + step "if the existing task is active, a 2nd SendInitialNotificationLetterTask is not created" do + visit("/appeals/#{cc_appeal.uuid}/edit") + add_contested_claim_issue - assert page.has_content?("You have successfully added 1 issue") - expect(cc_appeal.reload.tasks.where(type: "SendInitialNotificationLetterTask").count).to eq 1 - # expect(cc_appeal.reload.tasks.find_by(type: "SendInitialNotificationLetterTask")).to be initial_letter_task - end + assert page.has_content?("You have successfully added 1 issue") + cc_appeal.reload + expect(cc_appeal.tasks.where(type: "SendInitialNotificationLetterTask").count).to eq 1 + end - scenario "if the first task is completed, a new SendInitialNotificationLetterTask is created" do - initial_letter_task.completed! + step "if the existing task is completed, a new SendInitialNotificationLetterTask is created" do + initial_letter_task.completed! - visit("/appeals/#{cc_appeal.uuid}/edit") - add_contested_claim_issue + visit("/appeals/#{cc_appeal.uuid}/edit") + add_contested_claim_issue - assert page.has_content?("You have successfully added 1 issue") - expect(cc_appeal.reload.tasks.where(type: "SendInitialNotificationLetterTask").count).to eq 2 - expect(cc_appeal.reload.tasks.where( - type: "SendInitialNotificationLetterTask" - ).where(status: "assigned").count).to eq 1 - end + assert page.has_content?("You have successfully added 1 issue") + cc_appeal.reload + expect(cc_appeal.tasks.where(type: "SendInitialNotificationLetterTask").count).to eq 2 + expect(cc_appeal.tasks.assigned.where(type: "SendInitialNotificationLetterTask").count).to eq 1 + end - scenario "if the first task is cancelled, a new SendInitialNotificationLetterTask is created" do - initial_letter_task.cancelled! + step "if the existing task is cancelled, a new SendInitialNotificationLetterTask is created" do + cc_appeal.reload.tasks.assigned.where(type: "SendInitialNotificationLetterTask").last.cancelled! - visit("/appeals/#{cc_appeal.uuid}/edit") - add_contested_claim_issue + visit("/appeals/#{cc_appeal.uuid}/edit") + add_contested_claim_issue - assert page.has_content?("You have successfully added 1 issue") - expect(cc_appeal.reload.tasks.where(type: "SendInitialNotificationLetterTask").count).to eq 2 - expect(cc_appeal.reload.tasks.where( - type: "SendInitialNotificationLetterTask" - ).where(status: "assigned").count).to eq 1 + assert page.has_content?("You have successfully added 1 issue") + cc_appeal.reload + expect(cc_appeal.tasks.where(type: "SendInitialNotificationLetterTask").count).to eq 3 + expect(cc_appeal.tasks.assigned.where(type: "SendInitialNotificationLetterTask").count).to eq 1 + end end end context "User is a member of the Supervisory Senior Council" do - let!(:organization) { SupervisorySeniorCouncil.singleton } - let!(:current_user) { create(:user, roles: ["Mail Intake"]) } - let!(:organization_user) { OrganizationsUser.make_user_admin(current_user, organization) } - scenario "less than 2 request issues on the appeal, the split appeal button doesn't show" do - User.authenticate!(user: current_user) - visit "appeals/#{appeal2.uuid}/edit/" - expect(appeal2.decision_issues.length + appeal2.request_issues.length).to be < 2 - expect(page).to_not have_button("Split appeal") - end - end - - context "The user is a member of Supervisory Senior Council and the appeal has 2 or more tasks" do - let!(:organization) { SupervisorySeniorCouncil.singleton } - let!(:current_user) { create(:user, roles: ["Mail Intake"]) } - let!(:organization_user) { OrganizationsUser.make_user_admin(current_user, organization) } - let!(:request_issue_1) do - create(:request_issue, - id: 22, - decision_review: appeal2, - decision_date: profile_date, - contested_rating_issue_reference_id: "def456", - contested_rating_issue_profile_date: profile_date, - contested_issue_description: "PTSD denied", - contention_reference_id: "3897", - benefit_type: "Education") - end - - let!(:request_issue_2) do - create(:request_issue, - id: 25, - decision_review: appeal2, - decision_date: profile_date, - contested_rating_issue_reference_id: "blah1234", - contested_rating_issue_profile_date: profile_date, - contested_issue_description: "Other Issue Description", - contention_reference_id: "78910", - benefit_type: "Education") - end - before do - # Login with the user User.authenticate!(user: current_user) FeatureToggle.enable!(:split_appeal_workflow) + OrganizationsUser.make_user_admin(current_user, SupervisorySeniorCouncil.singleton) end - after do - FeatureToggle.disable!(:split_appeal_workflow) - end - - scenario "Split appeal page behavior" do - step "SSC user navigates to the split appeal page" do - visit "appeals/#{appeal2.uuid}/edit/" + after { FeatureToggle.disable!(:split_appeal_workflow) } - expect(page).to have_button("Split appeal") - # clicking the button takes the user to the next page - click_button("Split appeal") - - expect(page).to have_current_path("/appeals/#{appeal2.uuid}/edit/create_split") - end - - step "The split appeal page contains the appropriate information" do - expect(page).to have_content("PTSD denied") - expect(page).to have_content("Other Issue Description") - - # expect the select bar, cancel button, and continue button to show - expect(page).to have_content("Select...") - expect(page).to have_content("Cancel") - - # expect the continue button to be disabled - expect(page).to have_button("Continue", disabled: true) + scenario "less than 2 request issues on the appeal, the split appeal button doesn't show" do + visit "appeals/#{appeal2.uuid}/edit/" + expect(appeal2.decision_issues.length + appeal2.request_issues.length).to be < 2 + expect(page).to_not have_button("Split appeal") + end - # The cancel button goes back to the edit page - click_button("Cancel") - expect(page).to have_current_path("/queue/appeals/#{appeal2.uuid}") + context "and the appeal has 2 or more tasks" do + let!(:request_issue_1) do + create(:request_issue, + id: 22, + decision_review: appeal2, + decision_date: profile_date, + contested_rating_issue_reference_id: "def456", + contested_rating_issue_profile_date: profile_date, + contested_issue_description: "PTSD denied", + contention_reference_id: "3897", + benefit_type: "Education") end - step "If no issues and no reason are selected on the split appeal page, the Continue button is disabled" do - visit("/appeals/#{appeal2.uuid}/edit/create_split") - - # expect issue descriptions to display - expect(page).to have_content("PTSD denied") - expect(page).to have_content("Other Issue Description") - expect(page).to have_content("Select...") - expect(page).to have_button("Continue", disabled: true) + let!(:request_issue_2) do + create(:request_issue, + id: 25, + decision_review: appeal2, + decision_date: profile_date, + contested_rating_issue_reference_id: "blah1234", + contested_rating_issue_profile_date: profile_date, + contested_issue_description: "Other Issue Description", + contention_reference_id: "78910", + benefit_type: "Education") end - step "If a reason is selected the button remains disabled" do - find(:css, ".cf-select").select_option - find(:css, ".cf-select__menu").click - expect(page).to have_button("Continue", disabled: true) - end + scenario "Split appeal page behavior" do + step "SSC user navigates to the split appeal page" do + visit "appeals/#{appeal2.uuid}/edit/" - step "If an issue is selected and then de-selected the Continue button behaves correctly" do - find("label", text: "PTSD denied").click - expect(page).to have_button("Continue", disabled: false) - find("label", text: "PTSD denied").click - expect(page).to have_button("Continue", disabled: true) - end + expect(page).to have_button("Split appeal") + # clicking the button takes the user to the next page + click_button("Split appeal") - step "If all issues are selected on the split appeal page, the Continue button is disabled" do - find("label", text: "PTSD denied").click - find("label", text: "Other Issue Description").click + expect(page).to have_current_path("/appeals/#{appeal2.uuid}/edit/create_split") + end - expect(page).to have_button("Continue", disabled: true) - end + step "The split appeal page contains the appropriate information" do + expect(page).to have_content("PTSD denied") + expect(page).to have_content("Other Issue Description") - step "The SSC user navigates to the split appeal page to review page" do - find("label", text: "PTSD denied").click - click_button("Continue") - expect(page).to have_content("Reason for new appeal stream:") - expect(page).to have_current_path("/appeals/#{appeal2.uuid}/edit/review_split") - end - end + # expect the select bar, cancel button, and continue button to show + expect(page).to have_content("Select...") + expect(page).to have_content("Cancel") - def skill_form(appeal) - visit("/appeals/#{appeal.uuid}/edit/create_split") + # expect the continue button to be disabled + expect(page).to have_button("Continue", disabled: true) - # expect issue descritions to display - expect(page).to have_content("PTSD denied") - expect(page).to have_content("Other Issue Description") - find("label", text: "PTSD denied").click - expect(page).to have_content("Select...") + # The cancel button goes back to the edit page + click_button("Cancel") + expect(page).to have_current_path("/queue/appeals/#{appeal2.uuid}") + end - find(:css, ".cf-select").select_option - find(:css, ".cf-select__menu").click + step "If no issues and no reason are selected on the split appeal page, the Continue button is disabled" do + visit("/appeals/#{appeal2.uuid}/edit/create_split") - click_button("Continue") - expect(page).to have_current_path("/appeals/#{appeal.uuid}/edit/review_split") - end + # expect issue descriptions to display + expect(page).to have_content("PTSD denied") + expect(page).to have_content("Other Issue Description") + expect(page).to have_content("Select...") + expect(page).to have_button("Continue", disabled: true) + end - def specialty_case_team_split_form(appeal) - visit("/appeals/#{appeal.uuid}/edit/create_split") + step "If a reason is selected the button remains disabled" do + find(:css, ".cf-select").select_option + find(:css, ".cf-select__menu").click + expect(page).to have_button("Continue", disabled: true) + end - # expect issue descritions to display - expect(page).to have_content("PTSD denied") - expect(page).to have_content("Other Issue Description") - expect(page).to have_content("CHAMPVA Split Issue") - find("label", text: "CHAMPVA Split Issue").click - expect(page).to have_content("Select...") + step "If an issue is selected and then de-selected the Continue button behaves correctly" do + find("label", text: "PTSD denied").click + expect(page).to have_button("Continue", disabled: false) + find("label", text: "PTSD denied").click + expect(page).to have_button("Continue", disabled: true) + end - find(:css, ".cf-select").select_option - find(:css, ".cf-select__menu").click + step "If all issues are selected on the split appeal page, the Continue button is disabled" do + find("label", text: "PTSD denied").click + find("label", text: "Other Issue Description").click - click_button("Continue") - expect(page).to have_current_path("/appeals/#{appeal.uuid}/edit/review_split") - end + expect(page).to have_button("Continue", disabled: true) + end - # scenario "When the user accesses the review_split page, the page renders as expected" do - scenario "Review split page behavior" do - step "When the user accesses the review_split page, the page renders as expected" do - skill_form(appeal2) - - expect(page).to have_table("review_table") - expect(page).to have_content("Cancel") - expect(page).to have_button("Back") - expect(page).to have_button("Split appeal") - expect(page).to have_content("Reason for new appeal stream:") - expect(appeal2.docket_type).not_to have_content("hearing") - - # Verify table information - row2_1 = page.find(:xpath, ".//table/tr[2]/td[1]/em").text - row3_1 = page.find(:xpath, ".//table/tr[3]/td[1]/em").text - expect(row2_1).to eq("Veteran") - if expect(appeal2.veteran_is_not_claimant).to be(false) - expect(row3_1).to eq("Docket Number") - else - expect(row3_1).to eq("Appellant") + step "The SSC user navigates to the split appeal page to review page" do + find("label", text: "PTSD denied").click + click_button("Continue") + expect(page).to have_content("Reason for new appeal stream:") + expect(page).to have_current_path("/appeals/#{appeal2.uuid}/edit/review_split") end end - step "the back button takes the user back" do - click_button("Back") - expect(page).to have_content("Create new appeal stream") - expect(page).to have_current_path("/appeals/#{appeal2.uuid}/edit/create_split") - end + def skill_form(appeal) + visit("/appeals/#{appeal.uuid}/edit/create_split") - step "the cancel button takes the user back to the appeal case details page" do - skill_form(appeal2) - expect(page).to have_button("Split appeal") - click_button("Cancel") - expect(page).to have_current_path("/queue/appeals/#{appeal2.uuid}") + # expect issue descritions to display + expect(page).to have_content("PTSD denied") + expect(page).to have_content("Other Issue Description") + find("label", text: "PTSD denied").click + expect(page).to have_content("Select...") + + find(:css, ".cf-select").select_option + find(:css, ".cf-select__menu").click + + click_button("Continue") + expect(page).to have_current_path("/appeals/#{appeal.uuid}/edit/review_split") end - step "the Split appeal button splits appeal and takes the user back to the original appeal case details page" do - skill_form(appeal2) + def specialty_case_team_split_form(appeal) + visit("/appeals/#{appeal.uuid}/edit/create_split") - click_button("Split appeal") - expect(page).to have_current_path("/queue/appeals/#{appeal2.uuid}", ignore_query: true) + # expect issue descritions to display + expect(page).to have_content("PTSD denied") + expect(page).to have_content("Other Issue Description") + expect(page).to have_content("CHAMPVA Split Issue") + find("label", text: "CHAMPVA Split Issue").click + expect(page).to have_content("Select...") - # Verify the success banner - expect(page).to have_content("You have successfully split #{appeal2.claimant.name}'s appeal") - expect(page).to have_content(COPY::SPLIT_APPEAL_BANNER_SUCCESS_MESSAGE) + find(:css, ".cf-select").select_option + find(:css, ".cf-select__menu").click - # Verify the spit appeal information - appeal2.reload - split_record = SplitCorrelationTable.last - new_appeal = Appeal.find(split_record.appeal_id) - expect(split_record.original_appeal_id).to eq(appeal2.id) - expect(new_appeal.request_issues.first.contested_issue_description).to eq("PTSD denied") - expect(appeal2.request_issues.active.count).to eq(1) - expect(new_appeal.docket_number).to eq(appeal2.docket_number) + click_button("Continue") + expect(page).to have_current_path("/appeals/#{appeal.uuid}/edit/review_split") end - end - context "When splitting appeals with Specialty Case Team issues" do - let!(:request_issue_3) do - create(:request_issue, - id: 28, - decision_review: appeal2, - decision_date: profile_date, - benefit_type: "vha", - nonrating_issue_category: "CHAMPVA", - nonrating_issue_description: "CHAMPVA Split Issue") - end + # scenario "When the user accesses the review_split page, the page renders as expected" do + scenario "Review split page behavior" do + step "When the user accesses the review_split page, the page renders as expected" do + skill_form(appeal2) + + expect(page).to have_table("review_table") + expect(page).to have_content("Cancel") + expect(page).to have_button("Back") + expect(page).to have_button("Split appeal") + expect(page).to have_content("Reason for new appeal stream:") + expect(appeal2.docket_type).not_to have_content("hearing") + + # Verify table information + row2_1 = page.find(:xpath, ".//table/tr[2]/td[1]/em").text + row3_1 = page.find(:xpath, ".//table/tr[3]/td[1]/em").text + expect(row2_1).to eq("Veteran") + if expect(appeal2.veteran_is_not_claimant).to be(false) + expect(row3_1).to eq("Docket Number") + else + expect(row3_1).to eq("Appellant") + end + end - context "With feature toggle enabled" do - before do - FeatureToggle.enable!(:specialty_case_team_distribution) + step "the back button takes the user back" do + click_button("Back") + expect(page).to have_content("Create new appeal stream") + expect(page).to have_current_path("/appeals/#{appeal2.uuid}/edit/create_split") end - after do - FeatureToggle.disable!(:specialty_case_team_distribution) + + step "the cancel button takes the user back to the appeal case details page" do + skill_form(appeal2) + expect(page).to have_button("Split appeal") + click_button("Cancel") + expect(page).to have_current_path("/queue/appeals/#{appeal2.uuid}") end - scenario "Split appeal with Vha issue" do - step "The split appeal should progress through to the review split page" do - specialty_case_team_split_form(appeal2) - end + step "the Split appeal button splits appeal and takes the user back to the original appeal case details page" do + skill_form(appeal2) - step "the banner should be on the page indicating that it is a specialty case team issue" do - expect(page).to have_content(COPY::SPLIT_APPEAL_SPECIALTY_CASE_TEAM_ISSUE_MESSAGE) - end + click_button("Split appeal") + expect(page).to have_current_path("/queue/appeals/#{appeal2.uuid}", ignore_query: true) - step "The appeal should be split succesfully and user should be redirected back to the case details page" do - click_button("Split appeal") - expect(page).to have_current_path("/queue/appeals/#{appeal2.uuid}", ignore_query: true) - - # Verify the success banner - expect(page).to have_content("You have successfully split #{appeal2.claimant.name}'s appeal") - expect(page).to have_content(COPY::SPLIT_APPEAL_BANNER_SUCCESS_MESSAGE) - - # Verify the spit appeal information - appeal2.reload - split_record = SplitCorrelationTable.last - new_appeal = Appeal.find(split_record.appeal_id) - expect(split_record.original_appeal_id).to eq(appeal2.id) - expect(new_appeal.request_issues.first.nonrating_issue_category).to eq("CHAMPVA") - expect(appeal2.request_issues.active.count).to eq(2) - expect(new_appeal.request_issues.active.count).to eq(1) - expect(new_appeal.docket_number).to eq(appeal2.docket_number) - - # The new appeal should have an assigned SCT task - sct_task = new_appeal.tasks.find { |task| task.type == SpecialtyCaseTeamAssignTask.name } - expect(sct_task.status).to eq(Constants.TASK_STATUSES.assigned) - end + # Verify the success banner + expect(page).to have_content("You have successfully split #{appeal2.claimant.name}'s appeal") + expect(page).to have_content(COPY::SPLIT_APPEAL_BANNER_SUCCESS_MESSAGE) + + # Verify the spit appeal information + appeal2.reload + split_record = SplitCorrelationTable.last + new_appeal = Appeal.find(split_record.appeal_id) + expect(split_record.original_appeal_id).to eq(appeal2.id) + expect(new_appeal.request_issues.first.contested_issue_description).to eq("PTSD denied") + expect(appeal2.request_issues.active.count).to eq(1) + expect(new_appeal.docket_number).to eq(appeal2.docket_number) end end - context "With sct feature toggle disabled" do - scenario "Split appeal with Vha issue" do - step "The split appeal should progress through to the review split page" do - specialty_case_team_split_form(appeal2) - end + context "When splitting appeals with Specialty Case Team issues" do + let!(:request_issue_3) do + create(:request_issue, + id: 28, + decision_review: appeal2, + decision_date: profile_date, + benefit_type: "vha", + nonrating_issue_category: "CHAMPVA", + nonrating_issue_description: "CHAMPVA Split Issue") + end - step "the sct banner should not be on the page indicating that it is a specialty case team issue" do - expect(page).to_not have_content(COPY::SPLIT_APPEAL_SPECIALTY_CASE_TEAM_ISSUE_MESSAGE) + context "With feature toggle enabled" do + before { FeatureToggle.enable!(:specialty_case_team_distribution) } + after { FeatureToggle.disable!(:specialty_case_team_distribution) } + + scenario "Split appeal with Vha issue" do + step "The split appeal should progress through to the review split page" do + specialty_case_team_split_form(appeal2) + end + + step "the banner should be on the page indicating that it is a specialty case team issue" do + expect(page).to have_content(COPY::SPLIT_APPEAL_SPECIALTY_CASE_TEAM_ISSUE_MESSAGE) + end + + step "The appeal should be split succesfully and user should be redirected back to the case details page" do + click_button("Split appeal") + expect(page).to have_current_path("/queue/appeals/#{appeal2.uuid}", ignore_query: true) + + # Verify the success banner + expect(page).to have_content("You have successfully split #{appeal2.claimant.name}'s appeal") + expect(page).to have_content(COPY::SPLIT_APPEAL_BANNER_SUCCESS_MESSAGE) + + # Verify the spit appeal information + appeal2.reload + split_record = SplitCorrelationTable.last + new_appeal = Appeal.find(split_record.appeal_id) + expect(split_record.original_appeal_id).to eq(appeal2.id) + expect(new_appeal.request_issues.first.nonrating_issue_category).to eq("CHAMPVA") + expect(appeal2.request_issues.active.count).to eq(2) + expect(new_appeal.request_issues.active.count).to eq(1) + expect(new_appeal.docket_number).to eq(appeal2.docket_number) + + # The new appeal should have an assigned SCT task + sct_task = new_appeal.tasks.find { |task| task.type == SpecialtyCaseTeamAssignTask.name } + expect(sct_task.status).to eq(Constants.TASK_STATUSES.assigned) + end end + end - step "The appeal should be split succesfully and user should be redirected back to the case details page" do - click_button("Split appeal") - expect(page).to have_current_path("/queue/appeals/#{appeal2.uuid}", ignore_query: true) - - # Verify the success banner - expect(page).to have_content("You have successfully split #{appeal2.claimant.name}'s appeal") - expect(page).to have_content(COPY::SPLIT_APPEAL_BANNER_SUCCESS_MESSAGE) - - # Verify the spit appeal information - appeal2.reload - split_record = SplitCorrelationTable.last - new_appeal = Appeal.find(split_record.appeal_id) - expect(split_record.original_appeal_id).to eq(appeal2.id) - expect(new_appeal.request_issues.first.nonrating_issue_category).to eq("CHAMPVA") - expect(appeal2.request_issues.active.count).to eq(2) - expect(new_appeal.request_issues.active.count).to eq(1) - expect(new_appeal.docket_number).to eq(appeal2.docket_number) - - # The new appeal should not have an assigned SCT task - sct_task = new_appeal.tasks.find { |task| task.type == SpecialtyCaseTeamAssignTask.name } - expect(sct_task).to eq(nil) + context "With sct feature toggle disabled" do + scenario "Split appeal with Vha issue" do + step "The split appeal should progress through to the review split page" do + specialty_case_team_split_form(appeal2) + end + + step "the sct banner should not be on the page indicating that it is a specialty case team issue" do + expect(page).to_not have_content(COPY::SPLIT_APPEAL_SPECIALTY_CASE_TEAM_ISSUE_MESSAGE) + end + + step "The appeal should be split succesfully and user should be redirected back to the case details page" do + click_button("Split appeal") + expect(page).to have_current_path("/queue/appeals/#{appeal2.uuid}", ignore_query: true) + + page.find("a", text: "refresh the page").click if page.has_text?("Unable to load this case") + + # Verify the success banner + expect(page).to have_content("You have successfully split #{appeal2.claimant.name}'s appeal") + expect(page).to have_content(COPY::SPLIT_APPEAL_BANNER_SUCCESS_MESSAGE) + + # Verify the spit appeal information + appeal2.reload + split_record = SplitCorrelationTable.last + new_appeal = Appeal.find(split_record.appeal_id) + expect(split_record.original_appeal_id).to eq(appeal2.id) + expect(new_appeal.request_issues.first.nonrating_issue_category).to eq("CHAMPVA") + expect(appeal2.request_issues.active.count).to eq(2) + expect(new_appeal.request_issues.active.count).to eq(1) + expect(new_appeal.docket_number).to eq(appeal2.docket_number) + + # The new appeal should not have an assigned SCT task + sct_task = new_appeal.tasks.find { |task| task.type == SpecialtyCaseTeamAssignTask.name } + expect(sct_task).to eq(nil) + end end end end @@ -908,8 +923,8 @@ def specialty_case_team_split_form(appeal) end end - context "when appeal Type is Veterans Health Administration By default (Predocket option)" do - scenario "appeal with benefit type VHA" do + context "when appeal Type is Veterans Health Administration" do + scenario "appeal with benefit type VHA (predocket)" do visit "appeals/#{appeal.uuid}/edit/" click_intake_add_issue click_intake_no_matching_issues @@ -926,9 +941,7 @@ def specialty_case_team_split_form(appeal) expect(find("#is-predocket-needed_false", visible: false).checked?).to eq(false) expect(page).to have_content(COPY::VHA_PRE_DOCKET_ISSUE_BANNER) end - end - context "when appeal Type is Veterans Health Administration NO Predocket" do scenario "appeal with benefit type VHA no - predocket" do visit "appeals/#{appeal.uuid}/edit/" click_intake_add_issue @@ -950,35 +963,6 @@ def specialty_case_team_split_form(appeal) end end - context "appeal is non-comp benefit type" do - let!(:request_issue) { create(:request_issue, benefit_type: "education") } - - scenario "adding an issue with a non-comp benefit type" do - visit "appeals/#{appeal.uuid}/edit/" - - # Add issue that is not a VBMS issue - click_intake_add_issue - click_intake_no_matching_issues - add_intake_nonrating_issue( - benefit_type: "Education", - category: "Accrued", - description: "Description for Accrued", - date: 1.day.ago.to_date.mdY - ) - - expect(page).to_not have_content("Check the Veteran's profile for invalid information") - expect(page).to have_button("Save", disabled: false) - - click_edit_submit_and_confirm - expect(page).to have_current_path("/queue/appeals/#{appeal.uuid}") - expect(page).to_not have_content("Unable to load this case") - expect(RequestIssue.find_by( - benefit_type: "education", - veteran_participant_id: nil - )).to_not be_nil - end - end - context "appeal is outcoded" do let(:appeal) { create(:appeal, :outcoded, veteran: veteran) } @@ -1296,19 +1280,6 @@ def specialty_case_team_split_form(appeal) ) end - let(:legacy_appeal_mst_pact_checked) do - create( - :legacy_appeal, - :with_veteran, - vacols_case: create( - :case, - case_issues: [ - create(:case_issue, issmst: "Y", isspact: "Y") - ] - ) - ) - end - before do # joins the user with the organization to grant access to role and org permissions OrganizationsUser.make_user_admin(bva_intake_admin_user, bva_intake) @@ -1338,70 +1309,72 @@ def go_to_queue_edit_issues_page_with_legacy_appeal(legacy_appeal) FeatureToggle.disable!(:legacy_mst_pact_identification) end - scenario "can add MST/PACT to issues" do - go_to_queue_edit_issues_page_with_legacy_appeal(legacy_appeal_mst_pact_unchecked) - find("select", id: "issue-action-0").click - find("option", id: "issue-action-0_edit").click - check("Military Sexual Trauma (MST)", allow_label_click: true, visible: false) - find(:xpath, "//label[@for='PACT Act']").click(allow_label_click: true, visible: false) - click_on "Save" + it "issues can be modified" do + step "can add MST/PACT to issues" do + go_to_queue_edit_issues_page_with_legacy_appeal(legacy_appeal_mst_pact_unchecked) + find("select", id: "issue-action-0").click + find("option", id: "issue-action-0_edit").click + check("Military Sexual Trauma (MST)", allow_label_click: true, visible: false) + find(:xpath, "//label[@for='PACT Act']").click(allow_label_click: true, visible: false) + click_on "Save" - click_on "Save" + click_on "Save" - expect(page).to have_content("MST and PACT") - end + expect(page).to have_content("MST and PACT") + end - scenario "can remove MST/PACT issues" do - go_to_queue_edit_issues_page_with_legacy_appeal(legacy_appeal_mst_pact_checked) - find("select", id: "issue-action-0").click - find("option", id: "issue-action-0_edit").click - uncheck("Military Sexual Trauma (MST)", allow_label_click: true, visible: false) - find(:xpath, "//label[@for='PACT Act']").click(allow_label_click: true, visible: false) - click_on "Save" + step "can remove MST/PACT issues" do + go_to_queue_edit_issues_page_with_legacy_appeal(legacy_appeal_mst_pact_unchecked) + find("select", id: "issue-action-0").click + find("option", id: "issue-action-0_edit").click + uncheck("Military Sexual Trauma (MST)", allow_label_click: true, visible: false) + find(:xpath, "//label[@for='PACT Act']").click(allow_label_click: true, visible: false) + click_on "Save" - click_on "Save" + click_on "Save" - expect(page).to have_no_content("MST and PACT") - end + expect(page).to have_no_content("MST and PACT") + end - scenario "can add and remove only PACT to an issue" do - go_to_queue_edit_issues_page_with_legacy_appeal(legacy_appeal_mst_pact_unchecked) - find("select", id: "issue-action-0").click - find("option", id: "issue-action-0_edit").click - find(:xpath, "//label[@for='PACT Act']").click(allow_label_click: true, visible: false) - click_on "Save" + step "can add and remove only PACT to an issue" do + go_to_queue_edit_issues_page_with_legacy_appeal(legacy_appeal_mst_pact_unchecked) + find("select", id: "issue-action-0").click + find("option", id: "issue-action-0_edit").click + find(:xpath, "//label[@for='PACT Act']").click(allow_label_click: true, visible: false) + click_on "Save" - click_on "Save" - expect(page).to have_content("SPECIAL ISSUES\nPACT") + click_on "Save" + expect(page).to have_content("SPECIAL ISSUES\nPACT") - click_on "Correct issues" - find("select", id: "issue-action-0").click - find("option", id: "issue-action-0_edit").click - find(:xpath, "//label[@for='PACT Act']").click(allow_label_click: true, visible: false) - click_on "Save" + click_on "Correct issues" + find("select", id: "issue-action-0").click + find("option", id: "issue-action-0_edit").click + find(:xpath, "//label[@for='PACT Act']").click(allow_label_click: true, visible: false) + click_on "Save" - click_on "Save" - expect(page).to have_no_content("SPECIAL ISSUES\nPact") - end + click_on "Save" + expect(page).to have_no_content("SPECIAL ISSUES\nPact") + end - scenario "can add and remove only MST to an issue" do - go_to_queue_edit_issues_page_with_legacy_appeal(legacy_appeal_mst_pact_unchecked) - find("select", id: "issue-action-0").click - find("option", id: "issue-action-0_edit").click - check("Military Sexual Trauma (MST)", allow_label_click: true, visible: false) - click_on "Save" + step "can add and remove only MST to an issue" do + go_to_queue_edit_issues_page_with_legacy_appeal(legacy_appeal_mst_pact_unchecked) + find("select", id: "issue-action-0").click + find("option", id: "issue-action-0_edit").click + check("Military Sexual Trauma (MST)", allow_label_click: true, visible: false) + click_on "Save" - click_on "Save" - expect(page).to have_content("SPECIAL ISSUES\nMST") + click_on "Save" + expect(page).to have_content("SPECIAL ISSUES\nMST") - click_on "Correct issues" - find("select", id: "issue-action-0").click - find("option", id: "issue-action-0_edit").click - uncheck("Military Sexual Trauma (MST)", allow_label_click: true, visible: false) - click_on "Save" + click_on "Correct issues" + find("select", id: "issue-action-0").click + find("option", id: "issue-action-0_edit").click + uncheck("Military Sexual Trauma (MST)", allow_label_click: true, visible: false) + click_on "Save" - click_on "Save" - expect(page).to have_no_content("SPECIAL ISSUES\nMST") + click_on "Save" + expect(page).to have_no_content("SPECIAL ISSUES\nMST") + end end end end From 2f824bdd50275f383c2e2257702a23e780365eb4 Mon Sep 17 00:00:00 2001 From: Craig Reese Date: Wed, 10 Jul 2024 09:28:52 -0500 Subject: [PATCH 02/31] move one assertion and remove duplicate test --- spec/feature/intake/appeal/edit_spec.rb | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/spec/feature/intake/appeal/edit_spec.rb b/spec/feature/intake/appeal/edit_spec.rb index d7ce5f829b0..a48b914d19a 100644 --- a/spec/feature/intake/appeal/edit_spec.rb +++ b/spec/feature/intake/appeal/edit_spec.rb @@ -114,6 +114,8 @@ # should redirect to queue expect(page).to have_current_path("/queue/appeals/#{appeal.uuid}") + expect(page).to have_content("added 1 issue") + expect(page).to have_content("removed 1 issue") # going back to edit page should show those issues visit "appeals/#{appeal.uuid}/edit/" @@ -976,20 +978,6 @@ def specialty_case_team_split_form(appeal) end context "when withdraw decision reviews is enabled" do - scenario "remove an issue with dropdown and show alert message" do - visit "appeals/#{appeal.uuid}/edit/" - expect(page).to have_content("PTSD denied") - click_remove_intake_issue_dropdown("PTSD denied") - - expect(page).to_not have_content("PTSD denied") - - click_edit_submit_and_confirm - - expect(page).to have_current_path("/queue/appeals/#{appeal.uuid}") - - expect(page).to have_content("You have successfully removed 1 issue.") - end - let(:withdraw_date) { 1.day.ago.to_date.mdY } let!(:in_progress_task) do From 6ab9df19049a1c199d2f38f63c47d7ba682a295b Mon Sep 17 00:00:00 2001 From: Craig Reese Date: Wed, 10 Jul 2024 10:58:15 -0500 Subject: [PATCH 03/31] refactor withdraw issues context --- spec/feature/intake/appeal/edit_spec.rb | 130 +++++++++--------------- 1 file changed, 48 insertions(+), 82 deletions(-) diff --git a/spec/feature/intake/appeal/edit_spec.rb b/spec/feature/intake/appeal/edit_spec.rb index a48b914d19a..f5e22b15495 100644 --- a/spec/feature/intake/appeal/edit_spec.rb +++ b/spec/feature/intake/appeal/edit_spec.rb @@ -988,99 +988,81 @@ def specialty_case_team_split_form(appeal) assigned_at: last_week) end - scenario "withdraw entire review and show alert" do - visit "appeals/#{appeal.uuid}/edit/" - - click_withdraw_intake_issue_dropdown("PTSD denied") - fill_in "withdraw-date", with: withdraw_date - - expect(page).to_not have_content("This review will be withdrawn.") - expect(page).to have_button("Save", disabled: false) - - click_withdraw_intake_issue_dropdown("Military Retired Pay - nonrating description") + scenario "user can withdraw single issue and edit page shows previously withdrawn issues" do + step "withdraw an issue" do + visit "appeals/#{appeal.uuid}/edit/" - expect(page).to have_content("This review will be withdrawn.") - expect(page).to have_button("Withdraw", disabled: false) + expect(page).to_not have_content("Withdrawn issues") + expect(page).to_not have_content("Please include the date the withdrawal was requested") - click_edit_submit + click_withdraw_intake_issue_dropdown("PTSD denied") - expect(page).to have_current_path("/queue/appeals/#{appeal.uuid}") + expect(page).to have_content( + /Withdrawn issues\n[1-2]..PTSD denied\nDecision date: #{request_issue_decision_mdY}\nWithdrawal pending/i + ) + expect(page).to have_content("Please include the date the withdrawal was requested") - expect(page).to have_content("You have successfully withdrawn a review.") + expect(page).to have_button("Save", disabled: true) - expect(in_progress_task.reload.status).to eq(Constants.TASK_STATUSES.cancelled) - end + fill_in "withdraw-date", with: withdraw_date - scenario "withdraw an issue" do - visit "appeals/#{appeal.uuid}/edit/" + safe_click("#button-submit-update") + expect(page).to have_current_path("/queue/appeals/#{appeal.uuid}") - expect(page).to_not have_content("Withdrawn issues") - expect(page).to_not have_content("Please include the date the withdrawal was requested") + withdrawn_issue = RequestIssue.where(closed_status: "withdrawn").first - click_withdraw_intake_issue_dropdown("PTSD denied") + expect(withdrawn_issue).to_not be_nil + expect(withdrawn_issue.closed_at).to eq(1.day.ago.to_date.to_datetime) + expect(page).to have_content("You have successfully withdrawn 1 issue.") + end - expect(page).to have_content( - /Withdrawn issues\n[1-2]..PTSD denied\nDecision date: #{request_issue_decision_mdY}\nWithdrawal pending/i - ) - expect(page).to have_content("Please include the date the withdrawal was requested") + step "show withdrawn issue when appeal edit page is reloaded" do + # reload to verify that the new issues populate the form + visit "appeals/#{appeal.uuid}/edit/" - expect(page).to have_button("Save", disabled: true) + expect(page).to have_content( + /Withdrawn issues\s*[0-9]+\. PTSD denied\s*Decision date: #{request_issue_decision_mdY}\s*Withdrawn on/i + ) + end - fill_in "withdraw-date", with: withdraw_date + step "show alert when withdrawal date is not valid" do + click_withdraw_intake_issue_dropdown("Military Retired Pay - nonrating description") + fill_in "withdraw-date", with: 50.days.ago.to_date.mdY - safe_click("#button-submit-update") - expect(page).to have_current_path("/queue/appeals/#{appeal.uuid}") + expect(page).to have_content( + "We cannot process your request. Please select a date after the Appeal's receipt date." + ) + expect(page).to have_button("Withdraw", disabled: true) - withdrawn_issue = RequestIssue.where(closed_status: "withdrawn").first + fill_in "withdraw-date", with: 2.years.from_now.to_date.mdY - expect(withdrawn_issue).to_not be_nil - expect(withdrawn_issue.closed_at).to eq(1.day.ago.to_date.to_datetime) - expect(page).to have_content("You have successfully withdrawn 1 issue.") + expect(page).to have_content("We cannot process your request. Please select a date prior to today's date.") + expect(page).to have_button("Withdraw", disabled: true) + end end - scenario "show withdrawn issue when appeal edit page is reloaded" do + scenario "withdraw entire review and show alert" do visit "appeals/#{appeal.uuid}/edit/" - click_intake_add_issue - add_intake_rating_issue("Left knee granted") + click_withdraw_intake_issue_dropdown("PTSD denied") + fill_in "withdraw-date", with: withdraw_date + expect(page).to_not have_content("This review will be withdrawn.") expect(page).to have_button("Save", disabled: false) - safe_click("#button-submit-update") - expect(page).to have_content("Number of issues has changed") - - safe_click ".confirm" - expect(page).to have_current_path("/queue/appeals/#{appeal.uuid}") - - # reload to verify that the new issues populate the form - visit "appeals/#{appeal.uuid}/edit/" - expect(page).to have_content("Left knee granted") - - click_withdraw_intake_issue_dropdown("PTSD denied") + click_withdraw_intake_issue_dropdown("Military Retired Pay - nonrating description") + fill_in "withdraw-date", with: 2.days.ago.to_date.mdY - expect(page).to_not have_content(/Requested issues\s*[0-9]+\. PTSD denied/i) - expect(page).to have_content( - /Withdrawn issues\n[1-2]..PTSD denied\nDecision date: #{request_issue_decision_mdY}\nWithdrawal pending/i - ) - expect(page).to have_content("Please include the date the withdrawal was requested") + expect(page).to have_content("This review will be withdrawn.") + expect(page).to have_button("Withdraw", disabled: false) - fill_in "withdraw-date", with: withdraw_date + click_edit_submit - safe_click("#button-submit-update") expect(page).to have_current_path("/queue/appeals/#{appeal.uuid}") - withdrawn_issue = RequestIssue.where(closed_status: "withdrawn").first - expect(withdrawn_issue).to_not be_nil - expect(withdrawn_issue.closed_at).to eq(1.day.ago.to_date.to_datetime) - - sleep 1 - - # reload to verify that the new issues populate the form - visit "appeals/#{appeal.uuid}/edit/" + expect(page).to have_content("You have successfully withdrawn a review.") - expect(page).to have_content( - /Withdrawn issues\s*[0-9]+\. PTSD denied\s*Decision date: #{request_issue_decision_mdY}\s*Withdrawn on/i - ) + expect(in_progress_task.reload.status).to eq(Constants.TASK_STATUSES.cancelled) end scenario "show alert when issue is added, removed and withdrawn" do @@ -1118,22 +1100,6 @@ def specialty_case_team_split_form(appeal) expect(page).to have_content("You have successfully added 1 issue, removed 1 issue, and withdrawn 1 issue.") end - - scenario "show alert when withdrawal date is not valid" do - visit "appeals/#{appeal.uuid}/edit/" - click_withdraw_intake_issue_dropdown("PTSD denied") - fill_in "withdraw-date", with: 50.days.ago.to_date.mdY - - expect(page).to have_content( - "We cannot process your request. Please select a date after the Appeal's receipt date." - ) - expect(page).to have_button("Save", disabled: true) - - fill_in "withdraw-date", with: 2.years.from_now.to_date.mdY - - expect(page).to have_content("We cannot process your request. Please select a date prior to today's date.") - expect(page).to have_button("Save", disabled: true) - end end context "when remove decision reviews is enabled" do From fa5b7b3ba383c2c36afc2f6206f08f6682e17eb4 Mon Sep 17 00:00:00 2001 From: Craig Reese Date: Thu, 11 Jul 2024 07:39:33 -0500 Subject: [PATCH 04/31] move duplicate test assertions --- spec/feature/intake/appeal/edit_spec.rb | 40 +++++++++---------------- 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/spec/feature/intake/appeal/edit_spec.rb b/spec/feature/intake/appeal/edit_spec.rb index f5e22b15495..4d00caaf521 100644 --- a/spec/feature/intake/appeal/edit_spec.rb +++ b/spec/feature/intake/appeal/edit_spec.rb @@ -152,14 +152,6 @@ expect(page).to have_button("Save", disabled: false) end - step "allows all request issues to be removed and saved" do - visit "appeals/#{appeal.uuid}/edit/" - # remove all issues - click_remove_intake_issue_dropdown("PTSD denied") - click_remove_intake_issue_dropdown("Left knee granted") - expect(page).to have_button("Save", disabled: false) - end - # this validates a bug fix from https://github.com/department-of-veterans-affairs/caseflow/pull/10197 step "adding an issue with a non-comp benefit type returns to case details page" do visit "appeals/#{appeal.uuid}/edit/" @@ -187,6 +179,20 @@ decision_review: appeal )).to_not be_nil end + + # originally added in https://github.com/department-of-veterans-affairs/caseflow/pull/10241 + step "allows all request issues to be removed and saved and cancels all active tasks" do + visit "appeals/#{appeal.uuid}/edit/" + # remove all issues + click_remove_intake_issue_dropdown("PTSD denied") + click_remove_intake_issue_dropdown("Left knee granted") + click_remove_intake_issue_dropdown("Accrued") + expect(page).to have_button("Save", disabled: false) + click_edit_submit_and_confirm + + expect(page).to have_current_path("/queue/appeals/#{noncomp_appeal.uuid}") + expect(appeal.tasks.filter(&:open?).any?).to eq false + end end scenario "when selecting a new benefit type the issue category dropdown should return to a default state" do @@ -1161,24 +1167,6 @@ def specialty_case_team_split_form(appeal) expect(in_progress_task.reload.status).to eq(Constants.TASK_STATUSES.cancelled) end - context "when appeal is non-comp benefit type" do - let!(:request_issue) { create(:request_issue, benefit_type: "education") } - - scenario "remove all non-comp decision reviews" do - visit "appeals/#{appeal.uuid}/edit" - - # remove all request issues - click_remove_intake_issue_dropdown("Apportionment") - click_remove_intake_issue_dropdown("Apportionment") - click_remove_intake_issue_dropdown("PTSD denied") - click_remove_intake_issue_dropdown("Military Retired Pay") - click_edit_submit_and_confirm - - expect(page).to have_current_path("/queue/appeals/#{appeal.uuid}") - expect(page).to have_content("Edit Completed") - end - end - context "when review has no active tasks" do scenario "no tasks are cancelled when all request issues are removed" do visit "appeals/#{appeal.uuid}/edit" From 1a5c83f5a6b277ff6c18a3c7b032bc03c3dad417 Mon Sep 17 00:00:00 2001 From: Craig Reese Date: Thu, 11 Jul 2024 08:46:45 -0500 Subject: [PATCH 05/31] move duplicate test assertions to existing tests and remove duplicate tests --- spec/feature/intake/appeal/edit_spec.rb | 79 ++++--------------------- 1 file changed, 11 insertions(+), 68 deletions(-) diff --git a/spec/feature/intake/appeal/edit_spec.rb b/spec/feature/intake/appeal/edit_spec.rb index 4d00caaf521..a41814da579 100644 --- a/spec/feature/intake/appeal/edit_spec.rb +++ b/spec/feature/intake/appeal/edit_spec.rb @@ -81,6 +81,7 @@ let!(:rating_request_issue) { create(:request_issue, rating_request_issue_attributes) } + # This veteran and appeal are a "blank canvas" with no request issues or pre-existing ratings/issues let(:vet_no_history) { create(:veteran) } let(:appeal3) do create(:appeal, @@ -190,8 +191,10 @@ expect(page).to have_button("Save", disabled: false) click_edit_submit_and_confirm - expect(page).to have_current_path("/queue/appeals/#{noncomp_appeal.uuid}") + expect(page).to have_current_path("/queue/appeals/#{appeal.uuid}") expect(appeal.tasks.filter(&:open?).any?).to eq false + # There are four tasks because a VeteranRecordRequest task is added with the non-comp request issue + expect(appeal.tasks.map(&:closed_at)).to match_array([Time.zone.now, Time.zone.now, Time.zone.now, Time.zone.now]) end end @@ -1110,19 +1113,15 @@ def specialty_case_team_split_form(appeal) context "when remove decision reviews is enabled" do let(:today) { Time.zone.now } - let(:appeal) do - # reload to get uuid - create(:appeal, veteran_file_number: veteran.file_number).reload - end let!(:existing_request_issues) do - [create(:request_issue, :nonrating, decision_review: appeal), - create(:request_issue, :nonrating, decision_review: appeal)] + [create(:request_issue, :nonrating, decision_review: appeal3), + create(:request_issue, :nonrating, decision_review: appeal3)] end let!(:completed_task) do create(:appeal_task, :completed, - appeal: appeal, + appeal: appeal3, assigned_to: non_comp_org, closed_at: last_week) end @@ -1130,75 +1129,19 @@ def specialty_case_team_split_form(appeal) let!(:cancelled_task) do create(:appeal_task, :cancelled, - appeal: appeal, + appeal: appeal3, assigned_to: non_comp_org, closed_at: Time.zone.now) end - context "when review has multiple active tasks" do - let!(:in_progress_task) do - create(:appeal_task, - :in_progress, - appeal: appeal, - assigned_to: non_comp_org, - assigned_at: last_week) - end + context "when review has no active tasks" do + scenario "no tasks are cancelled when all request issues are removed" do + visit "appeals/#{appeal3.uuid}/edit" - scenario "cancel all active tasks when all request issues are removed" do - visit "appeals/#{appeal.uuid}/edit" - # remove all request issues click_remove_intake_issue_dropdown("Apportionment") click_remove_intake_issue_dropdown("Apportionment") - click_remove_intake_issue_dropdown("PTSD denied") - click_remove_intake_issue_dropdown("Military Retired Pay") - click_edit_submit_and_confirm - expect(page).to have_current_path("/queue/appeals/#{appeal.uuid}") - - expect(RequestIssue.find_by( - benefit_type: "compensation", - veteran_participant_id: nil - )).to_not be_nil - - visit "appeals/#{appeal.uuid}/edit" - expect(page.has_no_content?(existing_request_issues.first.description)).to eq(true) - expect(page.has_no_content?(existing_request_issues.second.description)).to eq(true) expect(completed_task.reload.status).to eq(Constants.TASK_STATUSES.completed) - expect(in_progress_task.reload.status).to eq(Constants.TASK_STATUSES.cancelled) - end - - context "when review has no active tasks" do - scenario "no tasks are cancelled when all request issues are removed" do - visit "appeals/#{appeal.uuid}/edit" - - click_remove_intake_issue_dropdown("Apportionment") - click_remove_intake_issue_dropdown("Apportionment") - click_remove_intake_issue_dropdown("PTSD denied") - click_remove_intake_issue_dropdown("Military Retired Pay") - click_edit_submit_and_confirm - expect(completed_task.reload.status).to eq(Constants.TASK_STATUSES.completed) - end - end - - context "when appeal task is cancelled" do - scenario "show timestamp when all request issues are cancelled" do - visit "appeals/#{appeal.uuid}/edit" - # remove all request issues - - click_remove_intake_issue_dropdown("Apportionment") - click_remove_intake_issue_dropdown("Apportionment") - click_remove_intake_issue_dropdown("PTSD denied") - click_remove_intake_issue_dropdown("Military Retired Pay") - - click_edit_submit_and_confirm - expect(page).to have_current_path("/queue/appeals/#{appeal.uuid}") - - visit "appeals/#{appeal.uuid}/edit" - expect(page.has_no_content?(existing_request_issues.first.description)).to eq(true) - expect(page.has_no_content?(existing_request_issues.second.description)).to eq(true) - expect(cancelled_task.status).to eq(Constants.TASK_STATUSES.cancelled) - expect(cancelled_task.closed_at).to eq(Time.zone.now) - end end end end From 0ccf3daf41cf9f937c0e3b3b2acf24b128f270e3 Mon Sep 17 00:00:00 2001 From: Craig Reese Date: Thu, 11 Jul 2024 09:59:23 -0500 Subject: [PATCH 06/31] move assertion and remove duplicate test --- spec/feature/intake/appeal/edit_spec.rb | 44 ++++--------------------- 1 file changed, 7 insertions(+), 37 deletions(-) diff --git a/spec/feature/intake/appeal/edit_spec.rb b/spec/feature/intake/appeal/edit_spec.rb index a41814da579..c2eaecffa53 100644 --- a/spec/feature/intake/appeal/edit_spec.rb +++ b/spec/feature/intake/appeal/edit_spec.rb @@ -92,7 +92,7 @@ legacy_opt_in_approved: legacy_opt_in_approved).tap(&:create_tasks_on_intake_success!) end - scenario "editing issues" do + scenario "Add, edit, and remove request issues" do step "allows adding/removing issues" do visit "appeals/#{appeal.uuid}/edit/" @@ -184,6 +184,11 @@ # originally added in https://github.com/department-of-veterans-affairs/caseflow/pull/10241 step "allows all request issues to be removed and saved and cancels all active tasks" do visit "appeals/#{appeal.uuid}/edit/" + + # A VeteranRecordRequest task is added when the non-comp request issue is added. Complete it + # to ensure that cancelling the appeal does not update its status to 'cancelled' later on + appeal.tasks.where(type: VeteranRecordRequest.name).first.completed! + # remove all issues click_remove_intake_issue_dropdown("PTSD denied") click_remove_intake_issue_dropdown("Left knee granted") @@ -193,7 +198,7 @@ expect(page).to have_current_path("/queue/appeals/#{appeal.uuid}") expect(appeal.tasks.filter(&:open?).any?).to eq false - # There are four tasks because a VeteranRecordRequest task is added with the non-comp request issue + expect(appeal.tasks.where(type: VeteranRecordRequest.name).first.status).to eq(Constants.TASK_STATUSES.completed) expect(appeal.tasks.map(&:closed_at)).to match_array([Time.zone.now, Time.zone.now, Time.zone.now, Time.zone.now]) end end @@ -1111,41 +1116,6 @@ def specialty_case_team_split_form(appeal) end end - context "when remove decision reviews is enabled" do - let(:today) { Time.zone.now } - let!(:existing_request_issues) do - [create(:request_issue, :nonrating, decision_review: appeal3), - create(:request_issue, :nonrating, decision_review: appeal3)] - end - - let!(:completed_task) do - create(:appeal_task, - :completed, - appeal: appeal3, - assigned_to: non_comp_org, - closed_at: last_week) - end - - let!(:cancelled_task) do - create(:appeal_task, - :cancelled, - appeal: appeal3, - assigned_to: non_comp_org, - closed_at: Time.zone.now) - end - - context "when review has no active tasks" do - scenario "no tasks are cancelled when all request issues are removed" do - visit "appeals/#{appeal3.uuid}/edit" - - click_remove_intake_issue_dropdown("Apportionment") - click_remove_intake_issue_dropdown("Apportionment") - click_edit_submit_and_confirm - expect(completed_task.reload.status).to eq(Constants.TASK_STATUSES.completed) - end - end - end - context "with BVA Intake Admin user" do # creates organization let(:bva_intake) { BvaIntake.singleton } From dd124a8aec51e5deacfcb79a3c29684f700edfd7 Mon Sep 17 00:00:00 2001 From: Craig Reese Date: Thu, 11 Jul 2024 11:09:11 -0500 Subject: [PATCH 07/31] consolidate SCT appeal tests --- spec/feature/intake/appeal/edit_spec.rb | 61 ++++++------------------- 1 file changed, 13 insertions(+), 48 deletions(-) diff --git a/spec/feature/intake/appeal/edit_spec.rb b/spec/feature/intake/appeal/edit_spec.rb index c2eaecffa53..8a7bdd28b1e 100644 --- a/spec/feature/intake/appeal/edit_spec.rb +++ b/spec/feature/intake/appeal/edit_spec.rb @@ -1260,7 +1260,8 @@ def go_to_queue_edit_issues_page_with_legacy_appeal(legacy_appeal) end after { FeatureToggle.disable!(:specialty_case_team_distribution) } - scenario "appeal moves to sct queue when vha issue is added" do + scenario "appeal moves to sct queue when vha issue is added and moves back to distribution when removed" do + # add issue reload_case_detail_page(appeal3.uuid) click_on "Correct issues" click_remove_intake_issue_dropdown("Unknown Issue Category") @@ -1271,11 +1272,10 @@ def go_to_queue_edit_issues_page_with_legacy_appeal(legacy_appeal) find("#issue-category").send_keys :enter fill_in "Issue description", with: "I am a VHA issue" fill_in "Decision date", with: 5.months.ago.mdY - radio_choices = page.all(".cf-form-radio-option > label") radio_choices[1].click - safe_click ".add-issue" + click_edit_submit expect(page).to have_content("Move appeal to SCT queue") expect(page).to have_button("Move") @@ -1285,55 +1285,20 @@ def go_to_queue_edit_issues_page_with_legacy_appeal(legacy_appeal) "The appeal for #{appeal3.claimant.name} " \ "(ID: #{appeal3.veteran.file_number}) has been moved to the SCT queue." ) - end - end - - context "Removing all Specialty Case Team issues from an appeal" do - let!(:appeal3) do - create(:appeal, - :assigned_to_judge, - :completed_distribution_task, - veteran_file_number: create(:veteran).file_number, - receipt_date: receipt_date, - docket_type: Constants.AMA_DOCKETS.direct_review) - end - let!(:request_issue) do - create(:request_issue, - benefit_type: "compensation", - nonrating_issue_category: "Unknown Issue Category", - nonrating_issue_description: "Compensation issue", - decision_date: 5.months.ago, - decision_review: appeal3) - end - let!(:sct_request_issue) do - create(:request_issue, - benefit_type: "vha", - nonrating_issue_category: "CHAMPVA", - nonrating_issue_description: "VHA issue", - decision_date: 5.months.ago, - decision_review: appeal3) - end - - before do - SpecialtyCaseTeam.singleton.add_user(current_user) - BvaIntake.singleton.add_user(current_user) - User.authenticate!(user: current_user) - FeatureToggle.enable!(:specialty_case_team_distribution) - # Add a Specialty Case Team Assign Task to the appeal - SpecialtyCaseTeamAssignTask.create!(appeal: appeal3, - parent: appeal3.root_task, - assigned_to: SpecialtyCaseTeam.singleton) - end - - after { FeatureToggle.disable!(:specialty_case_team_distribution) } - - scenario "appeal moves back to distribution when all SCT issues are removed" do + # remove issue reload_case_detail_page(appeal3.uuid) click_on "Correct issues" - click_remove_intake_issue_dropdown("CHAMPVA") - click_edit_submit_and_confirm + click_remove_intake_issue_dropdown("Beneficiary Travel") + click_intake_add_issue + add_intake_nonrating_issue( + benefit_type: "compensation", + category: "Unknown Issue Category", + description: "non vha issue", + date: 1.day.ago.to_date.mdY + ) + click_edit_submit expect(page).to have_content(COPY::MOVE_TO_DISTRIBUTION_MODAL_TITLE) expect(page).to have_content(COPY::MOVE_TO_DISTRIBUTION_MODAL_BODY) expect(page).to have_button("Move") From 411860ee645dd776a22f44edb404d3cffa0905cf Mon Sep 17 00:00:00 2001 From: Craig Reese Date: Thu, 11 Jul 2024 11:13:54 -0500 Subject: [PATCH 08/31] refactor SCT tests to use step blocks --- spec/feature/intake/appeal/edit_spec.rb | 118 ++++++++++++------------ 1 file changed, 60 insertions(+), 58 deletions(-) diff --git a/spec/feature/intake/appeal/edit_spec.rb b/spec/feature/intake/appeal/edit_spec.rb index 8a7bdd28b1e..9d8e1076939 100644 --- a/spec/feature/intake/appeal/edit_spec.rb +++ b/spec/feature/intake/appeal/edit_spec.rb @@ -1261,66 +1261,68 @@ def go_to_queue_edit_issues_page_with_legacy_appeal(legacy_appeal) after { FeatureToggle.disable!(:specialty_case_team_distribution) } scenario "appeal moves to sct queue when vha issue is added and moves back to distribution when removed" do - # add issue - reload_case_detail_page(appeal3.uuid) - click_on "Correct issues" - click_remove_intake_issue_dropdown("Unknown Issue Category") - click_intake_add_issue - fill_in "Benefit type", with: "Veterans Health Administration" - find("#issue-benefit-type").send_keys :enter - fill_in "Issue category", with: "Beneficiary Travel" - find("#issue-category").send_keys :enter - fill_in "Issue description", with: "I am a VHA issue" - fill_in "Decision date", with: 5.months.ago.mdY - radio_choices = page.all(".cf-form-radio-option > label") - radio_choices[1].click - safe_click ".add-issue" - - click_edit_submit - expect(page).to have_content("Move appeal to SCT queue") - expect(page).to have_button("Move") - safe_click ".confirm" - expect(page).to have_content("You have successfully updated issues on this appeal") - expect(page).to have_content( - "The appeal for #{appeal3.claimant.name} " \ - "(ID: #{appeal3.veteran.file_number}) has been moved to the SCT queue." - ) + step "add VHA issue and remove non-VHA issue" do + reload_case_detail_page(appeal3.uuid) + click_on "Correct issues" + click_remove_intake_issue_dropdown("Unknown Issue Category") + click_intake_add_issue + fill_in "Benefit type", with: "Veterans Health Administration" + find("#issue-benefit-type").send_keys :enter + fill_in "Issue category", with: "Beneficiary Travel" + find("#issue-category").send_keys :enter + fill_in "Issue description", with: "I am a VHA issue" + fill_in "Decision date", with: 5.months.ago.mdY + radio_choices = page.all(".cf-form-radio-option > label") + radio_choices[1].click + safe_click ".add-issue" + + click_edit_submit + expect(page).to have_content("Move appeal to SCT queue") + expect(page).to have_button("Move") + safe_click ".confirm" + expect(page).to have_content("You have successfully updated issues on this appeal") + expect(page).to have_content( + "The appeal for #{appeal3.claimant.name} " \ + "(ID: #{appeal3.veteran.file_number}) has been moved to the SCT queue." + ) + end - # remove issue - reload_case_detail_page(appeal3.uuid) - click_on "Correct issues" - click_remove_intake_issue_dropdown("Beneficiary Travel") - click_intake_add_issue - add_intake_nonrating_issue( - benefit_type: "compensation", - category: "Unknown Issue Category", - description: "non vha issue", - date: 1.day.ago.to_date.mdY - ) + step "remove VHA issue and add non-VHA issue" do + reload_case_detail_page(appeal3.uuid) + click_on "Correct issues" + click_remove_intake_issue_dropdown("Beneficiary Travel") + click_intake_add_issue + add_intake_nonrating_issue( + benefit_type: "compensation", + category: "Unknown Issue Category", + description: "non vha issue", + date: 1.day.ago.to_date.mdY + ) - click_edit_submit - expect(page).to have_content(COPY::MOVE_TO_DISTRIBUTION_MODAL_TITLE) - expect(page).to have_content(COPY::MOVE_TO_DISTRIBUTION_MODAL_BODY) - expect(page).to have_button("Move") - safe_click ".confirm" - expect(page).to have_content("You have successfully updated issues on this appeal") - expect(page).to have_content( - "The appeal for #{appeal3.claimant.name} " \ - "(ID: #{appeal3.veteran.file_number}) has been moved to the regular distribution pool." - ) - expect(page).to have_current_path("/queue/appeals/#{appeal3.uuid}") - - # Verify task tree status - appeal3.reload - appeal3.tasks.reload - appeal3.request_issues.reload - distribution_task = appeal3.tasks.find { |task| task.is_a?(DistributionTask) } - expect(distribution_task.assigned_by).to eq(current_user) - expect(distribution_task.status).to eq("assigned") - expect(appeal3.ready_for_distribution?).to eq(true) - expect(appeal3.can_redistribute_appeal?).to eq(true) - expect(appeal3.request_issues.active.count).to eq(1) - expect(appeal3.tasks.find { |task| task.is_a?(SpecialtyCaseTeamAssignTask) }.status).to eq("cancelled") + click_edit_submit + expect(page).to have_content(COPY::MOVE_TO_DISTRIBUTION_MODAL_TITLE) + expect(page).to have_content(COPY::MOVE_TO_DISTRIBUTION_MODAL_BODY) + expect(page).to have_button("Move") + safe_click ".confirm" + expect(page).to have_content("You have successfully updated issues on this appeal") + expect(page).to have_content( + "The appeal for #{appeal3.claimant.name} " \ + "(ID: #{appeal3.veteran.file_number}) has been moved to the regular distribution pool." + ) + expect(page).to have_current_path("/queue/appeals/#{appeal3.uuid}") + + # Verify task tree status + appeal3.reload + appeal3.tasks.reload + appeal3.request_issues.reload + distribution_task = appeal3.tasks.find { |task| task.is_a?(DistributionTask) } + expect(distribution_task.assigned_by).to eq(current_user) + expect(distribution_task.status).to eq("assigned") + expect(appeal3.ready_for_distribution?).to eq(true) + expect(appeal3.can_redistribute_appeal?).to eq(true) + expect(appeal3.request_issues.active.count).to eq(1) + expect(appeal3.tasks.find { |task| task.is_a?(SpecialtyCaseTeamAssignTask) }.status).to eq("cancelled") + end end end end From 4a523f1bb85f24a10183280348aebd6beedbf6f6 Mon Sep 17 00:00:00 2001 From: Craig Reese Date: Thu, 11 Jul 2024 11:33:26 -0500 Subject: [PATCH 09/31] consolidate a individual test into a step --- spec/feature/intake/appeal/edit_spec.rb | 54 ++++++++++++------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/spec/feature/intake/appeal/edit_spec.rb b/spec/feature/intake/appeal/edit_spec.rb index 9d8e1076939..a49596c94e3 100644 --- a/spec/feature/intake/appeal/edit_spec.rb +++ b/spec/feature/intake/appeal/edit_spec.rb @@ -153,6 +153,33 @@ expect(page).to have_button("Save", disabled: false) end + step "when selecting a new benefit type the issue category dropdown should return to a default state" do + visit "appeals/#{appeal3.uuid}/edit/" + + click_intake_add_issue + + dropdown_select_string = "Select or enter..." + benefit_text = "Compensation" + + # Select the first benefit type + all(".cf-select__control", text: dropdown_select_string).first.click + find("div", class: "cf-select__option", text: benefit_text).click + + # Select the first issue category + find(".cf-select__control", text: dropdown_select_string).click + find("div", class: "cf-select__option", text: "Unknown Issue Category").click + + # Verify that the default dropdown text is missing from the page + expect(page).to_not have_content(dropdown_select_string) + + # Select a different benefit type + find(".cf-select__control", text: benefit_text).click + find("div", class: "cf-select__option", text: "Education").click + + # Verify that the default dropdown text once again present on the page + expect(page).to have_content(dropdown_select_string) + end + # this validates a bug fix from https://github.com/department-of-veterans-affairs/caseflow/pull/10197 step "adding an issue with a non-comp benefit type returns to case details page" do visit "appeals/#{appeal.uuid}/edit/" @@ -203,33 +230,6 @@ end end - scenario "when selecting a new benefit type the issue category dropdown should return to a default state" do - visit "appeals/#{appeal3.uuid}/edit/" - - click_intake_add_issue - - dropdown_select_string = "Select or enter..." - benefit_text = "Compensation" - - # Select the first benefit type - all(".cf-select__control", text: dropdown_select_string).first.click - find("div", class: "cf-select__option", text: benefit_text).click - - # Select the first issue category - find(".cf-select__control", text: dropdown_select_string).click - find("div", class: "cf-select__option", text: "Unknown Issue Category").click - - # Verify that the default dropdown text is missing from the page - expect(page).to_not have_content(dropdown_select_string) - - # Select a different benefit type - find(".cf-select__control", text: benefit_text).click - find("div", class: "cf-select__option", text: "Education").click - - # Verify that the default dropdown text once again present on the page - expect(page).to have_content(dropdown_select_string) - end - context "ratings with disabiliity codes" do let(:disabiliity_receive_date) { receipt_date - 1.day } let(:disability_profile_date) { receipt_date - 10.days } From 8131dd67469ab894cb480e9a8860e1d15f8bfba6 Mon Sep 17 00:00:00 2001 From: Craig Reese Date: Fri, 12 Jul 2024 12:07:05 -0500 Subject: [PATCH 10/31] move CC appeal task tests to appeals_controller_spec intead of a feature test --- spec/controllers/appeals_controller_spec.rb | 159 ++++++++++++++- spec/feature/intake/appeal/edit_spec.rb | 204 -------------------- 2 files changed, 158 insertions(+), 205 deletions(-) diff --git a/spec/controllers/appeals_controller_spec.rb b/spec/controllers/appeals_controller_spec.rb index 83e6de31ff1..d20df11f1ad 100644 --- a/spec/controllers/appeals_controller_spec.rb +++ b/spec/controllers/appeals_controller_spec.rb @@ -1001,7 +1001,7 @@ def allow_vbms_to_return_empty_array end describe "POST update" do - context "AMA Appeal" do + context "AMA Appeal updates for MST/PACT issues" do before do User.authenticate!(roles: ["System Admin"]) Fakes::Initializer.load! @@ -1059,5 +1059,162 @@ def allow_vbms_to_return_empty_array expect(response).to be_successful end end + + context "when adding a contested claim issue" do + let!(:current_user) { User.authenticate!(roles: ["Mail Intake"]) } + let!(:appeal) do + create(:appeal, :with_post_intake_tasks, docket_type: docket) + end + let(:docket) { nil } + + before do + User.authenticate!(user: current_user) + # Fakes::Initializer.load! + end + + subject do + post :update, params: { + request_issues: [ + { + benefit_type: "compensation", + nonrating_issue_category: "Contested Claims - Attorney Fees", + decision_text: "Test Issue", + decision_date: 1.week.ago.to_date, + ineligible_due_to_id: nil, + ineligible_reason: nil, + withdrawal_date: nil, + is_predocket_needed: nil, + mst_status: false, + pact_status: false + } + ], + controller: "appeals", + action: "update", + appeal_id: appeal.uuid + } + end + + context "with the feature toggle off" do + let(:docket) { Constants.AMA_DOCKETS.direct_review } + + it "does not create a SendInitialNotificationLetterTask" do + expect_any_instance_of(AppealsController).to_not receive(:send_initial_notification_letter) + + subject + task = Task.find_by(type: SendInitialNotificationLetterTask.name, appeal: appeal) + + expect(task).to be nil + end + end + + context "with the feature toggle on" do + before do + # User.authenticate!(roles: ["Mail Intake"]) + FeatureToggle.enable!(:cc_appeal_workflow) + FeatureToggle.enable!(:indicator_for_contested_claims) + ClerkOfTheBoard.singleton + end + + after do + FeatureToggle.disable!(:cc_appeal_workflow) + FeatureToggle.disable!(:indicator_for_contested_claims) + end + + context "to a direct review docket appeal" do + let(:docket) { Constants.AMA_DOCKETS.direct_review } + + it "creates SendInitialNotificationLetterTask as child of DistributionTask" do + subject + task = Task.find_by(type: SendInitialNotificationLetterTask.name, appeal: appeal) + + expect(response).to be_successful + expect(task.present?).to be true + expect(task.parent.type).to eq DistributionTask.name + expect(task.assigned_to).to eq ClerkOfTheBoard.singleton + expect(task.assigned_by).to eq current_user + end + end + + context "to an evidence submission docket appeal" do + let(:docket) { Constants.AMA_DOCKETS.evidence_submission } + + it "creates SendInitialNotificationLetterTask as child of EvidenceSubmissionWindowTask" do + subject + task = Task.find_by(type: SendInitialNotificationLetterTask.name, appeal: appeal) + + expect(response).to be_successful + expect(task.present?).to be true + expect(task.parent.type).to eq EvidenceSubmissionWindowTask.name + expect(task.assigned_to).to eq ClerkOfTheBoard.singleton + expect(task.assigned_by).to eq current_user + end + end + + context "to a hearing docket appeal" do + let(:docket) { Constants.AMA_DOCKETS.hearing } + + it "creates SendInitialNotificationLetterTask as child of ScheduleHearingTask" do + subject + task = Task.find_by(type: SendInitialNotificationLetterTask.name, appeal: appeal) + + expect(response).to be_successful + expect(task.present?).to be true + expect(task.parent.type).to eq ScheduleHearingTask.name + expect(task.assigned_to).to eq ClerkOfTheBoard.singleton + expect(task.assigned_by).to eq current_user + end + end + + context "when an appeal already has a SendInitialNotificationLetterTask" do + let(:docket) { Constants.AMA_DOCKETS.direct_review } + let!(:inital_letter_task) do + build(:task, + type: SendInitialNotificationLetterTask.name, + assigned_to: ClerkOfTheBoard.singleton, + assigned_by: current_user, + assigned_at: Time.zone.now, + appeal: appeal, + parent: appeal.tasks.where(type: DistributionTask.name).first, + status: task_status, + updated_at: Time.zone.now).tap { |t| t.save(validate: false) } + end + + context "which is active" do + let(:task_status) { Constants.TASK_STATUSES.assigned } + + it "does not create a new SendInitialNotificationLetterTask" do + subject + + expect(response).to be_successful + expect(Task.where(appeal: appeal, type: SendInitialNotificationLetterTask.name).count).to eq 1 + end + end + + context "which is completed" do + let(:task_status) { Constants.TASK_STATUSES.completed } + + it "creates a new SendInitialNotificationLetterTask" do + subject + + expect(response).to be_successful + expect(Task.where(appeal: appeal, type: SendInitialNotificationLetterTask.name).count).to eq 2 + expect(Task.active.where(appeal: appeal, type: SendInitialNotificationLetterTask.name).count).to eq 1 + end + end + + context "which is cancelled" do + let(:task_status) { Constants.TASK_STATUSES.cancelled } + + it "creates a new SendInitialNotificationLetterTask" do + subject + + expect(response).to be_successful + expect(Task.where(appeal: appeal, type: SendInitialNotificationLetterTask.name).count).to eq 2 + expect(Task.active.where(appeal: appeal, type: SendInitialNotificationLetterTask.name).count).to eq 1 + end + end + end + end + end end end diff --git a/spec/feature/intake/appeal/edit_spec.rb b/spec/feature/intake/appeal/edit_spec.rb index a49596c94e3..7d8fbef1f70 100644 --- a/spec/feature/intake/appeal/edit_spec.rb +++ b/spec/feature/intake/appeal/edit_spec.rb @@ -391,210 +391,6 @@ end end - def add_contested_claim_issue - click_intake_add_issue - click_intake_no_matching_issues - - # add the cc issue - dropdown_select_string = "Select or enter..." - benefit_text = "Insurance" - - # Select the benefit type - all(".cf-select__control", text: dropdown_select_string).first.click - find("div", class: "cf-select__option", text: benefit_text).click - - # Select the issue category - find(".cf-select__control", text: dropdown_select_string).click - find("div", class: "cf-select__option", text: "Contested Death Claim | Intent of Insured").click - - # fill in date and issue description - fill_in "Decision date", with: 1.day.ago.to_date.mdY.to_s - fill_in "Issue description", with: "CC Instructions" - - # click buttons - click_on "Add this issue" - click_on "Save" - click_on "Yes, save" - end - - context "A contested claim is added to an evidence submission appeal" do - let!(:cc_appeal) do - create(:appeal, - veteran_file_number: veteran.file_number, - receipt_date: receipt_date, - docket_type: Constants.AMA_DOCKETS.evidence_submission, - veteran_is_not_claimant: false, - legacy_opt_in_approved: legacy_opt_in_approved).tap(&:create_tasks_on_intake_success!) - end - - before do - User.authenticate!(user: current_user) - FeatureToggle.enable!(:cc_appeal_workflow) - FeatureToggle.enable!(:indicator_for_contested_claims) - ClerkOfTheBoard.singleton - end - - scenario "the cc_appeal_workflow feature toggle is not enabled" do - FeatureToggle.disable!(:cc_appeal_workflow) - visit("/appeals/#{cc_appeal.uuid}/edit") - add_contested_claim_issue - - assert page.has_content?("You have successfully added 1 issue") - expect(cc_appeal.reload.tasks.find_by(type: "SendInitialNotificationLetterTask").nil?).to be true - end - - scenario "a cc issue is assigned to an evidence submission appeal" do - visit("/appeals/#{cc_appeal.uuid}/edit") - add_contested_claim_issue - - assert page.has_content?("You have successfully added 1 issue") - expect(cc_appeal.reload.tasks.find_by(type: "SendInitialNotificationLetterTask").nil?).to be false - expect( - cc_appeal.reload.tasks.find_by(type: "SendInitialNotificationLetterTask").parent - ).to eql(cc_appeal.tasks.find_by(type: "EvidenceSubmissionWindowTask")) - expect( - cc_appeal.reload.tasks.find_by(type: "SendInitialNotificationLetterTask").assigned_to - ).to eql(ClerkOfTheBoard.singleton) - expect( - cc_appeal.reload.tasks.find_by(type: "SendInitialNotificationLetterTask").assigned_by - ).to eql(current_user) - end - end - - context "A contested claim is added to an hearing appeal" do - let!(:cc_appeal) do - create(:appeal, - veteran_file_number: veteran.file_number, - receipt_date: receipt_date, - docket_type: Constants.AMA_DOCKETS.hearing, - veteran_is_not_claimant: false, - legacy_opt_in_approved: legacy_opt_in_approved).tap(&:create_tasks_on_intake_success!) - end - - before do - User.authenticate!(user: current_user) - FeatureToggle.enable!(:cc_appeal_workflow) - FeatureToggle.enable!(:indicator_for_contested_claims) - FeatureToggle.enable!(:indicator_for_contested_claims) - ClerkOfTheBoard.singleton - end - - scenario "a cc issue is assigned to a hearing appeal" do - visit("/appeals/#{cc_appeal.uuid}/edit") - add_contested_claim_issue - - assert page.has_content?("You have successfully added 1 issue") - expect(cc_appeal.reload.tasks.find_by(type: "SendInitialNotificationLetterTask").nil?).to be false - expect( - cc_appeal.reload.tasks.find_by(type: "SendInitialNotificationLetterTask").parent - ).to eql(cc_appeal.tasks.find_by(type: "ScheduleHearingTask")) - expect( - cc_appeal.reload.tasks.find_by(type: "SendInitialNotificationLetterTask").assigned_to - ).to eql(ClerkOfTheBoard.singleton) - expect( - cc_appeal.reload.tasks.find_by(type: "SendInitialNotificationLetterTask").assigned_by - ).to eql(current_user) - end - end - - context "A contested claim is added to a direct review appeal" do - let!(:cc_appeal) do - create(:appeal, - veteran_file_number: veteran.file_number, - receipt_date: receipt_date, - docket_type: Constants.AMA_DOCKETS.direct_review, - veteran_is_not_claimant: false, - legacy_opt_in_approved: legacy_opt_in_approved).tap(&:create_tasks_on_intake_success!) - end - - before do - User.authenticate!(user: current_user) - FeatureToggle.enable!(:cc_appeal_workflow) - FeatureToggle.enable!(:indicator_for_contested_claims) - FeatureToggle.enable!(:indicator_for_contested_claims) - ClerkOfTheBoard.singleton - end - - scenario "a cc issue is assigned to a direct review appeal" do - visit("/appeals/#{cc_appeal.uuid}/edit") - add_contested_claim_issue - - assert page.has_content?("You have successfully added 1 issue") - expect(cc_appeal.reload.tasks.find_by(type: "SendInitialNotificationLetterTask").nil?).to be false - expect( - cc_appeal.reload.tasks.find_by(type: "SendInitialNotificationLetterTask").parent - ).to eql(cc_appeal.tasks.find_by(type: "DistributionTask")) - expect( - cc_appeal.reload.tasks.find_by(type: "SendInitialNotificationLetterTask").assigned_to - ).to eql(ClerkOfTheBoard.singleton) - expect( - cc_appeal.reload.tasks.find_by(type: "SendInitialNotificationLetterTask").assigned_by - ).to eql(current_user) - end - end - - context "A cc issue is added to a cc appeal" do - let!(:cc_appeal) do - create(:appeal, - veteran_file_number: veteran.file_number, - receipt_date: receipt_date, - docket_type: Constants.AMA_DOCKETS.direct_review, - veteran_is_not_claimant: false, - legacy_opt_in_approved: legacy_opt_in_approved).tap(&:create_tasks_on_intake_success!) - end - - let!(:initial_letter_task) do - SendInitialNotificationLetterTask.create!( - appeal: cc_appeal, - parent: cc_appeal.tasks.find_by(type: "DistributionTask"), - assigned_to: ClerkOfTheBoard.singleton, - assigned_by: current_user - ) - end - - before do - User.authenticate!(user: current_user) - FeatureToggle.enable!(:cc_appeal_workflow) - FeatureToggle.enable!(:indicator_for_contested_claims) - ClerkOfTheBoard.singleton - end - - scenario "when initial notification letter task already exists" do - step "if the existing task is active, a 2nd SendInitialNotificationLetterTask is not created" do - visit("/appeals/#{cc_appeal.uuid}/edit") - add_contested_claim_issue - - assert page.has_content?("You have successfully added 1 issue") - cc_appeal.reload - expect(cc_appeal.tasks.where(type: "SendInitialNotificationLetterTask").count).to eq 1 - end - - step "if the existing task is completed, a new SendInitialNotificationLetterTask is created" do - initial_letter_task.completed! - - visit("/appeals/#{cc_appeal.uuid}/edit") - add_contested_claim_issue - - assert page.has_content?("You have successfully added 1 issue") - cc_appeal.reload - expect(cc_appeal.tasks.where(type: "SendInitialNotificationLetterTask").count).to eq 2 - expect(cc_appeal.tasks.assigned.where(type: "SendInitialNotificationLetterTask").count).to eq 1 - end - - step "if the existing task is cancelled, a new SendInitialNotificationLetterTask is created" do - cc_appeal.reload.tasks.assigned.where(type: "SendInitialNotificationLetterTask").last.cancelled! - - visit("/appeals/#{cc_appeal.uuid}/edit") - add_contested_claim_issue - - assert page.has_content?("You have successfully added 1 issue") - cc_appeal.reload - expect(cc_appeal.tasks.where(type: "SendInitialNotificationLetterTask").count).to eq 3 - expect(cc_appeal.tasks.assigned.where(type: "SendInitialNotificationLetterTask").count).to eq 1 - end - end - end - context "User is a member of the Supervisory Senior Council" do before do User.authenticate!(user: current_user) From 2f243dd76fb37efe894547e5d190f95c5e5e1f87 Mon Sep 17 00:00:00 2001 From: Craig Reese Date: Fri, 12 Jul 2024 13:00:08 -0500 Subject: [PATCH 11/31] remove unnecessary code comments --- spec/controllers/appeals_controller_spec.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/spec/controllers/appeals_controller_spec.rb b/spec/controllers/appeals_controller_spec.rb index d20df11f1ad..ee93885402c 100644 --- a/spec/controllers/appeals_controller_spec.rb +++ b/spec/controllers/appeals_controller_spec.rb @@ -1060,7 +1060,7 @@ def allow_vbms_to_return_empty_array end end - context "when adding a contested claim issue" do + context "Adding a contested claim issue" do let!(:current_user) { User.authenticate!(roles: ["Mail Intake"]) } let!(:appeal) do create(:appeal, :with_post_intake_tasks, docket_type: docket) @@ -1069,7 +1069,6 @@ def allow_vbms_to_return_empty_array before do User.authenticate!(user: current_user) - # Fakes::Initializer.load! end subject do @@ -1109,7 +1108,6 @@ def allow_vbms_to_return_empty_array context "with the feature toggle on" do before do - # User.authenticate!(roles: ["Mail Intake"]) FeatureToggle.enable!(:cc_appeal_workflow) FeatureToggle.enable!(:indicator_for_contested_claims) ClerkOfTheBoard.singleton From 05f1f275682ccfe9d97dd30f72b63c2bd3e8e743 Mon Sep 17 00:00:00 2001 From: Craig Reese Date: Mon, 15 Jul 2024 11:55:14 -0500 Subject: [PATCH 12/31] consolidate member not admin tests --- .../audit_lever_history_table_spec.rb | 71 ------ .../acd_levers/affinity_days_levers_spec.rb | 17 -- .../ama_np_dist_goals_by_docket_lever_spec.rb | 15 -- .../acd_levers/batch_size_levers_spec.rb | 11 - .../inactive_data_elements_levers_spec.rb | 9 - .../acd_levers/lever_buttons_spec.rb | 9 - .../case_distribution_levers/admin_ui_spec.rb | 203 ++++++++++++++++++ 7 files changed, 203 insertions(+), 132 deletions(-) create mode 100644 spec/feature/case_distribution_levers/admin_ui_spec.rb diff --git a/spec/feature/automatic_case_distribution/acd_audit_history/audit_lever_history_table_spec.rb b/spec/feature/automatic_case_distribution/acd_audit_history/audit_lever_history_table_spec.rb index c1662fc1a04..b50d560fd4e 100644 --- a/spec/feature/automatic_case_distribution/acd_audit_history/audit_lever_history_table_spec.rb +++ b/spec/feature/automatic_case_distribution/acd_audit_history/audit_lever_history_table_spec.rb @@ -14,77 +14,6 @@ let(:ama_direct_reviews_lever) { CaseDistributionLever.find_by_item(ama_direct_reviews) } let(:alternate_batch_size_lever) { CaseDistributionLever.find_by_item(alternate_batch_size) } - context "user is in Case Distro Algorithm Control organization but not an admin" do - scenario "visits the lever control page", type: :feature do - visit "case-distribution-controls" - confirm_page_and_section_loaded - end - - scenario "visits the lever control page with an audit lever history entry " do - create(:case_distribution_audit_lever_entry, - case_distribution_lever: ama_direct_reviews_lever, - previous_value: 10, - update_value: 15) - - visit "case-distribution-controls" - confirm_page_and_section_loaded - - expect(find("#lever-history-table")).to have_content(current_user.css_id) - expect(find("#lever-history-table")).to have_content(ama_direct_reviews_lever.title) - expect(find("#lever-history-table")).to have_content("10 #{ama_direct_reviews_lever.unit}") - expect(find("#lever-history-table")).to have_content("15 #{ama_direct_reviews_lever.unit}") - end - - scenario "visits the lever control page with an audit two lever history entries " do - create(:case_distribution_audit_lever_entry, - case_distribution_lever: ama_direct_reviews_lever, - previous_value: 15, - update_value: 5) - - create(:case_distribution_audit_lever_entry, - case_distribution_lever: alternate_batch_size_lever, - previous_value: 7, - update_value: 6, - created_at: Time.zone.now - 1.minute) - - visit "case-distribution-controls" - confirm_page_and_section_loaded - - expect(find("#lever-history-table-row-0")).to have_content(current_user.css_id) - expect(find("#lever-history-table-row-0")).to have_content(alternate_batch_size_lever.title) - expect(find("#lever-history-table-row-0")).to have_content("7 #{alternate_batch_size_lever.unit}") - expect(find("#lever-history-table-row-0")).to have_content("6 #{alternate_batch_size_lever.unit}") - - expect(find("#lever-history-table-row-1")).to have_content(current_user.css_id) - expect(find("#lever-history-table-row-1")).to have_content(ama_direct_reviews_lever.title) - expect(find("#lever-history-table-row-1")).to have_content("15 #{ama_direct_reviews_lever.unit}") - expect(find("#lever-history-table-row-1")).to have_content("5 #{ama_direct_reviews_lever.unit}") - end - - scenario "visits the lever control page with one audit lever history entry with two levers changed" do - create(:case_distribution_audit_lever_entry, - case_distribution_lever: ama_direct_reviews_lever, - previous_value: 9, - update_value: 13) - create(:case_distribution_audit_lever_entry, - case_distribution_lever: alternate_batch_size_lever, - previous_value: 2, - update_value: 4) - - visit "case-distribution-controls" - confirm_page_and_section_loaded - - expect(find("#lever-history-table-row-0")).to have_content(current_user.css_id) - expect(find("#lever-history-table-row-0")).to have_content(alternate_batch_size_lever.title) - expect(find("#lever-history-table-row-0")).to have_content("2 #{alternate_batch_size_lever.unit}") - expect(find("#lever-history-table-row-0")).to have_content("4 #{alternate_batch_size_lever.unit}") - - expect(find("#lever-history-table-row-0")).to have_content(ama_direct_reviews_lever.title) - expect(find("#lever-history-table-row-0")).to have_content("9 #{ama_direct_reviews_lever.unit}") - expect(find("#lever-history-table-row-0")).to have_content("13 #{ama_direct_reviews_lever.unit}") - end - end - context "user is a Case Distro Algorithm Control admin" do let(:ama_direct_reviews_field) { Constants.DISTRIBUTION.ama_direct_review_docket_time_goals } diff --git a/spec/feature/automatic_case_distribution/acd_levers/affinity_days_levers_spec.rb b/spec/feature/automatic_case_distribution/acd_levers/affinity_days_levers_spec.rb index cb215a42751..a60d4ca1d03 100644 --- a/spec/feature/automatic_case_distribution/acd_levers/affinity_days_levers_spec.rb +++ b/spec/feature/automatic_case_distribution/acd_levers/affinity_days_levers_spec.rb @@ -26,23 +26,6 @@ ] end - context "user is in Case Distro Algorithm Control organization but not an admin" do - scenario "visits the lever control page", type: :feature do - visit "case-distribution-controls" - confirm_page_and_section_loaded - - disabled_lever_list.each do |item| - expect(find("#lever-wrapper-#{item}")).to match_css(".lever-disabled") - expect(find("#affinity-day-label-for-#{item}")).to match_css(".lever-disabled") - end - - enabled_lever_list.each do |item| - expect(find("#lever-wrapper-#{item}")).not_to match_css(".lever-disabled") - expect(find("#affinity-day-label-for-#{item}")).not_to match_css(".lever-disabled") - end - end - end - context "user is a Case Distro Algorithm Control admin" do before do OrganizationsUser.make_user_admin(current_user, CDAControlGroup.singleton) diff --git a/spec/feature/automatic_case_distribution/acd_levers/ama_np_dist_goals_by_docket_lever_spec.rb b/spec/feature/automatic_case_distribution/acd_levers/ama_np_dist_goals_by_docket_lever_spec.rb index 952483fc2ed..ada3a22a46c 100644 --- a/spec/feature/automatic_case_distribution/acd_levers/ama_np_dist_goals_by_docket_lever_spec.rb +++ b/spec/feature/automatic_case_distribution/acd_levers/ama_np_dist_goals_by_docket_lever_spec.rb @@ -17,21 +17,6 @@ let(:ama_direct_reviews_field) { Constants.DISTRIBUTION.ama_direct_review_docket_time_goals } let(:ama_evidence_submissions_field) { Constants.DISTRIBUTION.ama_evidence_submission_docket_time_goals } - context "user is in Case Distro Algorithm Control organization but not an admin" do - scenario "visits the lever control page", type: :feature do - visit "case-distribution-controls" - confirm_page_and_section_loaded - - expect(find("##{ama_hearings}-lever-value > span")["data-disabled-in-ui"]).to eq("false") - expect(find("##{ama_direct_reviews}-lever-value > span")["data-disabled-in-ui"]).to eq("false") - expect(find("##{ama_evidence_submissions}-lever-value > span")["data-disabled-in-ui"]).to eq("false") - - expect(find("##{ama_hearings}-lever-toggle > div > span")["data-disabled-in-ui"]).to eq("false") - expect(find("##{ama_direct_reviews}-lever-toggle > div > span")["data-disabled-in-ui"]).to eq("false") - expect(find("##{ama_evidence_submissions}-lever-toggle > div > span")["data-disabled-in-ui"]).to eq("false") - end - end - context "user is a Case Distro Algorithm Control admin" do before do OrganizationsUser.make_user_admin(current_user, CDAControlGroup.singleton) diff --git a/spec/feature/automatic_case_distribution/acd_levers/batch_size_levers_spec.rb b/spec/feature/automatic_case_distribution/acd_levers/batch_size_levers_spec.rb index 31a3e5f82d5..b5b24520c60 100644 --- a/spec/feature/automatic_case_distribution/acd_levers/batch_size_levers_spec.rb +++ b/spec/feature/automatic_case_distribution/acd_levers/batch_size_levers_spec.rb @@ -12,17 +12,6 @@ let(:batch_size_per_attorney) { Constants.DISTRIBUTION.batch_size_per_attorney } let(:request_more_cases_minimum) { Constants.DISTRIBUTION.request_more_cases_minimum } - context "user is in Case Distro Algorithm Control organization but not an admin" do - scenario "visits the lever control page", type: :feature do - visit "case-distribution-controls" - confirm_page_and_section_loaded - - expect(find("##{alternate_batch_size} > label")).to match_css(".lever-active") - expect(find("##{batch_size_per_attorney} > label")).to match_css(".lever-active") - expect(find("##{request_more_cases_minimum} > label")).to match_css(".lever-active") - end - end - context "user is a Case Distro Algorithm Control admin" do before do OrganizationsUser.make_user_admin(current_user, CDAControlGroup.singleton) diff --git a/spec/feature/automatic_case_distribution/acd_levers/inactive_data_elements_levers_spec.rb b/spec/feature/automatic_case_distribution/acd_levers/inactive_data_elements_levers_spec.rb index 661f144c83b..2d02b7f814e 100644 --- a/spec/feature/automatic_case_distribution/acd_levers/inactive_data_elements_levers_spec.rb +++ b/spec/feature/automatic_case_distribution/acd_levers/inactive_data_elements_levers_spec.rb @@ -13,15 +13,6 @@ let(:nod_adjustment) { Constants.DISTRIBUTION.nod_adjustment } let(:bust_backlog) { Constants.DISTRIBUTION.bust_backlog } - context "user is in Case Distro Algorithm Control organization but not an admin" do - scenario "visits the lever control page", type: :feature do - visit "case-distribution-controls" - confirm_page_and_section_loaded - - description_product_match - end - end - context "user is a Case Distro Algorithm Control admin" do before do OrganizationsUser.make_user_admin(current_user, CDAControlGroup.singleton) diff --git a/spec/feature/automatic_case_distribution/acd_levers/lever_buttons_spec.rb b/spec/feature/automatic_case_distribution/acd_levers/lever_buttons_spec.rb index bbdb850961a..acb15f245e6 100644 --- a/spec/feature/automatic_case_distribution/acd_levers/lever_buttons_spec.rb +++ b/spec/feature/automatic_case_distribution/acd_levers/lever_buttons_spec.rb @@ -15,15 +15,6 @@ let(:ama_direct_reviews_lever) { CaseDistributionLever.find_by_item(ama_direct_reviews) } let(:alternate_batch_size_lever) { CaseDistributionLever.find_by_item(alternate_batch_size) } - context "user is in Case Distro Algorithm Control organization but not an admin" do - scenario "visits the lever control page", type: :feature do - visit "case-distribution-controls" - confirm_page_and_section_loaded - expect(page).not_to have_button("Cancel") - expect(page).not_to have_button("Save") - end - end - context "user is a Case Distro Algorithm Control admin" do let(:ama_direct_reviews_field) { Constants.DISTRIBUTION.ama_direct_review_docket_time_goals } let(:alternative_batch_size_field) { "#{Constants.DISTRIBUTION.alternative_batch_size}-field" } diff --git a/spec/feature/case_distribution_levers/admin_ui_spec.rb b/spec/feature/case_distribution_levers/admin_ui_spec.rb new file mode 100644 index 00000000000..befd7dfb21a --- /dev/null +++ b/spec/feature/case_distribution_levers/admin_ui_spec.rb @@ -0,0 +1,203 @@ +# frozen_string_literal: true + +RSpec.feature "Admin UI" do + # TODO: break this out if possible + before { Seeds::CaseDistributionLevers.new.seed! } + + let!(:current_user) do + user = create(:user, css_id: "BVATTWAYNE") + CDAControlGroup.singleton.add_user(user) + User.authenticate!(user: user) + end + + let(:disabled_lever_list) do + [ + Constants.DISTRIBUTION.cavc_aod_affinity_days, + Constants.DISTRIBUTION.cavc_affinity_days, + Constants.DISTRIBUTION.aoj_affinity_days, + Constants.DISTRIBUTION.aoj_aod_affinity_days, + Constants.DISTRIBUTION.aoj_cavc_affinity_days + ] + end + + let(:enabled_lever_list) do + [ + Constants.DISTRIBUTION.ama_hearing_case_affinity_days, + Constants.DISTRIBUTION.ama_hearing_case_aod_affinity_days + ] + end + + let(:ama_hearings) { Constants.DISTRIBUTION.ama_hearing_start_distribution_prior_to_goals } + let(:ama_direct_reviews) { Constants.DISTRIBUTION.ama_direct_review_start_distribution_prior_to_goals } + let(:ama_evidence_submissions) { Constants.DISTRIBUTION.ama_evidence_submission_start_distribution_prior_to_goals } + + let(:alternate_batch_size) { Constants.DISTRIBUTION.alternative_batch_size } + let(:batch_size_per_attorney) { Constants.DISTRIBUTION.batch_size_per_attorney } + let(:request_more_cases_minimum) { Constants.DISTRIBUTION.request_more_cases_minimum } + + let(:ama_direct_reviews_lever) { CaseDistributionLever.find_by_item(ama_direct_reviews) } + let(:alternate_batch_size_lever) { CaseDistributionLever.find_by_item(alternate_batch_size) } + + + let(:maximum_direct_review_proportion) { Constants.DISTRIBUTION.maximum_direct_review_proportion } + let(:minimum_legacy_proportion) { Constants.DISTRIBUTION.minimum_legacy_proportion } + let(:nod_adjustment) { Constants.DISTRIBUTION.nod_adjustment } + let(:bust_backlog) { Constants.DISTRIBUTION.bust_backlog } + + context "user is in Case Distro Algorithm Control organization but not an admin" do + let!(:audit_lever_entry_1) do + create(:case_distribution_audit_lever_entry, + case_distribution_lever: ama_direct_reviews_lever, + previous_value: 10, + update_value: 15, + created_at: 5.days.ago) + end + let!(:audit_lever_entry_2) do + create(:case_distribution_audit_lever_entry, + case_distribution_lever: alternate_batch_size_lever, + previous_value: 7, + update_value: 6, + created_at: 4.days.ago) + end + let!(:audit_lever_entry_3) do + Timecop.travel(3.days.ago) do + create(:case_distribution_audit_lever_entry, + case_distribution_lever: ama_direct_reviews_lever, + previous_value: 15, + update_value: 5) + create(:case_distribution_audit_lever_entry, + case_distribution_lever: alternate_batch_size_lever, + previous_value: 2, + update_value: 4) + end + end + + scenario "the lever control page operates correctly", :aggregate_failures do + step "page renders" do + visit "case-distribution-controls" + confirm_page_and_section_loaded + + disabled_lever_list.each do |item| + expect(find("#lever-wrapper-#{item}")).to match_css(".lever-disabled") + expect(find("#affinity-day-label-for-#{item}")).to match_css(".lever-disabled") + end + + enabled_lever_list.each do |item| + expect(find("#lever-wrapper-#{item}")).not_to match_css(".lever-disabled") + expect(find("#affinity-day-label-for-#{item}")).not_to match_css(".lever-disabled") + end + + expect(find("##{ama_hearings}-lever-value > span")["data-disabled-in-ui"]).to eq("false") + expect(find("##{ama_direct_reviews}-lever-value > span")["data-disabled-in-ui"]).to eq("false") + expect(find("##{ama_evidence_submissions}-lever-value > span")["data-disabled-in-ui"]).to eq("false") + + expect(find("##{ama_hearings}-lever-toggle > div > span")["data-disabled-in-ui"]).to eq("false") + expect(find("##{ama_direct_reviews}-lever-toggle > div > span")["data-disabled-in-ui"]).to eq("false") + expect(find("##{ama_evidence_submissions}-lever-toggle > div > span")["data-disabled-in-ui"]).to eq("false") + + expect(find("##{alternate_batch_size} > label")).to match_css(".lever-active") + expect(find("##{batch_size_per_attorney} > label")).to match_css(".lever-active") + expect(find("##{request_more_cases_minimum} > label")).to match_css(".lever-active") + end + + step "lever history displays correctly" do + # expect(find("#lever-history-table")).to have_content(current_user.css_id) + # expect(find("#lever-history-table")).to have_content(ama_direct_reviews_lever.title) + # expect(find("#lever-history-table")).to have_content("10 #{ama_direct_reviews_lever.unit}") + # expect(find("#lever-history-table")).to have_content("15 #{ama_direct_reviews_lever.unit}") + + # create(:case_distribution_audit_lever_entry, + # case_distribution_lever: alternate_batch_size_lever, + # previous_value: 7, + # update_value: 6) + + # visit "case-distribution-controls" + + # expect(find("#lever-history-table-row-0")).to have_content(current_user.css_id) + # expect(find("#lever-history-table-row-0")).to have_content(alternate_batch_size_lever.title) + # expect(find("#lever-history-table-row-0")).to have_content("7 #{alternate_batch_size_lever.unit}") + # expect(find("#lever-history-table-row-0")).to have_content("6 #{alternate_batch_size_lever.unit}") + + # expect(find("#lever-history-table-row-1")).to have_content(current_user.css_id) + # expect(find("#lever-history-table-row-1")).to have_content(ama_direct_reviews_lever.title) + # expect(find("#lever-history-table-row-1")).to have_content("10 #{ama_direct_reviews_lever.unit}") + # expect(find("#lever-history-table-row-1")).to have_content("15 #{ama_direct_reviews_lever.unit}") + + # Timecop.freeze do + # create(:case_distribution_audit_lever_entry, + # case_distribution_lever: ama_direct_reviews_lever, + # previous_value: 15, + # update_value: 5) + # create(:case_distribution_audit_lever_entry, + # case_distribution_lever: alternate_batch_size_lever, + # previous_value: 2, + # update_value: 4) + # end + + # visit "case-distribution-controls" + byebug + expect(find("#lever-history-table-row-0")).to have_content(current_user.css_id) + expect(find("#lever-history-table-row-0")).to have_content(alternate_batch_size_lever.title) + expect(find("#lever-history-table-row-0")).to have_content("2 #{alternate_batch_size_lever.unit}") + expect(find("#lever-history-table-row-0")).to have_content("4 #{alternate_batch_size_lever.unit}") + expect(find("#lever-history-table-row-0")).to have_content(ama_direct_reviews_lever.title) + expect(find("#lever-history-table-row-0")).to have_content("15 #{ama_direct_reviews_lever.unit}") + expect(find("#lever-history-table-row-0")).to have_content("5 #{ama_direct_reviews_lever.unit}") + + expect(find("#lever-history-table-row-1")).to have_content(current_user.css_id) + expect(find("#lever-history-table-row-1")).to have_content(alternate_batch_size_lever.title) + expect(find("#lever-history-table-row-1")).to have_content("7 #{alternate_batch_size_lever.unit}") + expect(find("#lever-history-table-row-1")).to have_content("6 #{alternate_batch_size_lever.unit}") + + expect(find("#lever-history-table-row-2")).to have_content(current_user.css_id) + expect(find("#lever-history-table-row-2")).to have_content(ama_direct_reviews_lever.title) + expect(find("#lever-history-table-row-2")).to have_content("10 #{ama_direct_reviews_lever.unit}") + expect(find("#lever-history-table-row-2")).to have_content("15 #{ama_direct_reviews_lever.unit}") + end + end + end + + context "user is a Case Distro Algorithm Control admin" do + before do + OrganizationsUser.make_user_admin(current_user, CDAControlGroup.singleton) + end + end + + # rubocop:disable Metrics/AbcSize + def confirm_page_and_section_loaded + expect(page).to have_content(COPY::CASE_DISTRIBUTION_AFFINITY_DAYS_H2_TITLE) + expect(page).to have_content(COPY::CASE_DISTRIBUTION_DOCKET_TIME_GOALS_SECTION_TITLE) + expect(page).to have_content(COPY::CASE_DISTRIBUTION_BATCH_SIZE_H2_TITLE) + expect(page).to have_content(COPY::CASE_DISTRIBUTION_HISTORY_TITLE) + expect(page).to have_content(COPY::CASE_DISTRIBUTION_HISTORY_DESCRIPTION) + expect(page).to have_content(Constants.DISTRIBUTION.ama_hearing_case_affinity_days_title) + expect(page).to have_content(Constants.DISTRIBUTION.ama_hearing_case_aod_affinity_days_title) + expect(page).to have_content(Constants.DISTRIBUTION.cavc_affinity_days_title) + expect(page).to have_content(Constants.DISTRIBUTION.cavc_aod_affinity_days_title) + expect(page).to have_content(Constants.DISTRIBUTION.aoj_affinity_days_title) + expect(page).to have_content(Constants.DISTRIBUTION.aoj_aod_affinity_days_title) + expect(page).to have_content(Constants.DISTRIBUTION.aoj_cavc_affinity_days_title) + expect(page).to have_content(Constants.DISTRIBUTION.ama_hearings_section_title) + expect(page).to have_content(Constants.DISTRIBUTION.ama_direct_review_section_title) + expect(page).to have_content(Constants.DISTRIBUTION.ama_evidence_submission_section_title) + expect(page).to have_content(Constants.DISTRIBUTION.alternative_batch_size_title) + expect(page).to have_content(Constants.DISTRIBUTION.batch_size_per_attorney_title) + expect(page).to have_content(Constants.DISTRIBUTION.request_more_cases_minimum_title) + + expect(find("##{maximum_direct_review_proportion}-description")).to match_css(".description-styling") + expect(find("##{maximum_direct_review_proportion}-product")).to match_css(".value-styling") + + expect(find("##{minimum_legacy_proportion}-description")).to match_css(".description-styling") + expect(find("##{minimum_legacy_proportion}-product")).to match_css(".value-styling") + + expect(find("##{nod_adjustment}-description")).to match_css(".description-styling") + expect(find("##{nod_adjustment}-product")).to match_css(".value-styling") + + expect(find("##{bust_backlog}-description")).to match_css(".description-styling") + expect(find("##{bust_backlog}-product")).to match_css(".value-styling") + + expect(page).not_to have_button("Cancel") + expect(page).not_to have_button("Save") + end + # rubocop:enable Metrics/AbcSize +end From 91d0af610907aa5571ca70176a46a16f6c816c7d Mon Sep 17 00:00:00 2001 From: Craig Reese Date: Mon, 15 Jul 2024 11:57:15 -0500 Subject: [PATCH 13/31] remove commented portions of test --- .../case_distribution_levers/admin_ui_spec.rb | 35 ------------------- 1 file changed, 35 deletions(-) diff --git a/spec/feature/case_distribution_levers/admin_ui_spec.rb b/spec/feature/case_distribution_levers/admin_ui_spec.rb index befd7dfb21a..8ae2927c0bb 100644 --- a/spec/feature/case_distribution_levers/admin_ui_spec.rb +++ b/spec/feature/case_distribution_levers/admin_ui_spec.rb @@ -101,41 +101,6 @@ end step "lever history displays correctly" do - # expect(find("#lever-history-table")).to have_content(current_user.css_id) - # expect(find("#lever-history-table")).to have_content(ama_direct_reviews_lever.title) - # expect(find("#lever-history-table")).to have_content("10 #{ama_direct_reviews_lever.unit}") - # expect(find("#lever-history-table")).to have_content("15 #{ama_direct_reviews_lever.unit}") - - # create(:case_distribution_audit_lever_entry, - # case_distribution_lever: alternate_batch_size_lever, - # previous_value: 7, - # update_value: 6) - - # visit "case-distribution-controls" - - # expect(find("#lever-history-table-row-0")).to have_content(current_user.css_id) - # expect(find("#lever-history-table-row-0")).to have_content(alternate_batch_size_lever.title) - # expect(find("#lever-history-table-row-0")).to have_content("7 #{alternate_batch_size_lever.unit}") - # expect(find("#lever-history-table-row-0")).to have_content("6 #{alternate_batch_size_lever.unit}") - - # expect(find("#lever-history-table-row-1")).to have_content(current_user.css_id) - # expect(find("#lever-history-table-row-1")).to have_content(ama_direct_reviews_lever.title) - # expect(find("#lever-history-table-row-1")).to have_content("10 #{ama_direct_reviews_lever.unit}") - # expect(find("#lever-history-table-row-1")).to have_content("15 #{ama_direct_reviews_lever.unit}") - - # Timecop.freeze do - # create(:case_distribution_audit_lever_entry, - # case_distribution_lever: ama_direct_reviews_lever, - # previous_value: 15, - # update_value: 5) - # create(:case_distribution_audit_lever_entry, - # case_distribution_lever: alternate_batch_size_lever, - # previous_value: 2, - # update_value: 4) - # end - - # visit "case-distribution-controls" - byebug expect(find("#lever-history-table-row-0")).to have_content(current_user.css_id) expect(find("#lever-history-table-row-0")).to have_content(alternate_batch_size_lever.title) expect(find("#lever-history-table-row-0")).to have_content("2 #{alternate_batch_size_lever.unit}") From 7ba0778d4cc0234edfe6af4fb8c6a32151732db7 Mon Sep 17 00:00:00 2001 From: Craig Reese Date: Mon, 15 Jul 2024 13:22:15 -0500 Subject: [PATCH 14/31] move tests from affinity_days_levers_spec.rb --- .../audit_lever_history_table_spec.rb | 59 ------------------- .../case_distribution_levers/admin_ui_spec.rb | 43 ++++++++++++-- 2 files changed, 38 insertions(+), 64 deletions(-) delete mode 100644 spec/feature/automatic_case_distribution/acd_audit_history/audit_lever_history_table_spec.rb diff --git a/spec/feature/automatic_case_distribution/acd_audit_history/audit_lever_history_table_spec.rb b/spec/feature/automatic_case_distribution/acd_audit_history/audit_lever_history_table_spec.rb deleted file mode 100644 index b50d560fd4e..00000000000 --- a/spec/feature/automatic_case_distribution/acd_audit_history/audit_lever_history_table_spec.rb +++ /dev/null @@ -1,59 +0,0 @@ -# frozen_string_literal: true - -RSpec.feature "Audit Lever History Table" do - let!(:current_user) do - user = create(:user, css_id: "BVATTWAYNE") - CDAControlGroup.singleton.add_user(user) - User.authenticate!(user: user) - end - before { Seeds::CaseDistributionLevers.new.seed! } - - let(:ama_direct_reviews) { Constants.DISTRIBUTION.ama_direct_review_start_distribution_prior_to_goals } - let(:alternate_batch_size) { Constants.DISTRIBUTION.alternative_batch_size } - - let(:ama_direct_reviews_lever) { CaseDistributionLever.find_by_item(ama_direct_reviews) } - let(:alternate_batch_size_lever) { CaseDistributionLever.find_by_item(alternate_batch_size) } - - context "user is a Case Distro Algorithm Control admin" do - let(:ama_direct_reviews_field) { Constants.DISTRIBUTION.ama_direct_review_docket_time_goals } - - before do - OrganizationsUser.make_user_admin(current_user, CDAControlGroup.singleton) - end - - scenario "lever history displays on page", type: :feature do - visit "case-distribution-controls" - confirm_page_and_section_loaded - - expect(find("#lever-history-table").has_no_content?("123 days")).to eq(true) - expect(find("#lever-history-table").has_no_content?("300 days")).to eq(true) - - fill_in ama_direct_reviews_field, with: "123" - click_save_button - click_modal_confirm_button - - expect(find("#lever-history-table").has_content?("123 days")).to eq(true) - expect(find("#lever-history-table").has_no_content?("300 days")).to eq(true) - - fill_in ama_direct_reviews_field, with: "300" - click_save_button - click_modal_confirm_button - - expect(find("#lever-history-table").has_content?("123 days")).to eq(true) - expect(find("#lever-history-table").has_content?("300 days")).to eq(true) - end - end -end - -def confirm_page_and_section_loaded - expect(page).to have_content(COPY::CASE_DISTRIBUTION_HISTORY_TITLE) - expect(page).to have_content(COPY::CASE_DISTRIBUTION_HISTORY_DESCRIPTION) -end - -def click_save_button - find("#LeversSaveButton").click -end - -def click_modal_confirm_button - find("#save-modal-confirm").click -end diff --git a/spec/feature/case_distribution_levers/admin_ui_spec.rb b/spec/feature/case_distribution_levers/admin_ui_spec.rb index 8ae2927c0bb..82634baeef3 100644 --- a/spec/feature/case_distribution_levers/admin_ui_spec.rb +++ b/spec/feature/case_distribution_levers/admin_ui_spec.rb @@ -38,12 +38,13 @@ let(:ama_direct_reviews_lever) { CaseDistributionLever.find_by_item(ama_direct_reviews) } let(:alternate_batch_size_lever) { CaseDistributionLever.find_by_item(alternate_batch_size) } - let(:maximum_direct_review_proportion) { Constants.DISTRIBUTION.maximum_direct_review_proportion } let(:minimum_legacy_proportion) { Constants.DISTRIBUTION.minimum_legacy_proportion } let(:nod_adjustment) { Constants.DISTRIBUTION.nod_adjustment } let(:bust_backlog) { Constants.DISTRIBUTION.bust_backlog } + let(:ama_direct_reviews_field) { Constants.DISTRIBUTION.ama_direct_review_docket_time_goals } + context "user is in Case Distro Algorithm Control organization but not an admin" do let!(:audit_lever_entry_1) do create(:case_distribution_audit_lever_entry, @@ -72,10 +73,12 @@ end end - scenario "the lever control page operates correctly", :aggregate_failures do + it "the lever control page renders correctly", :aggregate_failures do step "page renders" do visit "case-distribution-controls" confirm_page_and_section_loaded + expect(page).not_to have_button("Cancel") + expect(page).not_to have_button("Save") disabled_lever_list.each do |item| expect(find("#lever-wrapper-#{item}")).to match_css(".lever-disabled") @@ -126,6 +129,31 @@ before do OrganizationsUser.make_user_admin(current_user, CDAControlGroup.singleton) end + + it "the lever control page operates correctly" do + step "lever history displays on page" do + visit "case-distribution-controls" + confirm_page_and_section_loaded + + expect(find("#lever-history-table").has_no_content?("123 days")).to eq(true) + expect(find("#lever-history-table").has_no_content?("300 days")).to eq(true) + + fill_in ama_direct_reviews_field, with: "" + fill_in ama_direct_reviews_field, with: "123" + click_save_button + click_modal_confirm_button + + expect(find("#lever-history-table").has_content?("123 days")).to eq(true) + expect(find("#lever-history-table").has_no_content?("300 days")).to eq(true) + + fill_in ama_direct_reviews_field, with: "300" + click_save_button + click_modal_confirm_button + + expect(find("#lever-history-table").has_content?("123 days")).to eq(true) + expect(find("#lever-history-table").has_content?("300 days")).to eq(true) + end + end end # rubocop:disable Metrics/AbcSize @@ -160,9 +188,14 @@ def confirm_page_and_section_loaded expect(find("##{bust_backlog}-description")).to match_css(".description-styling") expect(find("##{bust_backlog}-product")).to match_css(".value-styling") - - expect(page).not_to have_button("Cancel") - expect(page).not_to have_button("Save") end # rubocop:enable Metrics/AbcSize + + def click_save_button + find("#LeversSaveButton").click + end + + def click_modal_confirm_button + find("#save-modal-confirm").click + end end From f391519a5075e67e90c32c51381afdcf7e1dff2c Mon Sep 17 00:00:00 2001 From: Craig Reese Date: Mon, 15 Jul 2024 13:38:54 -0500 Subject: [PATCH 15/31] move tests from affinity_days_levers_spec.rb, last commit was from audit_lever_history_table_spec.rb --- .../acd_levers/affinity_days_levers_spec.rb | 66 ------------------- .../case_distribution_levers/admin_ui_spec.rb | 37 ++++++++++- 2 files changed, 35 insertions(+), 68 deletions(-) delete mode 100644 spec/feature/automatic_case_distribution/acd_levers/affinity_days_levers_spec.rb diff --git a/spec/feature/automatic_case_distribution/acd_levers/affinity_days_levers_spec.rb b/spec/feature/automatic_case_distribution/acd_levers/affinity_days_levers_spec.rb deleted file mode 100644 index a60d4ca1d03..00000000000 --- a/spec/feature/automatic_case_distribution/acd_levers/affinity_days_levers_spec.rb +++ /dev/null @@ -1,66 +0,0 @@ -# frozen_string_literal: true - -RSpec.feature "Affinity Days Levers" do - before { Seeds::CaseDistributionLevers.new.seed! } - - let!(:current_user) do - user = create(:user, css_id: "BVATTWAYNE") - CDAControlGroup.singleton.add_user(user) - User.authenticate!(user: user) - end - - let(:disabled_lever_list) do - [ - Constants.DISTRIBUTION.cavc_aod_affinity_days, - Constants.DISTRIBUTION.cavc_affinity_days, - Constants.DISTRIBUTION.aoj_affinity_days, - Constants.DISTRIBUTION.aoj_aod_affinity_days, - Constants.DISTRIBUTION.aoj_cavc_affinity_days - ] - end - - let(:enabled_lever_list) do - [ - Constants.DISTRIBUTION.ama_hearing_case_affinity_days, - Constants.DISTRIBUTION.ama_hearing_case_aod_affinity_days - ] - end - - context "user is a Case Distro Algorithm Control admin" do - before do - OrganizationsUser.make_user_admin(current_user, CDAControlGroup.singleton) - end - - scenario "visits the lever control page" do - visit "case-distribution-controls" - confirm_page_and_section_loaded - - option_list = [Constants.ACD_LEVERS.omit, Constants.ACD_LEVERS.infinite, Constants.ACD_LEVERS.value] - - disabled_lever_list.each do |disabled_lever| - option_list.each do |option| - expect(find("##{disabled_lever}-#{option}", visible: false)).to be_disabled - end - end - - enabled_lever_list.each do |enabled_lever| - option_list.each do |option| - expect(find("##{enabled_lever}-#{option}", visible: false)).not_to be_disabled - end - end - end - end -end - -# rubocop:disable Metrics/AbcSize -def confirm_page_and_section_loaded - expect(page).to have_content(COPY::CASE_DISTRIBUTION_AFFINITY_DAYS_H2_TITLE) - expect(page).to have_content(Constants.DISTRIBUTION.ama_hearing_case_affinity_days_title) - expect(page).to have_content(Constants.DISTRIBUTION.ama_hearing_case_aod_affinity_days_title) - expect(page).to have_content(Constants.DISTRIBUTION.cavc_affinity_days_title) - expect(page).to have_content(Constants.DISTRIBUTION.cavc_aod_affinity_days_title) - expect(page).to have_content(Constants.DISTRIBUTION.aoj_affinity_days_title) - expect(page).to have_content(Constants.DISTRIBUTION.aoj_aod_affinity_days_title) - expect(page).to have_content(Constants.DISTRIBUTION.aoj_cavc_affinity_days_title) -end -# rubocop:enable Metrics/AbcSize diff --git a/spec/feature/case_distribution_levers/admin_ui_spec.rb b/spec/feature/case_distribution_levers/admin_ui_spec.rb index 82634baeef3..179c1295dd5 100644 --- a/spec/feature/case_distribution_levers/admin_ui_spec.rb +++ b/spec/feature/case_distribution_levers/admin_ui_spec.rb @@ -131,10 +131,43 @@ end it "the lever control page operates correctly" do + visit "case-distribution-controls" + confirm_page_and_section_loaded + + step "enabled and disabled levers display correctly" do + # From affinity_days_levers_spec.rb + option_list = [Constants.ACD_LEVERS.omit, Constants.ACD_LEVERS.infinite, Constants.ACD_LEVERS.value] + + disabled_lever_list.each do |disabled_lever| + option_list.each do |option| + expect(find("##{disabled_lever}-#{option}", visible: false)).to be_disabled + end + end + + enabled_lever_list.each do |enabled_lever| + option_list.each do |option| + expect(find("##{enabled_lever}-#{option}", visible: false)).not_to be_disabled + end + end + end + step "lever history displays on page" do - visit "case-distribution-controls" - confirm_page_and_section_loaded + # From affinity_days_levers_spec.rb + option_list = [Constants.ACD_LEVERS.omit, Constants.ACD_LEVERS.infinite, Constants.ACD_LEVERS.value] + + disabled_lever_list.each do |disabled_lever| + option_list.each do |option| + expect(find("##{disabled_lever}-#{option}", visible: false)).to be_disabled + end + end + + enabled_lever_list.each do |enabled_lever| + option_list.each do |option| + expect(find("##{enabled_lever}-#{option}", visible: false)).not_to be_disabled + end + end + # From ../acd_audit_history/audit_lever_history_table_spec.rb expect(find("#lever-history-table").has_no_content?("123 days")).to eq(true) expect(find("#lever-history-table").has_no_content?("300 days")).to eq(true) From 09eed2da1c1b42ef4e771644b0d52b05dde5afe7 Mon Sep 17 00:00:00 2001 From: Craig Reese Date: Mon, 15 Jul 2024 13:47:00 -0500 Subject: [PATCH 16/31] remove ama_np_dist_goals_by_docket_lever_spec.rb --- .../ama_np_dist_goals_by_docket_lever_spec.rb | 67 ------------------- .../case_distribution_levers/admin_ui_spec.rb | 42 ++++++++---- 2 files changed, 29 insertions(+), 80 deletions(-) delete mode 100644 spec/feature/automatic_case_distribution/acd_levers/ama_np_dist_goals_by_docket_lever_spec.rb diff --git a/spec/feature/automatic_case_distribution/acd_levers/ama_np_dist_goals_by_docket_lever_spec.rb b/spec/feature/automatic_case_distribution/acd_levers/ama_np_dist_goals_by_docket_lever_spec.rb deleted file mode 100644 index ada3a22a46c..00000000000 --- a/spec/feature/automatic_case_distribution/acd_levers/ama_np_dist_goals_by_docket_lever_spec.rb +++ /dev/null @@ -1,67 +0,0 @@ -# frozen_string_literal: true - -RSpec.feature "AMA Non-priority Distribution Goals by Docket Levers" do - before { Seeds::CaseDistributionLevers.new.seed! } - - let!(:current_user) do - user = create(:user, css_id: "BVATTWAYNE") - CDAControlGroup.singleton.add_user(user) - User.authenticate!(user: user) - end - - let(:ama_hearings) { Constants.DISTRIBUTION.ama_hearing_start_distribution_prior_to_goals } - let(:ama_direct_reviews) { Constants.DISTRIBUTION.ama_direct_review_start_distribution_prior_to_goals } - let(:ama_evidence_submissions) { Constants.DISTRIBUTION.ama_evidence_submission_start_distribution_prior_to_goals } - - let(:ama_hearings_field) { Constants.DISTRIBUTION.ama_hearing_docket_time_goals } - let(:ama_direct_reviews_field) { Constants.DISTRIBUTION.ama_direct_review_docket_time_goals } - let(:ama_evidence_submissions_field) { Constants.DISTRIBUTION.ama_evidence_submission_docket_time_goals } - - context "user is a Case Distro Algorithm Control admin" do - before do - OrganizationsUser.make_user_admin(current_user, CDAControlGroup.singleton) - end - - scenario "visits the lever control page" do - visit "case-distribution-controls" - confirm_page_and_section_loaded - - expect(page).to have_field(ama_hearings_field.to_s, disabled: false) - expect(page).to have_field(ama_direct_reviews_field.to_s) - expect(page).to have_field(ama_evidence_submissions_field.to_s, disabled: false) - - expect(page).to have_button("toggle-switch-#{ama_hearings}", disabled: false) - expect(page).to have_button("toggle-switch-#{ama_direct_reviews}", disabled: false) - expect(page).to have_button("toggle-switch-#{ama_evidence_submissions}", disabled: false) - end - - scenario "changes the AMA Direct Review lever value to an invalid input" do - visit "case-distribution-controls" - confirm_page_and_section_loaded - - empty_error_message = "Please enter a value greater than or equal to 0" - - fill_in ama_direct_reviews_field, with: "ABC" - expect(page).to have_field(ama_direct_reviews_field, with: "") - expect(find("##{ama_direct_reviews_field}-lever")).to have_content(empty_error_message) - - fill_in ama_direct_reviews_field, with: "-1" - expect(page).to have_field(ama_direct_reviews_field, with: "1") - expect(find("##{ama_direct_reviews_field}-lever").has_no_content?(empty_error_message)).to eq(true) - end - - scenario "changes the AMA Direct Review lever value to a valid input" do - visit "case-distribution-controls" - confirm_page_and_section_loaded - - expect(page).to have_field(ama_direct_reviews_field, with: "365") - end - end -end - -def confirm_page_and_section_loaded - expect(page).to have_content(COPY::CASE_DISTRIBUTION_DOCKET_TIME_GOALS_SECTION_TITLE) - expect(page).to have_content(Constants.DISTRIBUTION.ama_hearings_section_title) - expect(page).to have_content(Constants.DISTRIBUTION.ama_direct_review_section_title) - expect(page).to have_content(Constants.DISTRIBUTION.ama_evidence_submission_section_title) -end diff --git a/spec/feature/case_distribution_levers/admin_ui_spec.rb b/spec/feature/case_distribution_levers/admin_ui_spec.rb index 179c1295dd5..72de1f70a29 100644 --- a/spec/feature/case_distribution_levers/admin_ui_spec.rb +++ b/spec/feature/case_distribution_levers/admin_ui_spec.rb @@ -31,6 +31,10 @@ let(:ama_direct_reviews) { Constants.DISTRIBUTION.ama_direct_review_start_distribution_prior_to_goals } let(:ama_evidence_submissions) { Constants.DISTRIBUTION.ama_evidence_submission_start_distribution_prior_to_goals } + let(:ama_hearings_field) { Constants.DISTRIBUTION.ama_hearing_docket_time_goals } + let(:ama_direct_reviews_field) { Constants.DISTRIBUTION.ama_direct_review_docket_time_goals } + let(:ama_evidence_submissions_field) { Constants.DISTRIBUTION.ama_evidence_submission_docket_time_goals } + let(:alternate_batch_size) { Constants.DISTRIBUTION.alternative_batch_size } let(:batch_size_per_attorney) { Constants.DISTRIBUTION.batch_size_per_attorney } let(:request_more_cases_minimum) { Constants.DISTRIBUTION.request_more_cases_minimum } @@ -151,22 +155,31 @@ end end - step "lever history displays on page" do - # From affinity_days_levers_spec.rb - option_list = [Constants.ACD_LEVERS.omit, Constants.ACD_LEVERS.infinite, Constants.ACD_LEVERS.value] + step "levers initally display correctly" do + # From ama_np_dist_goals_by_docket_lever_spec.rb + expect(page).to have_field(ama_hearings_field.to_s, disabled: false) + expect(page).to have_field(ama_direct_reviews_field.to_s) + expect(page).to have_field(ama_evidence_submissions_field.to_s, disabled: false) - disabled_lever_list.each do |disabled_lever| - option_list.each do |option| - expect(find("##{disabled_lever}-#{option}", visible: false)).to be_disabled - end - end + expect(page).to have_button("toggle-switch-#{ama_hearings}", disabled: false) + expect(page).to have_button("toggle-switch-#{ama_direct_reviews}", disabled: false) + expect(page).to have_button("toggle-switch-#{ama_evidence_submissions}", disabled: false) + end - enabled_lever_list.each do |enabled_lever| - option_list.each do |option| - expect(find("##{enabled_lever}-#{option}", visible: false)).not_to be_disabled - end - end + step "error displays for invalid input" do + # From ama_np_dist_goals_by_docket_lever_spec.rb + empty_error_message = "Please enter a value greater than or equal to 0" + + fill_in ama_direct_reviews_field, with: "ABC" + expect(page).to have_field(ama_direct_reviews_field, with: "") + expect(find("##{ama_direct_reviews_field}-lever")).to have_content(empty_error_message) + fill_in ama_direct_reviews_field, with: "-1" + expect(page).to have_field(ama_direct_reviews_field, with: "1") + expect(find("##{ama_direct_reviews_field}-lever").has_no_content?(empty_error_message)).to eq(true) + end + + step "error clears with valid input" do # From ../acd_audit_history/audit_lever_history_table_spec.rb expect(find("#lever-history-table").has_no_content?("123 days")).to eq(true) expect(find("#lever-history-table").has_no_content?("300 days")).to eq(true) @@ -175,7 +188,10 @@ fill_in ama_direct_reviews_field, with: "123" click_save_button click_modal_confirm_button + end + step "lever history displays on page" do + # From ../acd_audit_history/audit_lever_history_table_spec.rb expect(find("#lever-history-table").has_content?("123 days")).to eq(true) expect(find("#lever-history-table").has_no_content?("300 days")).to eq(true) From f1faa609182125d3854d02cf2d4b3253b1f8c8af Mon Sep 17 00:00:00 2001 From: Craig Reese Date: Mon, 15 Jul 2024 14:09:53 -0500 Subject: [PATCH 17/31] remove batch_size_levers_spec.rb --- .../acd_levers/batch_size_levers_spec.rb | 75 ------------------- .../case_distribution_levers/admin_ui_spec.rb | 34 ++++++++- 2 files changed, 31 insertions(+), 78 deletions(-) delete mode 100644 spec/feature/automatic_case_distribution/acd_levers/batch_size_levers_spec.rb diff --git a/spec/feature/automatic_case_distribution/acd_levers/batch_size_levers_spec.rb b/spec/feature/automatic_case_distribution/acd_levers/batch_size_levers_spec.rb deleted file mode 100644 index b5b24520c60..00000000000 --- a/spec/feature/automatic_case_distribution/acd_levers/batch_size_levers_spec.rb +++ /dev/null @@ -1,75 +0,0 @@ -# frozen_string_literal: true - -RSpec.feature "Batch Size Levers" do - before { Seeds::CaseDistributionLevers.new.seed! } - let!(:current_user) do - user = create(:user, css_id: "BVATTWAYNE") - CDAControlGroup.singleton.add_user(user) - User.authenticate!(user: user) - end - - let(:alternate_batch_size) { Constants.DISTRIBUTION.alternative_batch_size } - let(:batch_size_per_attorney) { Constants.DISTRIBUTION.batch_size_per_attorney } - let(:request_more_cases_minimum) { Constants.DISTRIBUTION.request_more_cases_minimum } - - context "user is a Case Distro Algorithm Control admin" do - before do - OrganizationsUser.make_user_admin(current_user, CDAControlGroup.singleton) - end - - scenario "visits the lever control page" do - visit "case-distribution-controls" - confirm_page_and_section_loaded - - expect(page).to have_field("#{alternate_batch_size}-field", readonly: false) - expect(page).to have_field("#{batch_size_per_attorney}-field", readonly: false) - expect(page).to have_field("#{request_more_cases_minimum}-field", readonly: false) - end - - scenario "changes the Batch Size levers values to an valid input" do - visit "case-distribution-controls" - confirm_page_and_section_loaded - - expect(page).not_to have_field("#{alternate_batch_size}-field", with: "42") - expect(page).not_to have_field("#{batch_size_per_attorney}-field", with: "32") - expect(page).not_to have_field("#{request_more_cases_minimum}-field", with: "25") - - fill_in "#{alternate_batch_size}-field", with: "42" - fill_in "#{batch_size_per_attorney}-field", with: "32" - fill_in "#{request_more_cases_minimum}-field", with: "25" - - expect(page).to have_field("#{alternate_batch_size}-field", with: "42") - expect(page).to have_field("#{batch_size_per_attorney}-field", with: "32") - expect(page).to have_field("#{request_more_cases_minimum}-field", with: "25") - end - - scenario "changes the Batch Size levers values to a invalid inputs" do - visit "case-distribution-controls" - confirm_page_and_section_loaded - - empty_error_message = "Please enter a value greater than or equal to 0" - - CaseDistributionLever.find_by_item(alternate_batch_size) - CaseDistributionLever.find_by_item(batch_size_per_attorney) - CaseDistributionLever.find_by_item(request_more_cases_minimum) - - fill_in "#{alternate_batch_size}-field", with: "ABC" - fill_in "#{batch_size_per_attorney}-field", with: "-1" - fill_in "#{request_more_cases_minimum}-field", with: "(*&)" - - expect(page).to have_field("#{alternate_batch_size}-field", with: "") - expect(page).to have_field("#{batch_size_per_attorney}-field", with: "1") - expect(page).to have_field("#{request_more_cases_minimum}-field", with: "") - - expect(find("##{alternate_batch_size} > div > div > span")).to have_content(empty_error_message) - expect(find("##{request_more_cases_minimum} > div > div > span")).to have_content(empty_error_message) - end - end -end - -def confirm_page_and_section_loaded - expect(page).to have_content(COPY::CASE_DISTRIBUTION_BATCH_SIZE_H2_TITLE) - expect(page).to have_content(Constants.DISTRIBUTION.alternative_batch_size_title) - expect(page).to have_content(Constants.DISTRIBUTION.batch_size_per_attorney_title) - expect(page).to have_content(Constants.DISTRIBUTION.request_more_cases_minimum_title) -end diff --git a/spec/feature/case_distribution_levers/admin_ui_spec.rb b/spec/feature/case_distribution_levers/admin_ui_spec.rb index 72de1f70a29..1c8d6ee410c 100644 --- a/spec/feature/case_distribution_levers/admin_ui_spec.rb +++ b/spec/feature/case_distribution_levers/admin_ui_spec.rb @@ -138,6 +138,8 @@ visit "case-distribution-controls" confirm_page_and_section_loaded + empty_error_message = "Please enter a value greater than or equal to 0" + step "enabled and disabled levers display correctly" do # From affinity_days_levers_spec.rb option_list = [Constants.ACD_LEVERS.omit, Constants.ACD_LEVERS.infinite, Constants.ACD_LEVERS.value] @@ -166,9 +168,8 @@ expect(page).to have_button("toggle-switch-#{ama_evidence_submissions}", disabled: false) end - step "error displays for invalid input" do + step "error displays for invalid input on time goals section" do # From ama_np_dist_goals_by_docket_lever_spec.rb - empty_error_message = "Please enter a value greater than or equal to 0" fill_in ama_direct_reviews_field, with: "ABC" expect(page).to have_field(ama_direct_reviews_field, with: "") @@ -179,7 +180,7 @@ expect(find("##{ama_direct_reviews_field}-lever").has_no_content?(empty_error_message)).to eq(true) end - step "error clears with valid input" do + step "time goals section error clears with valid input" do # From ../acd_audit_history/audit_lever_history_table_spec.rb expect(find("#lever-history-table").has_no_content?("123 days")).to eq(true) expect(find("#lever-history-table").has_no_content?("300 days")).to eq(true) @@ -190,6 +191,33 @@ click_modal_confirm_button end + step "batch size lever section errors display with invalid inputs" do + # From batch_size_levers_spec.rb + expect(page).to have_field("#{alternate_batch_size}-field", readonly: false) + expect(page).to have_field("#{batch_size_per_attorney}-field", readonly: false) + expect(page).to have_field("#{request_more_cases_minimum}-field", readonly: false) + + fill_in "#{alternate_batch_size}-field", with: "ABC" + fill_in "#{batch_size_per_attorney}-field", with: "-1" + fill_in "#{request_more_cases_minimum}-field", with: "(*&)" + + expect(page).to have_field("#{alternate_batch_size}-field", with: "") + expect(page).to have_field("#{batch_size_per_attorney}-field", with: "1") + expect(page).to have_field("#{request_more_cases_minimum}-field", with: "") + + expect(find("##{alternate_batch_size} > div > div > span")).to have_content(empty_error_message) + expect(find("##{request_more_cases_minimum} > div > div > span")).to have_content(empty_error_message) + end + + step "batch size lever section errors clear with valid inputs" do + # From batch_size_levers_spec.rb + fill_in "#{alternate_batch_size}-field", with: "42" + fill_in "#{batch_size_per_attorney}-field", with: "32" + fill_in "#{request_more_cases_minimum}-field", with: "25" + + expect(page).not_to have_content(empty_error_message) + end + step "lever history displays on page" do # From ../acd_audit_history/audit_lever_history_table_spec.rb expect(find("#lever-history-table").has_content?("123 days")).to eq(true) From 03639cc4fedbcd09fda92e36feec56152ce06700 Mon Sep 17 00:00:00 2001 From: Craig Reese Date: Mon, 15 Jul 2024 14:16:51 -0500 Subject: [PATCH 18/31] remove inactive_data_elements_levers_spec.rb --- .../inactive_data_elements_levers_spec.rb | 79 ------------------- .../case_distribution_levers/admin_ui_spec.rb | 34 +++++++- 2 files changed, 31 insertions(+), 82 deletions(-) delete mode 100644 spec/feature/automatic_case_distribution/acd_levers/inactive_data_elements_levers_spec.rb diff --git a/spec/feature/automatic_case_distribution/acd_levers/inactive_data_elements_levers_spec.rb b/spec/feature/automatic_case_distribution/acd_levers/inactive_data_elements_levers_spec.rb deleted file mode 100644 index 2d02b7f814e..00000000000 --- a/spec/feature/automatic_case_distribution/acd_levers/inactive_data_elements_levers_spec.rb +++ /dev/null @@ -1,79 +0,0 @@ -# frozen_string_literal: true - -RSpec.feature "Excluding Appeals by Docket Type and Priority from Automatic Case Distribution Levers" do - before { Seeds::CaseDistributionLevers.new.seed! } - let!(:current_user) do - user = create(:user, css_id: "BVATTWAYNE") - CDAControlGroup.singleton.add_user(user) - User.authenticate!(user: user) - end - - let(:maximum_direct_review_proportion) { Constants.DISTRIBUTION.maximum_direct_review_proportion } - let(:minimum_legacy_proportion) { Constants.DISTRIBUTION.minimum_legacy_proportion } - let(:nod_adjustment) { Constants.DISTRIBUTION.nod_adjustment } - let(:bust_backlog) { Constants.DISTRIBUTION.bust_backlog } - - context "user is a Case Distro Algorithm Control admin" do - before do - OrganizationsUser.make_user_admin(current_user, CDAControlGroup.singleton) - end - - scenario "visits the lever control page" do - visit "case-distribution-controls" - confirm_page_and_section_loaded - - description_product_match - end - - scenario "confirms the displayed values of the levers" do - visit "case-distribution-controls" - confirm_page_and_section_loaded - - maximum_direct_review_proportion_lever = CaseDistributionLever.find_by_item(maximum_direct_review_proportion) - minimum_legacy_proportion_lever = CaseDistributionLever.find_by_item(minimum_legacy_proportion) - nod_adjustment_lever = CaseDistributionLever.find_by_item(nod_adjustment) - bust_backlog_lever = CaseDistributionLever.find_by_item(bust_backlog) - - converted_maximum_direct_review_proportion_value = - (maximum_direct_review_proportion_lever.value.to_f * 100).to_i.to_s - converted_minimum_legacy_proportion_value = (minimum_legacy_proportion_lever.value.to_f * 100).to_i.to_s - converted_nod_adjustment_value = (nod_adjustment_lever.value.to_f * 100).to_i.to_s - bust_backlog_value = bust_backlog_lever.value.humanize - - expect(find("##{maximum_direct_review_proportion}-value")).to have_content( - converted_maximum_direct_review_proportion_value + maximum_direct_review_proportion_lever.unit - ) - expect(find("##{minimum_legacy_proportion}-value")).to have_content( - converted_minimum_legacy_proportion_value + minimum_legacy_proportion_lever.unit - ) - expect(find("##{nod_adjustment}-value")).to have_content( - converted_nod_adjustment_value + nod_adjustment_lever.unit - ) - expect(find("##{bust_backlog}-value")).to have_content(bust_backlog_value + bust_backlog_lever.unit) - end - end -end - -# rubocop:disable Metrics/AbcSize -def description_product_match - expect(find("##{maximum_direct_review_proportion}-description")).to match_css(".description-styling") - expect(find("##{maximum_direct_review_proportion}-product")).to match_css(".value-styling") - - expect(find("##{minimum_legacy_proportion}-description")).to match_css(".description-styling") - expect(find("##{minimum_legacy_proportion}-product")).to match_css(".value-styling") - - expect(find("##{nod_adjustment}-description")).to match_css(".description-styling") - expect(find("##{nod_adjustment}-product")).to match_css(".value-styling") - - expect(find("##{bust_backlog}-description")).to match_css(".description-styling") - expect(find("##{bust_backlog}-product")).to match_css(".value-styling") -end - -def confirm_page_and_section_loaded - expect(page).to have_content(COPY::CASE_DISTRIBUTION_STATIC_LEVERS_TITLE) - expect(page).to have_content(Constants.DISTRIBUTION.maximum_direct_review_proportion_title) - expect(page).to have_content(Constants.DISTRIBUTION.minimum_legacy_proportion_title) - expect(page).to have_content(Constants.DISTRIBUTION.nod_adjustment_title) - expect(page).to have_content(Constants.DISTRIBUTION.bust_backlog_title) -end -# rubocop:enable Metrics/AbcSize diff --git a/spec/feature/case_distribution_levers/admin_ui_spec.rb b/spec/feature/case_distribution_levers/admin_ui_spec.rb index 1c8d6ee410c..7a2af75c539 100644 --- a/spec/feature/case_distribution_levers/admin_ui_spec.rb +++ b/spec/feature/case_distribution_levers/admin_ui_spec.rb @@ -168,6 +168,31 @@ expect(page).to have_button("toggle-switch-#{ama_evidence_submissions}", disabled: false) end + step "inactive levers are displayed with values" do + # From inactive_data_elements_levers_spec.rb + maximum_direct_review_proportion_lever = CaseDistributionLever.find_by_item(maximum_direct_review_proportion) + minimum_legacy_proportion_lever = CaseDistributionLever.find_by_item(minimum_legacy_proportion) + nod_adjustment_lever = CaseDistributionLever.find_by_item(nod_adjustment) + bust_backlog_lever = CaseDistributionLever.find_by_item(bust_backlog) + + converted_maximum_direct_review_proportion_value = + (maximum_direct_review_proportion_lever.value.to_f * 100).to_i.to_s + converted_minimum_legacy_proportion_value = (minimum_legacy_proportion_lever.value.to_f * 100).to_i.to_s + converted_nod_adjustment_value = (nod_adjustment_lever.value.to_f * 100).to_i.to_s + bust_backlog_value = bust_backlog_lever.value.humanize + + expect(find("##{maximum_direct_review_proportion}-value")).to have_content( + converted_maximum_direct_review_proportion_value + maximum_direct_review_proportion_lever.unit + ) + expect(find("##{minimum_legacy_proportion}-value")).to have_content( + converted_minimum_legacy_proportion_value + minimum_legacy_proportion_lever.unit + ) + expect(find("##{nod_adjustment}-value")).to have_content( + converted_nod_adjustment_value + nod_adjustment_lever.unit + ) + expect(find("##{bust_backlog}-value")).to have_content(bust_backlog_value + bust_backlog_lever.unit) + end + step "error displays for invalid input on time goals section" do # From ama_np_dist_goals_by_docket_lever_spec.rb @@ -240,6 +265,7 @@ def confirm_page_and_section_loaded expect(page).to have_content(COPY::CASE_DISTRIBUTION_BATCH_SIZE_H2_TITLE) expect(page).to have_content(COPY::CASE_DISTRIBUTION_HISTORY_TITLE) expect(page).to have_content(COPY::CASE_DISTRIBUTION_HISTORY_DESCRIPTION) + expect(page).to have_content(COPY::CASE_DISTRIBUTION_STATIC_LEVERS_TITLE) expect(page).to have_content(Constants.DISTRIBUTION.ama_hearing_case_affinity_days_title) expect(page).to have_content(Constants.DISTRIBUTION.ama_hearing_case_aod_affinity_days_title) expect(page).to have_content(Constants.DISTRIBUTION.cavc_affinity_days_title) @@ -254,15 +280,17 @@ def confirm_page_and_section_loaded expect(page).to have_content(Constants.DISTRIBUTION.batch_size_per_attorney_title) expect(page).to have_content(Constants.DISTRIBUTION.request_more_cases_minimum_title) + # From inactive_data_elements_levers_spec.rb + expect(page).to have_content(Constants.DISTRIBUTION.maximum_direct_review_proportion_title) + expect(page).to have_content(Constants.DISTRIBUTION.minimum_legacy_proportion_title) + expect(page).to have_content(Constants.DISTRIBUTION.nod_adjustment_title) + expect(page).to have_content(Constants.DISTRIBUTION.bust_backlog_title) expect(find("##{maximum_direct_review_proportion}-description")).to match_css(".description-styling") expect(find("##{maximum_direct_review_proportion}-product")).to match_css(".value-styling") - expect(find("##{minimum_legacy_proportion}-description")).to match_css(".description-styling") expect(find("##{minimum_legacy_proportion}-product")).to match_css(".value-styling") - expect(find("##{nod_adjustment}-description")).to match_css(".description-styling") expect(find("##{nod_adjustment}-product")).to match_css(".value-styling") - expect(find("##{bust_backlog}-description")).to match_css(".description-styling") expect(find("##{bust_backlog}-product")).to match_css(".value-styling") end From 90db15e002b0a52840412033dc2cc72a422f6cea Mon Sep 17 00:00:00 2001 From: Craig Reese Date: Mon, 15 Jul 2024 14:56:17 -0500 Subject: [PATCH 19/31] remove lever_buttons_spec.rb --- .../acd_levers/lever_buttons_spec.rb | 159 ------------------ .../case_distribution_levers/admin_ui_spec.rb | 52 +++++- 2 files changed, 50 insertions(+), 161 deletions(-) delete mode 100644 spec/feature/automatic_case_distribution/acd_levers/lever_buttons_spec.rb diff --git a/spec/feature/automatic_case_distribution/acd_levers/lever_buttons_spec.rb b/spec/feature/automatic_case_distribution/acd_levers/lever_buttons_spec.rb deleted file mode 100644 index acb15f245e6..00000000000 --- a/spec/feature/automatic_case_distribution/acd_levers/lever_buttons_spec.rb +++ /dev/null @@ -1,159 +0,0 @@ -# frozen_string_literal: true - -RSpec.feature "Case Distribution Controls Page Buttons" do - before { Seeds::CaseDistributionLevers.new.seed! } - - let!(:current_user) do - user = create(:user, css_id: "BVATTWAYNE") - CDAControlGroup.singleton.add_user(user) - User.authenticate!(user: user) - end - - let(:ama_direct_reviews) { Constants.DISTRIBUTION.ama_direct_review_docket_time_goals } - let(:alternate_batch_size) { Constants.DISTRIBUTION.alternative_batch_size } - - let(:ama_direct_reviews_lever) { CaseDistributionLever.find_by_item(ama_direct_reviews) } - let(:alternate_batch_size_lever) { CaseDistributionLever.find_by_item(alternate_batch_size) } - - context "user is a Case Distro Algorithm Control admin" do - let(:ama_direct_reviews_field) { Constants.DISTRIBUTION.ama_direct_review_docket_time_goals } - let(:alternative_batch_size_field) { "#{Constants.DISTRIBUTION.alternative_batch_size}-field" } - - before do - OrganizationsUser.make_user_admin(current_user, CDAControlGroup.singleton) - ama_direct_reviews_lever.value = 100 - alternate_batch_size_lever.value = 10 - ama_direct_reviews_lever.save - alternate_batch_size_lever.save - end - - scenario "visits the lever control page", type: :feature do - visit "case-distribution-controls" - confirm_page_and_section_loaded - expect(page).to have_button("Cancel") - expect(page).to have_button("Save", disabled: true) - end - - scenario "changes a lever and then cancels the change" do - visit "case-distribution-controls" - confirm_page_and_section_loaded - - expect(page).to have_field(ama_direct_reviews_field, with: "100") - - fill_in ama_direct_reviews_field, with: "123" - expect(page).to have_field(ama_direct_reviews_field, with: "123") - - click_cancel_button - expect(page).to have_field(ama_direct_reviews_field, with: "100") - end - - scenario "changes two levers and then cancels the change" do - visit "case-distribution-controls" - confirm_page_and_section_loaded - - expect(page).to have_field(ama_direct_reviews_field, with: "100") - expect(page).to have_field(alternative_batch_size_field, with: "10") - - fill_in ama_direct_reviews_field, with: "123" - fill_in alternative_batch_size_field, with: "12" - expect(page).to have_field(ama_direct_reviews_field, with: "123") - expect(page).to have_field(alternative_batch_size_field, with: "12") - - click_cancel_button - expect(page).to have_field(ama_direct_reviews_field, with: "100") - expect(page).to have_field(alternative_batch_size_field, with: "10") - end - - scenario "changes a lever and then hits save" do - visit "case-distribution-controls" - confirm_page_and_section_loaded - - expect(page).to have_field(ama_direct_reviews_field, with: "100") - - fill_in ama_direct_reviews_field, with: "123" - expect(page).to have_field(ama_direct_reviews_field, with: "123") - - click_save_button - expect(find("#case-distribution-control-modal-table-0")).to have_content("123") - end - - scenario "changes two levers and then hits save" do - visit "case-distribution-controls" - confirm_page_and_section_loaded - - expect(page).to have_field(ama_direct_reviews_field, with: "100") - expect(page).to have_field(alternative_batch_size_field, with: "10") - - fill_in ama_direct_reviews_field, with: "123" - fill_in alternative_batch_size_field, with: "13" - expect(page).to have_field(ama_direct_reviews_field, with: "123") - expect(page).to have_field(alternative_batch_size_field, with: "13") - - click_save_button - expect(find("#case-distribution-control-modal-table-0")).to have_content("13") - expect(find("#case-distribution-control-modal-table-1")).to have_content("123") - end - - scenario "changes two levers and cancels on the modal screen" do - visit "case-distribution-controls" - confirm_page_and_section_loaded - - expect(page).to have_field(ama_direct_reviews_field, with: "100") - expect(page).to have_field(alternative_batch_size_field, with: "10") - - fill_in ama_direct_reviews_field, with: "123" - fill_in alternative_batch_size_field, with: "13" - expect(page).to have_field(ama_direct_reviews_field, with: "123") - expect(page).to have_field(alternative_batch_size_field, with: "13") - - click_save_button - expect(find("#case-distribution-control-modal-table-0")).to have_content("13") - expect(find("#case-distribution-control-modal-table-1")).to have_content("123") - - click_modal_cancel_button - expect(page).to have_field(ama_direct_reviews_field, with: "123") - expect(page).to have_field(alternative_batch_size_field, with: "13") - end - - scenario "changes two levers and confirms on the modal screen" do - visit "case-distribution-controls" - confirm_page_and_section_loaded - - expect(page).to have_field(ama_direct_reviews_field, with: "100") - expect(page).to have_field(alternative_batch_size_field, with: "10") - - fill_in ama_direct_reviews_field, with: "123" - fill_in alternative_batch_size_field, with: "13" - expect(page).to have_field(ama_direct_reviews_field, with: "123") - expect(page).to have_field(alternative_batch_size_field, with: "13") - - click_save_button - expect(find("#case-distribution-control-modal-table-0")).to have_content("13") - expect(find("#case-distribution-control-modal-table-1")).to have_content("123") - - click_modal_confirm_button - expect(page).to have_field(ama_direct_reviews_field, with: "123") - expect(page).to have_field(alternative_batch_size_field, with: "13") - end - end -end - -def confirm_page_and_section_loaded - expect(page).to have_content(COPY::CASE_DISTRIBUTION_TITLE) -end - -def click_cancel_button - find("#CancelLeversButton").click -end - -def click_save_button - find("#LeversSaveButton").click -end - -def click_modal_cancel_button - find("#save-modal-cancel").click -end - -def click_modal_confirm_button - find("#save-modal-confirm").click -end diff --git a/spec/feature/case_distribution_levers/admin_ui_spec.rb b/spec/feature/case_distribution_levers/admin_ui_spec.rb index 7a2af75c539..0b0569a8fb3 100644 --- a/spec/feature/case_distribution_levers/admin_ui_spec.rb +++ b/spec/feature/case_distribution_levers/admin_ui_spec.rb @@ -47,7 +47,7 @@ let(:nod_adjustment) { Constants.DISTRIBUTION.nod_adjustment } let(:bust_backlog) { Constants.DISTRIBUTION.bust_backlog } - let(:ama_direct_reviews_field) { Constants.DISTRIBUTION.ama_direct_review_docket_time_goals } + let(:alternative_batch_size_field) { "#{Constants.DISTRIBUTION.alternative_batch_size}-field" } context "user is in Case Distro Algorithm Control organization but not an admin" do let!(:audit_lever_entry_1) do @@ -77,7 +77,7 @@ end end - it "the lever control page renders correctly", :aggregate_failures do + it "the lever control page renders correctly and has no options to change/save values", :aggregate_failures do step "page renders" do visit "case-distribution-controls" confirm_page_and_section_loaded @@ -193,6 +193,42 @@ expect(find("##{bust_backlog}-value")).to have_content(bust_backlog_value + bust_backlog_lever.unit) end + step "cancelling changes resets values" do + # Capybara locally is not setting clearing the field prior to entering the new value so fill with "" + fill_in ama_direct_reviews_field, with: "" + + # From lever_buttons_spec.rb + fill_in ama_direct_reviews_field, with: "123" + expect(page).to have_field(ama_direct_reviews_field, with: "123") + click_cancel_button + expect(page).to have_field(ama_direct_reviews_field, with: "365") + + fill_in ama_direct_reviews_field, with: "123" + fill_in alternative_batch_size_field, with: "" + fill_in alternative_batch_size_field, with: "12" + expect(page).to have_field(ama_direct_reviews_field, with: "123") + expect(page).to have_field(alternative_batch_size_field, with: "12") + + click_cancel_button + expect(page).to have_field(ama_direct_reviews_field, with: "365") + expect(page).to have_field(alternative_batch_size_field, with: "15") + end + + step "cancelling changes on confirm modal returns user to page without resetting the values in the fields" do + fill_in ama_direct_reviews_field, with: "123" + fill_in alternative_batch_size_field, with: "13" + expect(page).to have_field(ama_direct_reviews_field, with: "123") + expect(page).to have_field(alternative_batch_size_field, with: "13") + + click_save_button + expect(find("#case-distribution-control-modal-table-0")).to have_content("13") + expect(find("#case-distribution-control-modal-table-1")).to have_content("123") + + click_modal_cancel_button + expect(page).to have_field(ama_direct_reviews_field, with: "123") + expect(page).to have_field(alternative_batch_size_field, with: "13") + end + step "error displays for invalid input on time goals section" do # From ama_np_dist_goals_by_docket_lever_spec.rb @@ -210,8 +246,10 @@ expect(find("#lever-history-table").has_no_content?("123 days")).to eq(true) expect(find("#lever-history-table").has_no_content?("300 days")).to eq(true) + # Change two levers at once to satisfy lever_buttons_spec.rb fill_in ama_direct_reviews_field, with: "" fill_in ama_direct_reviews_field, with: "123" + fill_in ama_evidence_submissions_field, with: "456" click_save_button click_modal_confirm_button end @@ -253,6 +291,7 @@ click_modal_confirm_button expect(find("#lever-history-table").has_content?("123 days")).to eq(true) + expect(find("#lever-history-table").has_content?("456 days")).to eq(true) expect(find("#lever-history-table").has_content?("300 days")).to eq(true) end end @@ -260,6 +299,7 @@ # rubocop:disable Metrics/AbcSize def confirm_page_and_section_loaded + expect(page).to have_content(COPY::CASE_DISTRIBUTION_TITLE) expect(page).to have_content(COPY::CASE_DISTRIBUTION_AFFINITY_DAYS_H2_TITLE) expect(page).to have_content(COPY::CASE_DISTRIBUTION_DOCKET_TIME_GOALS_SECTION_TITLE) expect(page).to have_content(COPY::CASE_DISTRIBUTION_BATCH_SIZE_H2_TITLE) @@ -303,4 +343,12 @@ def click_save_button def click_modal_confirm_button find("#save-modal-confirm").click end + + def click_cancel_button + find("#CancelLeversButton").click + end + + def click_modal_cancel_button + find("#save-modal-cancel").click + end end From 77318d0e8000861d4f4e7f6202f5a61bf960c3d5 Mon Sep 17 00:00:00 2001 From: Craig Reese Date: Mon, 15 Jul 2024 16:34:58 -0500 Subject: [PATCH 20/31] refactor --- .../case_distribution_levers/admin_ui_spec.rb | 81 +++---------------- 1 file changed, 9 insertions(+), 72 deletions(-) diff --git a/spec/feature/case_distribution_levers/admin_ui_spec.rb b/spec/feature/case_distribution_levers/admin_ui_spec.rb index 0b0569a8fb3..f9f98d49447 100644 --- a/spec/feature/case_distribution_levers/admin_ui_spec.rb +++ b/spec/feature/case_distribution_levers/admin_ui_spec.rb @@ -80,20 +80,10 @@ it "the lever control page renders correctly and has no options to change/save values", :aggregate_failures do step "page renders" do visit "case-distribution-controls" - confirm_page_and_section_loaded + expect(page).to have_content("Case Distribution Algorithm Values") expect(page).not_to have_button("Cancel") expect(page).not_to have_button("Save") - disabled_lever_list.each do |item| - expect(find("#lever-wrapper-#{item}")).to match_css(".lever-disabled") - expect(find("#affinity-day-label-for-#{item}")).to match_css(".lever-disabled") - end - - enabled_lever_list.each do |item| - expect(find("#lever-wrapper-#{item}")).not_to match_css(".lever-disabled") - expect(find("#affinity-day-label-for-#{item}")).not_to match_css(".lever-disabled") - end - expect(find("##{ama_hearings}-lever-value > span")["data-disabled-in-ui"]).to eq("false") expect(find("##{ama_direct_reviews}-lever-value > span")["data-disabled-in-ui"]).to eq("false") expect(find("##{ama_evidence_submissions}-lever-value > span")["data-disabled-in-ui"]).to eq("false") @@ -136,7 +126,7 @@ it "the lever control page operates correctly" do visit "case-distribution-controls" - confirm_page_and_section_loaded + expect(page).to have_content("Case Distribution Algorithm Values") empty_error_message = "Please enter a value greater than or equal to 0" @@ -170,27 +160,10 @@ step "inactive levers are displayed with values" do # From inactive_data_elements_levers_spec.rb - maximum_direct_review_proportion_lever = CaseDistributionLever.find_by_item(maximum_direct_review_proportion) - minimum_legacy_proportion_lever = CaseDistributionLever.find_by_item(minimum_legacy_proportion) - nod_adjustment_lever = CaseDistributionLever.find_by_item(nod_adjustment) - bust_backlog_lever = CaseDistributionLever.find_by_item(bust_backlog) - - converted_maximum_direct_review_proportion_value = - (maximum_direct_review_proportion_lever.value.to_f * 100).to_i.to_s - converted_minimum_legacy_proportion_value = (minimum_legacy_proportion_lever.value.to_f * 100).to_i.to_s - converted_nod_adjustment_value = (nod_adjustment_lever.value.to_f * 100).to_i.to_s - bust_backlog_value = bust_backlog_lever.value.humanize - - expect(find("##{maximum_direct_review_proportion}-value")).to have_content( - converted_maximum_direct_review_proportion_value + maximum_direct_review_proportion_lever.unit - ) - expect(find("##{minimum_legacy_proportion}-value")).to have_content( - converted_minimum_legacy_proportion_value + minimum_legacy_proportion_lever.unit - ) - expect(find("##{nod_adjustment}-value")).to have_content( - converted_nod_adjustment_value + nod_adjustment_lever.unit - ) - expect(find("##{bust_backlog}-value")).to have_content(bust_backlog_value + bust_backlog_lever.unit) + expect(find("##{maximum_direct_review_proportion}-value")).to have_content("7%") + expect(find("##{minimum_legacy_proportion}-value")).to have_content("90%") + expect(find("##{nod_adjustment}-value")).to have_content("40%") + expect(find("##{bust_backlog}-value")).to have_content("True") end step "cancelling changes resets values" do @@ -290,6 +263,9 @@ click_save_button click_modal_confirm_button + # Refresh page to validate back end saved the levers correctly + visit "case-distribution-controls" + expect(find("#lever-history-table").has_content?("123 days")).to eq(true) expect(find("#lever-history-table").has_content?("456 days")).to eq(true) expect(find("#lever-history-table").has_content?("300 days")).to eq(true) @@ -297,45 +273,6 @@ end end - # rubocop:disable Metrics/AbcSize - def confirm_page_and_section_loaded - expect(page).to have_content(COPY::CASE_DISTRIBUTION_TITLE) - expect(page).to have_content(COPY::CASE_DISTRIBUTION_AFFINITY_DAYS_H2_TITLE) - expect(page).to have_content(COPY::CASE_DISTRIBUTION_DOCKET_TIME_GOALS_SECTION_TITLE) - expect(page).to have_content(COPY::CASE_DISTRIBUTION_BATCH_SIZE_H2_TITLE) - expect(page).to have_content(COPY::CASE_DISTRIBUTION_HISTORY_TITLE) - expect(page).to have_content(COPY::CASE_DISTRIBUTION_HISTORY_DESCRIPTION) - expect(page).to have_content(COPY::CASE_DISTRIBUTION_STATIC_LEVERS_TITLE) - expect(page).to have_content(Constants.DISTRIBUTION.ama_hearing_case_affinity_days_title) - expect(page).to have_content(Constants.DISTRIBUTION.ama_hearing_case_aod_affinity_days_title) - expect(page).to have_content(Constants.DISTRIBUTION.cavc_affinity_days_title) - expect(page).to have_content(Constants.DISTRIBUTION.cavc_aod_affinity_days_title) - expect(page).to have_content(Constants.DISTRIBUTION.aoj_affinity_days_title) - expect(page).to have_content(Constants.DISTRIBUTION.aoj_aod_affinity_days_title) - expect(page).to have_content(Constants.DISTRIBUTION.aoj_cavc_affinity_days_title) - expect(page).to have_content(Constants.DISTRIBUTION.ama_hearings_section_title) - expect(page).to have_content(Constants.DISTRIBUTION.ama_direct_review_section_title) - expect(page).to have_content(Constants.DISTRIBUTION.ama_evidence_submission_section_title) - expect(page).to have_content(Constants.DISTRIBUTION.alternative_batch_size_title) - expect(page).to have_content(Constants.DISTRIBUTION.batch_size_per_attorney_title) - expect(page).to have_content(Constants.DISTRIBUTION.request_more_cases_minimum_title) - - # From inactive_data_elements_levers_spec.rb - expect(page).to have_content(Constants.DISTRIBUTION.maximum_direct_review_proportion_title) - expect(page).to have_content(Constants.DISTRIBUTION.minimum_legacy_proportion_title) - expect(page).to have_content(Constants.DISTRIBUTION.nod_adjustment_title) - expect(page).to have_content(Constants.DISTRIBUTION.bust_backlog_title) - expect(find("##{maximum_direct_review_proportion}-description")).to match_css(".description-styling") - expect(find("##{maximum_direct_review_proportion}-product")).to match_css(".value-styling") - expect(find("##{minimum_legacy_proportion}-description")).to match_css(".description-styling") - expect(find("##{minimum_legacy_proportion}-product")).to match_css(".value-styling") - expect(find("##{nod_adjustment}-description")).to match_css(".description-styling") - expect(find("##{nod_adjustment}-product")).to match_css(".value-styling") - expect(find("##{bust_backlog}-description")).to match_css(".description-styling") - expect(find("##{bust_backlog}-product")).to match_css(".value-styling") - end - # rubocop:enable Metrics/AbcSize - def click_save_button find("#LeversSaveButton").click end From 58360d2ac78db67995c40c377d244dbcbaa19ce7 Mon Sep 17 00:00:00 2001 From: Craig Reese Date: Tue, 16 Jul 2024 08:58:04 -0500 Subject: [PATCH 21/31] move jest file for convention, add snapshot --- .../{pages => }/CaseDistributionApp.test.js | 37 +- .../CaseDistributionApp.test.js.snap | 1243 +++++++++++++++++ 2 files changed, 1274 insertions(+), 6 deletions(-) rename client/test/app/caseDistribution/{pages => }/CaseDistributionApp.test.js (55%) create mode 100644 client/test/app/caseDistribution/__snapshots__/CaseDistributionApp.test.js.snap diff --git a/client/test/app/caseDistribution/pages/CaseDistributionApp.test.js b/client/test/app/caseDistribution/CaseDistributionApp.test.js similarity index 55% rename from client/test/app/caseDistribution/pages/CaseDistributionApp.test.js rename to client/test/app/caseDistribution/CaseDistributionApp.test.js index 6eff989b4ab..9a6e8ac853f 100644 --- a/client/test/app/caseDistribution/pages/CaseDistributionApp.test.js +++ b/client/test/app/caseDistribution/CaseDistributionApp.test.js @@ -1,10 +1,19 @@ import React from 'react'; import CaseDistributionApp from 'app/caseDistribution/pages/CaseDistributionApp'; +import { + history as leverHistory, + mockAffinityDaysLevers, + mockBatchLevers, + mockDocketDistributionPriorLevers, + mockDocketTimeGoalsLevers, + mockStaticLevers +} from '../../data/adminCaseDistributionLevers'; import { Provider } from 'react-redux'; import { createStore, applyMiddleware } from 'redux'; import rootReducer from 'app/caseDistribution/reducers/root'; import thunk from 'redux-thunk'; import { mount } from 'enzyme'; +import { render } from '@testing-library/react'; describe('render Case Distribution Application', () => { @@ -13,11 +22,11 @@ describe('render Case Distribution Application', () => { applyMiddleware(thunk)); let testLevers = { - static: [], - batch: [], - affinity: [], - docket_distribution_prior: [], - docket_time_goal: [] + static: mockStaticLevers, + batch: mockBatchLevers, + affinity: mockAffinityDaysLevers, + docket_distribution_prior: mockDocketDistributionPriorLevers, + docket_time_goal: mockDocketTimeGoalsLevers }; afterEach(() => { @@ -32,7 +41,7 @@ describe('render Case Distribution Application', () => { @@ -45,5 +54,21 @@ describe('render Case Distribution Application', () => { expect(wrapper.find('.lever-content').exists()).toBeTruthy(); }); + it('matches snapshot', () => { + const store = getStore(); + + const { container } = render( + + + + ); + + expect(container).toMatchSnapshot(); + }); }); diff --git a/client/test/app/caseDistribution/__snapshots__/CaseDistributionApp.test.js.snap b/client/test/app/caseDistribution/__snapshots__/CaseDistributionApp.test.js.snap new file mode 100644 index 00000000000..66ac32d5d7f --- /dev/null +++ b/client/test/app/caseDistribution/__snapshots__/CaseDistributionApp.test.js.snap @@ -0,0 +1,1243 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`render Case Distribution Application matches snapshot 1`] = ` +
+
+
+
+

+ Administration +

+
+ +

+ Case Distribution Algorithm Values +

+

+ The Case Distribution Algorithm determines how cases are assigned to VLJs and their teams. Current algorithm is "Docket Date." +

+
+ +

+ + Active Data Elements + +

+
+

+ You may make changes to the Case Distribution algorithm values based on the data elements below. Changes will be applied to the next case distribution event unless subsequent confirmed changes are made to the same variable. +

+
+

+ Excluding Appeals by Docket Type and Priority from Automatic Case Distribution +

+

+ For both Non-priority and Priority cases, you may use the sliders to turn on or off all options for each row. When you turn off a slider, all items in that row will be automatically deselected and visa versa. ​Additionally, If you wish to select only some options in a row or column, the slider will automatically turn off. You can make individual selections for that row or column at any point. +

+

+ Selected docket type/priority combination options will be excluded from automatic case distribution beginning with the next distribution. +

+
+
+ + + + + + + + + + + + + + + + + +
+ Legacy Appeals + + AMA Hearings Appeals + + AMA Direct Review Appeals + + AMA Evidence Submission Appeals +
+ +

+ All Non-priority +

+ +
+
+ +

+ All Priority +

+ +
+
+
+
+
+

+ Batch Size +

+
+ + Data Elements + +
+
+ + Value + +
+
+
+
+ + Test Title Lever* + * + +

+ Test Description for Lever data outOfBoundsBatchLever. +

+
+
+
+
+ + +
+ +
+
+
+
+
+
+
+ + Test Title Lever2* + * + +

+ Test Description for Lever data disabled-in-ui. +

+
+
+
+
+ + +
+ +
+
+
+
+
+
+
+ + Test Text Title Lever3 + * + +

+ Test Description for Lever data type text +

+
+
+
+
+ + +
+ +
+
+
+
+
+ +
+
+
+
+

+ Affinity Days +

+
+ + Data Elements + +
+
+ + Value + +
+
+
+
+ + AMA Hearing Case Affinity Days + + +

+ For non-priority AMA Hearing cases, sets the number of days an AMA Hearing Case is tied to the judge that held the hearing. +

+
+
+
+
+ + +
+
+
+
+
+ + +
+ +
+
+
+
+
+
+
+
+ + +
+
+
+
+
+
+
+ + +
+
+
+
+
+
+
+
+
+ + AMA Hearing Case AOD Affinity Days + + +

+ Sets the number of days an AMA Hearing appeal that is also AOD will respect the affinity to the most-recent hearing judge before distributing the appeal to any available judge. +

+
+
+
+
+ + +
+
+
+
+ +
+ +
+
+
+
+
+
+
+ + +
+
+
+
+
+
+
+ + +
+
+
+
+
+
+
+ +
+
+
+
+

+ AMA Non-priority Distribution Goals by Docket +

+

+ + Docket Time Goal + + set the completion target for AMA non-priority appeals by docket type. It represents the number of calendar days that are added to the receipt date of the appeal to establish the decision target date. +

+

+ + Start Distribution Prior to Docket Time Goal + + days sets the number of calendar days prior to the Docket Time Goal for that docket type when appeals become eligible for distribution. +

+

+ Please note, if turned on, non-priority appeals of that docket type will not be distributed until eligible, which may disrupt strict docket-date-order distribution across dockets. +

+
+
+ +
+
+ + Docket Time Goal + +
+
+ + Start Distribution Prior to Docket Time Goal + +
+
+
+
+
+ + AMA Hearings + +
+
+
+
+ + +
+ +
+
+
+
+
+ +
+
+
+ + +
+ +
+
+
+
+
+
+
+
+ + AMA Direct Review + +
+
+
+
+ + +
+ +
+
+
+
+
+ +
+
+
+ + +
+ +
+
+
+
+
+
+
+
+
+ + + +
+
+ + + +
+
+
+
+
+
+ +

+ + Inactive Data Elements + +

+
+

+ The below values do not effect the current active Case Distribution algorithm. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Data Elements + + Values +
+ Maximum Direct Review Proportion +
+ Sets the maximum number of direct reviews in relation to due direct review proportion to prevent a complete halt to work on other dockets should demand for direct reviews approach the Board's capacity. + + + 80 + + % + + +
+ Minimum Legacy Proportion +
+ Sets the minimum proportion of legacy appeals that will be distributed. + + + 20 + + % + + +
+ NOD Adjustment +
+ Applied for docket balancing reflecting the likelihood that NODs will advance to a Form 9. + + + 90 + + % + + +
+ Priority Bust Backlog +
+ Distribute legacy cases tied to a judge to the Board-provided limit of 30, regardless of the legacy docket range. + + + True + + +
+
+
+
+

+ + Case Distribution Algorithm Change History + +

+
+

+ Change history for Case Distribution Admin shows changes made in the last 365 days. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ Date of Last Change + + User ID + + Data Element Changed + + Previous Value + + Updated Value +
+ Sat, Jul 1, 2023 12:10:01 + + +
    +
  1. +
+
+
    +
  1. + undefined +
  2. +
+
+
    +
  1. + undefined +
  2. +
+
+ Sat, Jul 1, 2023 10:10:01 + + +
    +
  1. +
  2. +
+
+
    +
  1. + undefined +
  2. +
  3. + undefined +
  4. +
+
+
    +
  1. + undefined +
  2. +
  3. + undefined +
  4. +
+
+
+
+
+
+
+
+
+
+`; From 41c9e6e82eb72dfeab203751699eaca14bc58e24 Mon Sep 17 00:00:00 2001 From: Craig Reese Date: Tue, 16 Jul 2024 09:35:04 -0500 Subject: [PATCH 22/31] move test for admin ui not interactable for non-admins to a jest test --- .../CaseDistributionApp.test.js | 29 +++++++- .../case_distribution_levers/admin_ui_spec.rb | 70 ------------------- 2 files changed, 28 insertions(+), 71 deletions(-) diff --git a/client/test/app/caseDistribution/CaseDistributionApp.test.js b/client/test/app/caseDistribution/CaseDistributionApp.test.js index 9a6e8ac853f..ab90b61d585 100644 --- a/client/test/app/caseDistribution/CaseDistributionApp.test.js +++ b/client/test/app/caseDistribution/CaseDistributionApp.test.js @@ -33,7 +33,7 @@ describe('render Case Distribution Application', () => { jest.clearAllMocks(); }); - it('renders Case Distribution App', () => { + it('renders Case Distribution App as editable for an admin', () => { const store = getStore(); let wrapper = mount( @@ -52,6 +52,33 @@ describe('render Case Distribution Application', () => { expect(wrapper.find('#lever-history-table').exists()).toBeTruthy(); expect(wrapper.find('.inactive-data-content').exists()).toBeTruthy(); expect(wrapper.find('.lever-content').exists()).toBeTruthy(); + // the buttons and inputs will only render for admin users + expect(wrapper.find('button').exists()).toBe(true); + expect(wrapper.find('input').length > 0).toBe(true); + }); + + it('renders Case Distribution App as read-only for a non admin', () => { + const store = getStore(); + + let wrapper = mount( + + + + ); + + wrapper.update(); + + expect(wrapper.find('#lever-history-table').exists()).toBeTruthy(); + expect(wrapper.find('.inactive-data-content').exists()).toBeTruthy(); + expect(wrapper.find('.lever-content').exists()).toBeTruthy(); + // the buttons and inputs will only render for admin users + expect(wrapper.find('button').exists()).toBe(false); + expect(wrapper.find('input').length === 0).toBe(true); }); it('matches snapshot', () => { diff --git a/spec/feature/case_distribution_levers/admin_ui_spec.rb b/spec/feature/case_distribution_levers/admin_ui_spec.rb index f9f98d49447..b3e4628e12b 100644 --- a/spec/feature/case_distribution_levers/admin_ui_spec.rb +++ b/spec/feature/case_distribution_levers/admin_ui_spec.rb @@ -49,76 +49,6 @@ let(:alternative_batch_size_field) { "#{Constants.DISTRIBUTION.alternative_batch_size}-field" } - context "user is in Case Distro Algorithm Control organization but not an admin" do - let!(:audit_lever_entry_1) do - create(:case_distribution_audit_lever_entry, - case_distribution_lever: ama_direct_reviews_lever, - previous_value: 10, - update_value: 15, - created_at: 5.days.ago) - end - let!(:audit_lever_entry_2) do - create(:case_distribution_audit_lever_entry, - case_distribution_lever: alternate_batch_size_lever, - previous_value: 7, - update_value: 6, - created_at: 4.days.ago) - end - let!(:audit_lever_entry_3) do - Timecop.travel(3.days.ago) do - create(:case_distribution_audit_lever_entry, - case_distribution_lever: ama_direct_reviews_lever, - previous_value: 15, - update_value: 5) - create(:case_distribution_audit_lever_entry, - case_distribution_lever: alternate_batch_size_lever, - previous_value: 2, - update_value: 4) - end - end - - it "the lever control page renders correctly and has no options to change/save values", :aggregate_failures do - step "page renders" do - visit "case-distribution-controls" - expect(page).to have_content("Case Distribution Algorithm Values") - expect(page).not_to have_button("Cancel") - expect(page).not_to have_button("Save") - - expect(find("##{ama_hearings}-lever-value > span")["data-disabled-in-ui"]).to eq("false") - expect(find("##{ama_direct_reviews}-lever-value > span")["data-disabled-in-ui"]).to eq("false") - expect(find("##{ama_evidence_submissions}-lever-value > span")["data-disabled-in-ui"]).to eq("false") - - expect(find("##{ama_hearings}-lever-toggle > div > span")["data-disabled-in-ui"]).to eq("false") - expect(find("##{ama_direct_reviews}-lever-toggle > div > span")["data-disabled-in-ui"]).to eq("false") - expect(find("##{ama_evidence_submissions}-lever-toggle > div > span")["data-disabled-in-ui"]).to eq("false") - - expect(find("##{alternate_batch_size} > label")).to match_css(".lever-active") - expect(find("##{batch_size_per_attorney} > label")).to match_css(".lever-active") - expect(find("##{request_more_cases_minimum} > label")).to match_css(".lever-active") - end - - step "lever history displays correctly" do - expect(find("#lever-history-table-row-0")).to have_content(current_user.css_id) - expect(find("#lever-history-table-row-0")).to have_content(alternate_batch_size_lever.title) - expect(find("#lever-history-table-row-0")).to have_content("2 #{alternate_batch_size_lever.unit}") - expect(find("#lever-history-table-row-0")).to have_content("4 #{alternate_batch_size_lever.unit}") - expect(find("#lever-history-table-row-0")).to have_content(ama_direct_reviews_lever.title) - expect(find("#lever-history-table-row-0")).to have_content("15 #{ama_direct_reviews_lever.unit}") - expect(find("#lever-history-table-row-0")).to have_content("5 #{ama_direct_reviews_lever.unit}") - - expect(find("#lever-history-table-row-1")).to have_content(current_user.css_id) - expect(find("#lever-history-table-row-1")).to have_content(alternate_batch_size_lever.title) - expect(find("#lever-history-table-row-1")).to have_content("7 #{alternate_batch_size_lever.unit}") - expect(find("#lever-history-table-row-1")).to have_content("6 #{alternate_batch_size_lever.unit}") - - expect(find("#lever-history-table-row-2")).to have_content(current_user.css_id) - expect(find("#lever-history-table-row-2")).to have_content(ama_direct_reviews_lever.title) - expect(find("#lever-history-table-row-2")).to have_content("10 #{ama_direct_reviews_lever.unit}") - expect(find("#lever-history-table-row-2")).to have_content("15 #{ama_direct_reviews_lever.unit}") - end - end - end - context "user is a Case Distro Algorithm Control admin" do before do OrganizationsUser.make_user_admin(current_user, CDAControlGroup.singleton) From 817b38c79179b6d7f96f0d5a4850bb4b79094782 Mon Sep 17 00:00:00 2001 From: Craig Reese Date: Tue, 16 Jul 2024 09:49:37 -0500 Subject: [PATCH 23/31] remove unnecessary comments, whitespace --- .../case_distribution_levers/admin_ui_spec.rb | 27 +++++++------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/spec/feature/case_distribution_levers/admin_ui_spec.rb b/spec/feature/case_distribution_levers/admin_ui_spec.rb index b3e4628e12b..d47573b242c 100644 --- a/spec/feature/case_distribution_levers/admin_ui_spec.rb +++ b/spec/feature/case_distribution_levers/admin_ui_spec.rb @@ -58,7 +58,7 @@ visit "case-distribution-controls" expect(page).to have_content("Case Distribution Algorithm Values") - empty_error_message = "Please enter a value greater than or equal to 0" + EMPTY_ERROR_MESSAGE = "Please enter a value greater than or equal to 0" step "enabled and disabled levers display correctly" do # From affinity_days_levers_spec.rb @@ -77,8 +77,7 @@ end end - step "levers initally display correctly" do - # From ama_np_dist_goals_by_docket_lever_spec.rb + step "levers initally are enabled and display correctly" do expect(page).to have_field(ama_hearings_field.to_s, disabled: false) expect(page).to have_field(ama_direct_reviews_field.to_s) expect(page).to have_field(ama_evidence_submissions_field.to_s, disabled: false) @@ -89,18 +88,16 @@ end step "inactive levers are displayed with values" do - # From inactive_data_elements_levers_spec.rb expect(find("##{maximum_direct_review_proportion}-value")).to have_content("7%") expect(find("##{minimum_legacy_proportion}-value")).to have_content("90%") expect(find("##{nod_adjustment}-value")).to have_content("40%") expect(find("##{bust_backlog}-value")).to have_content("True") end - step "cancelling changes resets values" do + step "cancelling lever changes resets values" do # Capybara locally is not setting clearing the field prior to entering the new value so fill with "" fill_in ama_direct_reviews_field, with: "" - # From lever_buttons_spec.rb fill_in ama_direct_reviews_field, with: "123" expect(page).to have_field(ama_direct_reviews_field, with: "123") click_cancel_button @@ -133,23 +130,20 @@ end step "error displays for invalid input on time goals section" do - # From ama_np_dist_goals_by_docket_lever_spec.rb - fill_in ama_direct_reviews_field, with: "ABC" expect(page).to have_field(ama_direct_reviews_field, with: "") - expect(find("##{ama_direct_reviews_field}-lever")).to have_content(empty_error_message) + expect(find("##{ama_direct_reviews_field}-lever")).to have_content(EMPTY_ERROR_MESSAGE) fill_in ama_direct_reviews_field, with: "-1" expect(page).to have_field(ama_direct_reviews_field, with: "1") - expect(find("##{ama_direct_reviews_field}-lever").has_no_content?(empty_error_message)).to eq(true) + expect(find("##{ama_direct_reviews_field}-lever").has_no_content?(EMPTY_ERROR_MESSAGE)).to eq(true) end step "time goals section error clears with valid input" do - # From ../acd_audit_history/audit_lever_history_table_spec.rb expect(find("#lever-history-table").has_no_content?("123 days")).to eq(true) expect(find("#lever-history-table").has_no_content?("300 days")).to eq(true) - # Change two levers at once to satisfy lever_buttons_spec.rb + # Change two levers at once to satisfy a previously separate test fill_in ama_direct_reviews_field, with: "" fill_in ama_direct_reviews_field, with: "123" fill_in ama_evidence_submissions_field, with: "456" @@ -158,7 +152,6 @@ end step "batch size lever section errors display with invalid inputs" do - # From batch_size_levers_spec.rb expect(page).to have_field("#{alternate_batch_size}-field", readonly: false) expect(page).to have_field("#{batch_size_per_attorney}-field", readonly: false) expect(page).to have_field("#{request_more_cases_minimum}-field", readonly: false) @@ -171,21 +164,19 @@ expect(page).to have_field("#{batch_size_per_attorney}-field", with: "1") expect(page).to have_field("#{request_more_cases_minimum}-field", with: "") - expect(find("##{alternate_batch_size} > div > div > span")).to have_content(empty_error_message) - expect(find("##{request_more_cases_minimum} > div > div > span")).to have_content(empty_error_message) + expect(find("##{alternate_batch_size} > div > div > span")).to have_content(EMPTY_ERROR_MESSAGE) + expect(find("##{request_more_cases_minimum} > div > div > span")).to have_content(EMPTY_ERROR_MESSAGE) end step "batch size lever section errors clear with valid inputs" do - # From batch_size_levers_spec.rb fill_in "#{alternate_batch_size}-field", with: "42" fill_in "#{batch_size_per_attorney}-field", with: "32" fill_in "#{request_more_cases_minimum}-field", with: "25" - expect(page).not_to have_content(empty_error_message) + expect(page).not_to have_content(EMPTY_ERROR_MESSAGE) end step "lever history displays on page" do - # From ../acd_audit_history/audit_lever_history_table_spec.rb expect(find("#lever-history-table").has_content?("123 days")).to eq(true) expect(find("#lever-history-table").has_no_content?("300 days")).to eq(true) From 49a45af07d4259cc59d1e31151feb38647dd3800 Mon Sep 17 00:00:00 2001 From: Craig Reese Date: Fri, 19 Jul 2024 07:14:21 -0500 Subject: [PATCH 24/31] restore jest folder structure --- .../caseDistribution/{ => pages}/CaseDistributionApp.test.js | 2 +- .../{ => pages}/__snapshots__/CaseDistributionApp.test.js.snap | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename client/test/app/caseDistribution/{ => pages}/CaseDistributionApp.test.js (98%) rename client/test/app/caseDistribution/{ => pages}/__snapshots__/CaseDistributionApp.test.js.snap (100%) diff --git a/client/test/app/caseDistribution/CaseDistributionApp.test.js b/client/test/app/caseDistribution/pages/CaseDistributionApp.test.js similarity index 98% rename from client/test/app/caseDistribution/CaseDistributionApp.test.js rename to client/test/app/caseDistribution/pages/CaseDistributionApp.test.js index ab90b61d585..7e14759f438 100644 --- a/client/test/app/caseDistribution/CaseDistributionApp.test.js +++ b/client/test/app/caseDistribution/pages/CaseDistributionApp.test.js @@ -7,7 +7,7 @@ import { mockDocketDistributionPriorLevers, mockDocketTimeGoalsLevers, mockStaticLevers -} from '../../data/adminCaseDistributionLevers'; +} from '../../../data/adminCaseDistributionLevers'; import { Provider } from 'react-redux'; import { createStore, applyMiddleware } from 'redux'; import rootReducer from 'app/caseDistribution/reducers/root'; diff --git a/client/test/app/caseDistribution/__snapshots__/CaseDistributionApp.test.js.snap b/client/test/app/caseDistribution/pages/__snapshots__/CaseDistributionApp.test.js.snap similarity index 100% rename from client/test/app/caseDistribution/__snapshots__/CaseDistributionApp.test.js.snap rename to client/test/app/caseDistribution/pages/__snapshots__/CaseDistributionApp.test.js.snap From 8b51f90ad800ea7eecd12c66f29ec1030681b95f Mon Sep 17 00:00:00 2001 From: Craig Reese Date: Fri, 19 Jul 2024 08:00:46 -0500 Subject: [PATCH 25/31] modify edit spec to use case details page instead of searching again --- spec/feature/intake/appeal/edit_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/feature/intake/appeal/edit_spec.rb b/spec/feature/intake/appeal/edit_spec.rb index 9ce57d8b352..e8fa74a765c 100644 --- a/spec/feature/intake/appeal/edit_spec.rb +++ b/spec/feature/intake/appeal/edit_spec.rb @@ -974,7 +974,7 @@ def go_to_queue_edit_issues_page_with_legacy_appeal(legacy_appeal) end step "can remove MST/PACT issues" do - go_to_queue_edit_issues_page_with_legacy_appeal(legacy_appeal_mst_pact_unchecked) + click_on "Correct issues" click_edit_intake_issue_dropdown_by_number(1) uncheck("Military Sexual Trauma (MST)", allow_label_click: true, visible: false) find(:xpath, "//label[@for='PACT Act']").click(allow_label_click: true, visible: false) @@ -986,7 +986,7 @@ def go_to_queue_edit_issues_page_with_legacy_appeal(legacy_appeal) end step "can add and remove only PACT to an issue" do - go_to_queue_edit_issues_page_with_legacy_appeal(legacy_appeal_mst_pact_unchecked) + click_on "Correct issues" click_edit_intake_issue_dropdown_by_number(1) find(:xpath, "//label[@for='PACT Act']").click(allow_label_click: true, visible: false) click_on "Save" @@ -1004,7 +1004,7 @@ def go_to_queue_edit_issues_page_with_legacy_appeal(legacy_appeal) end step "can add and remove only MST to an issue" do - go_to_queue_edit_issues_page_with_legacy_appeal(legacy_appeal_mst_pact_unchecked) + click_on "Correct issues" click_edit_intake_issue_dropdown_by_number(1) check("Military Sexual Trauma (MST)", allow_label_click: true, visible: false) click_on "Save" From f56e257419053296ed28afd4d14e3b1648fea74f Mon Sep 17 00:00:00 2001 From: Craig Reese Date: Fri, 19 Jul 2024 08:46:18 -0500 Subject: [PATCH 26/31] modify assertions --- spec/feature/case_distribution_levers/admin_ui_spec.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/feature/case_distribution_levers/admin_ui_spec.rb b/spec/feature/case_distribution_levers/admin_ui_spec.rb index d47573b242c..80f48daa933 100644 --- a/spec/feature/case_distribution_levers/admin_ui_spec.rb +++ b/spec/feature/case_distribution_levers/admin_ui_spec.rb @@ -177,8 +177,8 @@ end step "lever history displays on page" do - expect(find("#lever-history-table").has_content?("123 days")).to eq(true) - expect(find("#lever-history-table").has_no_content?("300 days")).to eq(true) + expect(page).to have_content("123 days") + expect(page).to have_no_content("300 days") fill_in ama_direct_reviews_field, with: "300" click_save_button @@ -187,9 +187,9 @@ # Refresh page to validate back end saved the levers correctly visit "case-distribution-controls" - expect(find("#lever-history-table").has_content?("123 days")).to eq(true) - expect(find("#lever-history-table").has_content?("456 days")).to eq(true) - expect(find("#lever-history-table").has_content?("300 days")).to eq(true) + expect(page).to have_content("123 days") + expect(page).to have_content("456 days") + expect(page).to have_content("300 days") end end end From 55664283780270936f31183f0bcb7db6ea32e683 Mon Sep 17 00:00:00 2001 From: Craig Reese Date: Fri, 19 Jul 2024 09:15:27 -0500 Subject: [PATCH 27/31] remove TODO comment --- spec/feature/case_distribution_levers/admin_ui_spec.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/feature/case_distribution_levers/admin_ui_spec.rb b/spec/feature/case_distribution_levers/admin_ui_spec.rb index 80f48daa933..4c88e5f6727 100644 --- a/spec/feature/case_distribution_levers/admin_ui_spec.rb +++ b/spec/feature/case_distribution_levers/admin_ui_spec.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true RSpec.feature "Admin UI" do - # TODO: break this out if possible before { Seeds::CaseDistributionLevers.new.seed! } let!(:current_user) do From d26ac7b3493eff303534c0b2efce56d28aa9dedb Mon Sep 17 00:00:00 2001 From: Craig Reese Date: Fri, 19 Jul 2024 09:22:28 -0500 Subject: [PATCH 28/31] add assertion to allow async save actions to be executed --- spec/feature/case_distribution_levers/admin_ui_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/feature/case_distribution_levers/admin_ui_spec.rb b/spec/feature/case_distribution_levers/admin_ui_spec.rb index 4c88e5f6727..3e4ce5d0e5c 100644 --- a/spec/feature/case_distribution_levers/admin_ui_spec.rb +++ b/spec/feature/case_distribution_levers/admin_ui_spec.rb @@ -182,6 +182,7 @@ fill_in ama_direct_reviews_field, with: "300" click_save_button click_modal_confirm_button + expect(page).to have_content(COPY::CASE_DISTRIBUTION_SUCCESS_BANNER_TITLE) # Refresh page to validate back end saved the levers correctly visit "case-distribution-controls" From 77795a6e5307a0e3e7beb3a8fd735387916a8449 Mon Sep 17 00:00:00 2001 From: Craig Reese Date: Fri, 19 Jul 2024 10:04:19 -0500 Subject: [PATCH 29/31] add check to ensure banner is gone before trying to save --- spec/feature/case_distribution_levers/admin_ui_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/feature/case_distribution_levers/admin_ui_spec.rb b/spec/feature/case_distribution_levers/admin_ui_spec.rb index 3e4ce5d0e5c..ee271ece0c2 100644 --- a/spec/feature/case_distribution_levers/admin_ui_spec.rb +++ b/spec/feature/case_distribution_levers/admin_ui_spec.rb @@ -180,6 +180,7 @@ expect(page).to have_no_content("300 days") fill_in ama_direct_reviews_field, with: "300" + expect(page).to have_no_content(COPY::CASE_DISTRIBUTION_SUCCESS_BANNER_TITLE) click_save_button click_modal_confirm_button expect(page).to have_content(COPY::CASE_DISTRIBUTION_SUCCESS_BANNER_TITLE) From 90c207b96fbf4c343511f7cb69fca7979906fb46 Mon Sep 17 00:00:00 2001 From: Craig Reese Date: Fri, 19 Jul 2024 10:49:21 -0500 Subject: [PATCH 30/31] refactor assertions for lever history display --- .../case_distribution_levers/admin_ui_spec.rb | 28 +++++++------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/spec/feature/case_distribution_levers/admin_ui_spec.rb b/spec/feature/case_distribution_levers/admin_ui_spec.rb index ee271ece0c2..a52390941d7 100644 --- a/spec/feature/case_distribution_levers/admin_ui_spec.rb +++ b/spec/feature/case_distribution_levers/admin_ui_spec.rb @@ -148,6 +148,16 @@ fill_in ama_evidence_submissions_field, with: "456" click_save_button click_modal_confirm_button + expect(page).to have_content(COPY::CASE_DISTRIBUTION_SUCCESS_BANNER_TITLE) + end + + step "lever history displays on page" do + expect(page.find("#lever-history-table").has_content?("15 cases")).to be true + expect(page.find("#lever-history-table").has_content?("365 days")).to be true + expect(page.find("#lever-history-table").has_content?("550 days")).to be true + expect(page.find("#lever-history-table").has_content?("13 cases")).to be true + expect(page.find("#lever-history-table").has_content?("123 days")).to be true + expect(page.find("#lever-history-table").has_content?("456 days")).to be true end step "batch size lever section errors display with invalid inputs" do @@ -174,24 +184,6 @@ expect(page).not_to have_content(EMPTY_ERROR_MESSAGE) end - - step "lever history displays on page" do - expect(page).to have_content("123 days") - expect(page).to have_no_content("300 days") - - fill_in ama_direct_reviews_field, with: "300" - expect(page).to have_no_content(COPY::CASE_DISTRIBUTION_SUCCESS_BANNER_TITLE) - click_save_button - click_modal_confirm_button - expect(page).to have_content(COPY::CASE_DISTRIBUTION_SUCCESS_BANNER_TITLE) - - # Refresh page to validate back end saved the levers correctly - visit "case-distribution-controls" - - expect(page).to have_content("123 days") - expect(page).to have_content("456 days") - expect(page).to have_content("300 days") - end end end From 028889edb4e24d9c90129fd7c7a892eecba54bf6 Mon Sep 17 00:00:00 2001 From: Craig Reese Date: Wed, 24 Jul 2024 11:31:10 -0500 Subject: [PATCH 31/31] fix failing dependency report tests --- .../dependencies_report_service_log_job_spec.rb | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/spec/jobs/dependencies_report_service_log_job_spec.rb b/spec/jobs/dependencies_report_service_log_job_spec.rb index 9a72fdd9ee0..dee57e5dd62 100644 --- a/spec/jobs/dependencies_report_service_log_job_spec.rb +++ b/spec/jobs/dependencies_report_service_log_job_spec.rb @@ -1,21 +1,6 @@ # frozen_string_literal: true describe DependenciesReportServiceLogJob do - DEPENDENCIES_REPORT_WITH_OUTAGES = <<-'EOF'.strip_heredoc.freeze - { - "BGS":{"name":"BGS","up_rate_5":100.0}, - "VACOLS":{"name":"VACOLS","up_rate_5":10.0}, - "VBMS":{"name":"VBMS","up_rate_5":49.0}, - "VBMS.FindDocumentVersionReference":{"name":"VBMS.FindDocumentVersionReference", - "up_rate_5":100.0} - } - EOF - DEPENDENCIES_REPORT_WITH_INVALID_DATA = <<-'EOF'.strip_heredoc.freeze - { - "BGS":{"name":"BGS","bad_field":"a"}, - } - EOF - context "when outage is present" do before do Rails.cache.write(:degraded_service_banner_bgs, :display)