Skip to content

Commit

Permalink
Merge branch 'feature/APPEALS-27311' into tmr/APPEALS-27311
Browse files Browse the repository at this point in the history
  • Loading branch information
zurbergram authored Dec 21, 2023
2 parents 51d3623 + ec2d806 commit 137577a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import Link from '@department-of-veterans-affairs/caseflow-frontend-toolkit/comp
const MAX_NUM_TASKS = 4;

export const ExistingAppealTasksView = (props) => {
const [displayRemoveCheck, setDisplayRemoveCheck] = useState(false);
const [availableTaskTypeOptions, setavailableTaskTypeOptions] = useState([]);

const getTasksForAppeal = () => {
Expand Down Expand Up @@ -67,14 +66,6 @@ export const ExistingAppealTasksView = (props) => {
}
};

useEffect(() => {
if (getTasksForAppeal().length > 1) {
setDisplayRemoveCheck(true);
} else {
setDisplayRemoveCheck(false);
}
}, [props.newTasks]);

useEffect(() => {
setavailableTaskTypeOptions(props.filterUnavailableTaskTypeOptions(getTasksForAppeal(), props.allTaskTypeOptions));
}, [props.newTasks]);
Expand Down Expand Up @@ -106,7 +97,7 @@ export const ExistingAppealTasksView = (props) => {
task={task}
removeTask={removeTask}
taskUpdatedCallback={taskUpdatedCallback}
displayRemoveCheck={displayRemoveCheck}
displayRemoveCheck
allTaskTypeOptions={props.allTaskTypeOptions}
availableTaskTypeOptions={availableTaskTypeOptions}
autoTexts={props.autoTexts}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,19 +174,38 @@
page.all(".cf-form-checkbox").last.click
end
end

find_by_id("button-addTasks").click
all("#reactSelectContainer")[0].click
find_by_id("react-select-2-option-1").click
find_by_id("content").fill_in with: "Correspondence Text"

# will need to add another "remove task" test if only one task exists.
# currently a bug exists where "remove task" option does not show with a single task
expect(page.all("#button-Remove").length).to_not eq(2)
expect(page.all("#button-Remove").length).to eq(1)
page.all("#button-Remove").first.click
expect(page.all("#button-Remove").length).to eq(0)
end

it "Adds and removes multiple tasks from the linked appeal" do

Check failure on line 188 in spec/feature/queue/correspondence/tasks_related_to_an_existing_appeal_spec.rb

View workflow job for this annotation

GitHub Actions / caseflow_rspec_job (12, 8)

Tasks related to an existing Appeal - Correspondence Intake page step 2.3 Yes - related existing Appeals Linking and unlinking existing appeals Adds and removes multiple tasks from the linked appeal Failure/Error: within ".cf-case-list-table" do page.all(".cf-form-checkbox").last.click end Capybara::ElementNotFound: Unable to find css ".cf-case-list-table"
visit_intake_form_step_2_with_appeals
existing_appeal_radio_options[:yes].click
using_wait_time(15) do
within ".cf-case-list-table" do
page.all(".cf-form-checkbox").last.click
end
end
find_by_id("button-addTasks").click
all("#reactSelectContainer")[0].click
find_by_id("react-select-2-option-1").click
find_by_id("content").fill_in with: "Correspondence Text"

expect(page.all("#button-Remove").length).to eq(1)
page.all("#button-addTasks").first.click
expect(page.all("#button-Remove").length).to eq(2)

page.all("#button-Remove").last.click
expect(page.all("#button-Remove").length).to_not eq(2)
expect(page.all("#button-Remove").length).to eq(1)
page.all("#button-Remove").first.click
expect(page.all("#button-Remove").length).to eq(0)
end

it "Prevents user from clicking continue if task name or text isn't filled out" do

Check failure on line 211 in spec/feature/queue/correspondence/tasks_related_to_an_existing_appeal_spec.rb

View workflow job for this annotation

GitHub Actions / caseflow_rspec_job (12, 6)

Tasks related to an existing Appeal - Correspondence Intake page step 2.3 Yes - related existing Appeals Linking and unlinking existing appeals Prevents user from clicking continue if task name or text isn't filled out Failure/Error: within ".cf-case-list-table" do page.all(".cf-form-checkbox").last.click end Capybara::ElementNotFound: Unable to find css ".cf-case-list-table"
Expand All @@ -197,6 +216,7 @@
page.all(".cf-form-checkbox").last.click
end
end
find_by_id("button-addTasks").click
all("#reactSelectContainer")[0].click
find_by_id("react-select-2-option-15").click
expect(page).to have_button("button-continue", disabled: true)
Expand All @@ -220,6 +240,7 @@
page.all(".cf-form-checkbox").last.click
end
end
find_by_id("button-addTasks").click
all("#reactSelectContainer")[0].click
find_by_id("react-select-2-option-15").click
find_by_id("content").fill_in with: "Correspondence Text"
Expand All @@ -245,6 +266,7 @@
page.all(".cf-form-checkbox").last.click
end
end
find_by_id("button-addTasks").click
all("#reactSelectContainer")[0].click
find_by_id("react-select-2-option-15").click
find_by_id("content").fill_in with: "Correspondence Text"
Expand All @@ -263,10 +285,12 @@
end
end

find_all("#button-addTasks").first.click
all("#reactSelectContainer")[0].click
find_by_id("react-select-2-option-15").click
all("textarea")[0].fill_in with: "Correspondence Text"

find_all("#button-addTasks").last.click
all("#reactSelectContainer")[1].click
find_by_id("react-select-3-option-15").click
all("textarea")[1].fill_in with: "Correspondence Text"
Expand Down

0 comments on commit 137577a

Please sign in to comment.