Skip to content

Commit

Permalink
Merge pull request #19333 from department-of-veterans-affairs/dev-sup…
Browse files Browse the repository at this point in the history
…port/test-fixes

APPEALS-4789 Add tests
  • Loading branch information
craigrva authored Sep 7, 2023
2 parents 569d31e + 02795fb commit efe83c1
Show file tree
Hide file tree
Showing 2 changed files with 152 additions and 56 deletions.
44 changes: 42 additions & 2 deletions spec/feature/queue/vha_camo_cancellation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
let(:camo_user) { create(:user, full_name: "Camo User", css_id: "CAMOUSER") }
let(:bva_intake_org) { BvaIntake.singleton }
let!(:bva_intake_user) { create(:intake_user) }
let(:vha_po_org) { VhaProgramOffice.create!(name: "Vha Program Office", url: "po-vha-test") }
let(:vha_po_user) { create(:user, full_name: "PO User", css_id: "POUSER") }

let!(:task) do
create(
:vha_document_search_task,
Expand All @@ -15,13 +18,21 @@
assigned_to: bva_intake_org)
)
end
let!(:po_task) do
create(
:assess_documentation_task,
:in_progress,
assigned_to: vha_po_org
)
end
let!(:appeal) { Appeal.find(task.appeal_id) }

before do
FeatureToggle.enable!(:vha_predocket_workflow)
FeatureToggle.enable!(:vha_irregular_appeals)
camo_org.add_user(camo_user)
bva_intake_org.add_user(bva_intake_user)
vha_po_org.add_user(vha_po_user)
end

after do
Expand All @@ -34,7 +45,7 @@
User.authenticate!(user: camo_user)
end
scenario "assign to BVA intake" do
navigate_from_camo_queue_to_case_deatils
navigate_from_camo_queue_to_case_details
step "trigger return to board intake modal" do
find(".cf-select__control", text: COPY::TASK_ACTION_DROPDOWN_BOX_LABEL).click
find("div", class: "cf-select__option", text: Constants.TASK_ACTIONS.VHA_RETURN_TO_BOARD_INTAKE.label).click
Expand Down Expand Up @@ -69,9 +80,38 @@
end
end

context "PO to Camo Cancellation Flow" do
before do
User.authenticate!(user: vha_po_user)
end

scenario "assign to VHA CAMO" do
visit vha_po_org.path
# navigate_from_camo_queue_to_case_details
reload_case_detail_page(po_task.appeal.uuid)
find(".cf-select__control", text: COPY::TASK_ACTION_DROPDOWN_BOX_LABEL).click
find(
"div",
class: "cf-select__option",
text: Constants.TASK_ACTIONS.VHA_PROGRAM_OFFICE_RETURN_TO_CAMO.label
).click
expect(page).to have_content(COPY::VHA_PROGRAM_OFFICE_RETURN_TO_CAMO_MODAL_TITLE)
expect(page).to have_content(COPY::VHA_CANCEL_TASK_INSTRUCTIONS_LABEL)
fill_in("taskInstructions", with: "Testing this Cancellation flow")
find("button", class: "usa-button", text: COPY::MODAL_RETURN_BUTTON).click

expect(page).to have_current_path("#{vha_po_org.path}?tab=po_assigned&page=1&sort_by=typeColumn&order=asc")
expect(page).to have_content(COPY::VHA_PROGRAM_OFFICE_RETURN_TO_CAMO_CONFIRMATION_TITLE)
expect(page).to have_content(COPY::VHA_PROGRAM_OFFICE_RETURN_TO_CAMO_CONFIRMATION_DETAIL)

po_task.reload
expect(po_task.status).to eq "cancelled"
end
end

private

def navigate_from_camo_queue_to_case_deatils
def navigate_from_camo_queue_to_case_details
step "navigate from CAMO team queue to case details" do
visit camo_org.path
click_on "#{appeal.veteran_full_name} (#{appeal.veteran_file_number})"
Expand Down
164 changes: 110 additions & 54 deletions spec/feature/queue/vha_regional_queue_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ def a_normal_tab(expected_text)
"Case Details", "Issue Type", "Tasks", "Assigned By", "Types", "Docket", "Days Waiting", "Veteran Documents"
]
end
let!(:num_assigned_rows) { 3 }
let!(:num_in_progress_rows) { 9 }
let!(:num_on_hold_rows) { 4 }
let!(:num_completed_rows) { 5 }
let(:num_assigned_rows) { 3 }
let(:num_in_progress_rows) { 9 }
let(:num_on_hold_rows) { 4 }
let(:num_completed_rows) { 5 }

let!(:vha_regional_assigned_tasks) do
create_list(:assess_documentation_task, num_assigned_rows, :assigned, assigned_to: regional_office)
Expand All @@ -49,71 +49,127 @@ def a_normal_tab(expected_text)
visit "/organizations/#{regional_office.url}?tab=po_assigned&page=1&sort_by=typeColumn&order=asc"
end

scenario "Vha Regional office Queue contains appropriate header" do
expect(find("h1")).to have_content("#{regional_office.name} cases")
end
scenario "Vha Regional Office queue task tabs", :aggregate_failures do
step "contains appropriate header and tabs" do
expect(find("h1")).to have_content("#{regional_office.name} cases")
expect(page).to have_content assigned_tab_text
expect(page).to have_content in_progress_tab_text
expect(page).to have_content on_hold_tab_text
expect(page).to have_content completed_tab_text
end

scenario "Vha Regional Organization Queue Has Assigned, in progress, on hold and completed tabs" do
expect(page).to have_content assigned_tab_text
expect(page).to have_content in_progress_tab_text
expect(page).to have_content on_hold_tab_text
expect(page).to have_content completed_tab_text
end
step "Assigned tab" do
assigned_tab_button = find("button", text: assigned_tab_text)
expect(page).to have_content "Cases assigned to a member of the #{regional_office.name} team:"
a_normal_tab(assigned_pagination_text)
num_table_rows = all("tbody > tr").count
expect(assigned_tab_button.text).to eq("#{assigned_tab_text} (#{num_assigned_rows})")
expect(num_table_rows).to eq(num_assigned_rows)
end

scenario "tab has the correct column Headings and description text" do
expect(page).to have_content "Cases assigned to a member of the #{regional_office.name} team:"
a_normal_tab(assigned_pagination_text)
end
step "In Progress tab" do
# Navigate to the In Progress Tab
in_progress_tab_button = find("button", text: in_progress_tab_text)
click_button(in_progress_tab_text)
expect(page).to have_content "Cases in progress in a #{regional_office.name} team member's queue"
a_normal_tab(in_progress_pagination_text)

num_table_rows = all("tbody > tr").count
expect(in_progress_tab_button.text).to eq("#{in_progress_tab_text} (#{num_in_progress_rows})")
expect(num_table_rows).to eq(num_in_progress_rows)
end

step "On Hold tab" do
on_hold_tab_button = find("button", text: on_hold_tab_text)
click_button(on_hold_tab_text)
expect(page).to have_content "Cases on hold in a #{regional_office.name} team member's queue"
a_normal_tab(on_hold_pagination_text)
num_table_rows = all("tbody > tr").count
expect(on_hold_tab_button.text).to eq("#{on_hold_tab_text} (#{num_on_hold_rows})")
expect(num_table_rows).to eq(num_on_hold_rows)
end

scenario "In Progress tab has the correct column Headings and description text" do
# Navigate to the In Progress Tab
click_button(in_progress_tab_text)
expect(page).to have_content "Cases in progress in a #{regional_office.name} team member's queue"
a_normal_tab(in_progress_pagination_text)
step "Completed tab" do
# Navigate to the Completed Tab
click_button(completed_tab_text)
expect(page).to have_content "Cases completed:"
a_normal_tab(completed_pagination_text)
num_table_rows = all("tbody > tr").count
expect(num_table_rows).to eq(num_completed_rows)
end
end
end

scenario "On Hold tab has the correct column Headings and description text" do
# Navigate to the Completed Tab
click_button(on_hold_tab_text)
expect(page).to have_content "Cases on hold in a #{regional_office.name} team member's queue"
a_normal_tab(on_hold_pagination_text)
context "VhaRegional Queue can send back task to Program office" do
let(:visn_org) { create(:vha_regional_office) }
let(:visn_user) { create(:user) }
before do
User.authenticate!(user: visn_user)
end

scenario "Completed tab has the correct column Headings and description text" do
# Navigate to the Completed Tab
click_button(completed_tab_text)
expect(page).to have_content "Cases completed:"
a_normal_tab(completed_pagination_text)
let(:visn_in_progress) do
create(
:assess_documentation_task_predocket,
:in_progress,
assigned_to: visn_org
)
end
let(:visn_task_on_hold) do
create(
:assess_documentation_task_predocket,
:on_hold,
assigned_to: visn_org
)
end
let(:visn_task) do
create(
:assess_documentation_task_predocket,
:assigned,
assigned_to: visn_org
)
end

scenario "Assigned tab has the correct number in the tab name and the number of table rows" do
assigned_tab_button = find("button", text: assigned_tab_text)
num_table_rows = all("tbody > tr").count
expect(assigned_tab_button.text).to eq("#{assigned_tab_text} (#{num_assigned_rows})")
expect(num_table_rows).to eq(num_assigned_rows)
before do
visn_org.add_user(visn_user)
end

scenario "In Progress tab has the correct number in the tab name and the number of table rows" do
in_progress_tab_button = find("button", text: in_progress_tab_text)
in_progress_tab_button.click
num_table_rows = all("tbody > tr").count
expect(in_progress_tab_button.text).to eq("#{in_progress_tab_text} (#{num_in_progress_rows})")
expect(num_table_rows).to eq(num_in_progress_rows)
# rubocop:disable Metrics/AbcSize
def return_to_po_office(tab_name)
find(".cf-select__control", text: COPY::TASK_ACTION_DROPDOWN_BOX_LABEL).click
find(
"div",
class: "cf-select__option",
text: Constants.TASK_ACTIONS.VHA_REGIONAL_OFFICE_RETURN_TO_PROGRAM_OFFICE.label
).click
expect(page).to have_content(COPY::VHA_REGIONAL_OFFICE_RETURN_TO_PROGRAM_OFFICE_MODAL_TITLE)
expect(page).to have_content(COPY::VHA_CANCEL_TASK_INSTRUCTIONS_LABEL)
fill_in("taskInstructions", with: "Testing this Cancellation flow")
find("button", class: "usa-button", text: COPY::MODAL_RETURN_BUTTON).click
expect(page).to have_current_path("#{visn_org.path}?tab=#{tab_name}&page=1&sort_by=typeColumn&order=asc")
expect(page).to have_content(COPY::VHA_REGIONAL_OFFICE_RETURN_TO_PROGRAM_OFFICE_CONFIRMATION_TITLE)
expect(page).to have_content(COPY::VHA_REGIONAL_OFFICE_RETURN_TO_PROGRAM_OFFICE_CONFIRMATION_DETAIL)
end
# rubocop:enable Metrics/AbcSize

it "Assigned task can be sent to program office" do
reload_case_detail_page(visn_task.appeal.uuid)
return_to_po_office("po_assigned")
visn_task.reload
expect(visn_task.status).to eq "cancelled"
end

scenario "On hold tab has the correct number in the tab name and the number of table rows" do
on_hold_tab_button = find("button", text: on_hold_tab_text)
on_hold_tab_button.click
num_table_rows = all("tbody > tr").count
expect(on_hold_tab_button.text).to eq("#{on_hold_tab_text} (#{num_on_hold_rows})")
expect(num_table_rows).to eq(num_on_hold_rows)
it "In Progress task can be sent to program office" do
reload_case_detail_page(visn_in_progress.appeal.uuid)
return_to_po_office("po_assigned")
visn_in_progress.reload
expect(visn_in_progress.status).to eq "cancelled"
end

scenario "Completed tab has the correct number of table rows" do
# Navigate to the Completed Tab
click_button(completed_tab_text)
num_table_rows = all("tbody > tr").count
expect(num_table_rows).to eq(num_completed_rows)
it "On Hold task can be sent to program office" do
reload_case_detail_page(visn_task_on_hold.appeal.uuid)
return_to_po_office("po_assigned")
visn_task_on_hold.reload
expect(visn_task_on_hold.status).to eq "cancelled"
end
end
end

0 comments on commit efe83c1

Please sign in to comment.