From b659eca9a6daf41c36bddc3be79c3cf2885a0e0f Mon Sep 17 00:00:00 2001 From: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com> Date: Fri, 22 Sep 2023 15:36:23 -0400 Subject: [PATCH] Calvin/appeals 30829 assignment spec (#19555) * fixed most issues * fixed last two errors --------- Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com> --- .../components/AssignToAttorneyWidget.jsx | 2 +- spec/feature/queue/judge_assignment_spec.rb | 26 +++++++++++-------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/client/app/queue/components/AssignToAttorneyWidget.jsx b/client/app/queue/components/AssignToAttorneyWidget.jsx index e26908a2e53..afab63aa005 100644 --- a/client/app/queue/components/AssignToAttorneyWidget.jsx +++ b/client/app/queue/components/AssignToAttorneyWidget.jsx @@ -188,7 +188,7 @@ export class AssignToAttorneyWidget extends React.PureComponent { return this.props.showSuccessMessage({ title: sprintf(COPY.ASSIGN_WIDGET_SUCCESS, { verb: isReassign ? 'You have successfully reassigned' : 'You have successfully assigned', - numCases: selectedTasks.length === 1 && selectedTasks[0].appeal ? `${selectedTasks[0].appeal.appellantFullName}'s` : selectedTasks.length, + numCases: selectedTasks.length === 1 && selectedTasks[0].appeal?.appelantFullName ? `${selectedTasks[0].appeal.appellantFullName}'s` : selectedTasks.length, casePlural: pluralize('cases', selectedTasks.length), // eslint-disable-next-line camelcase assignee: assignee.full_name diff --git a/spec/feature/queue/judge_assignment_spec.rb b/spec/feature/queue/judge_assignment_spec.rb index 36c90229a11..52b85c5769d 100644 --- a/spec/feature/queue/judge_assignment_spec.rb +++ b/spec/feature/queue/judge_assignment_spec.rb @@ -73,7 +73,7 @@ click_dropdown(text: attorney_one.full_name) click_on "Assign 2 cases" - expect(page).to have_content("Assigned 2 tasks to #{attorney_one.full_name}") + expect(page).to have_content("You have successfully assigned 2 cases to #{attorney_one.full_name}") end step "navigates to the attorney's case list" do @@ -92,7 +92,7 @@ click_dropdown(text: attorney_two.full_name) click_on "Assign 1 case" - expect(page).to have_content("Reassigned 1 task to #{attorney_two.full_name}") + expect(page).to have_content("You have successfully reassigned 1 case to #{attorney_two.full_name}") end step "navigates to the other attorney's case list" do @@ -256,12 +256,14 @@ click_on("#{appeal.veteran_first_name} #{appeal.veteran_last_name}") click_dropdown(text: Constants.TASK_ACTIONS.REASSIGN_TO_JUDGE.label) - click_dropdown(prompt: "Select a user", text: judge_two.full_name) + within all(".cf-select")[1] do + click_dropdown(prompt: "Select", text: judge_two.full_name) + end fill_in("taskInstructions", with: "Test") appeal.reload.tasks.update_all(status: Constants.TASK_STATUSES.cancelled) click_on("Assign") - expect(page).to have_content("Task reassigned to #{judge_two.full_name}") + expect(page).to have_content("You have successfully assigned #{appeal.veteran_first_name} #{appeal.veteran_last_name}’s case to #{judge_two.full_name}") click_on("Switch views") click_on(format(COPY::JUDGE_ASSIGN_DROPDOWN_LINK_LABEL, judge_one.css_id)) @@ -287,9 +289,9 @@ click_dropdown(text: Constants.TASK_ACTIONS.ASSIGN_TO_ATTORNEY.label) click_dropdown(prompt: "Select a user", text: attorney_one.full_name) fill_in(COPY::ADD_COLOCATED_TASK_INSTRUCTIONS_LABEL, with: "note") - click_on("Submit") + click_on("Assign") - expect(page).to have_content("Assigned 1 task to #{attorney_one.full_name}") + expect(page).to have_content("You have successfully assigned 1 case to #{attorney_one.full_name}") end end @@ -304,7 +306,9 @@ click_on("#{appeal_one.veteran_first_name} #{appeal_one.veteran_last_name}") click_dropdown(text: Constants.TASK_ACTIONS.REASSIGN_TO_LEGACY_JUDGE.label) - click_dropdown(prompt: "Select a user", text: judge_two.full_name) + within all(".cf-select")[1] do + click_dropdown(prompt: "Select", text: judge_two.full_name) + end fill_in("taskInstructions", with: "Test") click_on("Assign") @@ -337,8 +341,8 @@ click_dropdown({ text: judge_two.full_name }, page.find(".dropdown-Other")) fill_in(COPY::ADD_COLOCATED_TASK_INSTRUCTIONS_LABEL, with: "note") - click_on("Submit") - expect(page).to have_content("Assigned 1 task to #{judge_two.full_name}") + click_on("Assign") + expect(page).to have_content("You have successfully assigned 1 case to #{judge_two.full_name}") end end @@ -354,8 +358,8 @@ click_dropdown(prompt: "Select a user", text: judge_one.full_name) fill_in(COPY::ADD_COLOCATED_TASK_INSTRUCTIONS_LABEL, with: "note") - click_on("Submit") - expect(page).to have_content("Assigned 1 task to #{judge_one.full_name}") + click_on("Assign") + expect(page).to have_content("You have successfully assigned 1 case to #{judge_one.full_name}") end end