Skip to content

Commit c9d2042

Browse files
committed
adds system spec tests for casa case creation flow
1 parent ca99d15 commit c9d2042

1 file changed

Lines changed: 14 additions & 12 deletions

File tree

spec/system/casa_cases/new_spec.rb

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,17 @@
3333
select "Submitted", from: "casa_case_court_report_status"
3434

3535
find(".ts-control").click
36-
find("span", text: contact_type.name).click
37-
find(".ts-control").click
36+
37+
ts_checkboxes = page.all('.ts-dropdown-content input')
38+
select_all_el = page.find('span[data-test=select-all-input]')
39+
# uncheck all contact type options
40+
select_all_el.click
41+
ts_checkboxes.each do |el|
42+
expect(el).not_to be_checked
43+
end
44+
# check all contact type options
45+
select_all_el.click
46+
expect(ts_checkboxes).to all(be_checked)
3847

3948
select "Test User", from: "casa_case[case_assignments_attributes][0][volunteer_id]"
4049

@@ -57,7 +66,7 @@
5766
casa_org = build(:casa_org)
5867
admin = create(:casa_admin, casa_org: casa_org)
5968
contact_type_group = create(:contact_type_group, casa_org: casa_org)
60-
contact_type = create(:contact_type, contact_type_group: contact_type_group)
69+
create(:contact_type, contact_type_group: contact_type_group)
6170
case_number = "12345"
6271

6372
sign_in admin
@@ -69,9 +78,6 @@
6978
select "March", from: "casa_case_birth_month_year_youth_2i"
7079
select five_years, from: "casa_case_birth_month_year_youth_1i"
7180

72-
find(".ts-control").click
73-
find("span", text: contact_type.name).click
74-
7581
within ".actions-cc" do
7682
click_on "Create CASA Case"
7783
end
@@ -109,7 +115,7 @@
109115
casa_org = build(:casa_org)
110116
admin = create(:casa_admin, casa_org: casa_org)
111117
contact_type_group = create(:contact_type_group, casa_org: casa_org)
112-
contact_type = create(:contact_type, contact_type_group: contact_type_group)
118+
create(:contact_type, contact_type_group: contact_type_group)
113119
case_number = "12345"
114120

115121
sign_in admin
@@ -121,9 +127,6 @@
121127
select five_years, from: "casa_case_birth_month_year_youth_1i"
122128
check "casa_case_empty_court_date"
123129

124-
find(".ts-control").click
125-
find("span", text: contact_type.name).click
126-
127130
within ".actions-cc" do
128131
click_on "Create CASA Case"
129132
end
@@ -152,8 +155,7 @@
152155
select "March", from: "casa_case_birth_month_year_youth_2i"
153156
select five_years, from: "casa_case_birth_month_year_youth_1i"
154157

155-
find(".ts-control").click
156-
find("span", text: contact_type.name).click
158+
# 2/14/2025 - by default, all contact types are selected on page load so don't need to manually select
157159

158160
within ".actions-cc" do
159161
click_on "Create CASA Case"

0 commit comments

Comments
 (0)