Skip to content
Draft
3 changes: 2 additions & 1 deletion spec/system/all_casa_admins/sessions/new_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
it "allows sign out" do
visit "/"
find("#all-casa-log-out").click
expect(page).not_to have_text "sign in before continuing"
expect(page).to have_text "Signed out successfully"
expect(page).to have_text "All CASA log in"

expect(page).not_to have_text "sign in before continuing"
end

it "allows access to flipper" do
Expand Down
3 changes: 3 additions & 0 deletions spec/system/case_contacts/case_contacts_new_design_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
select "In person", from: "Medium"

expect(page).to have_text(in_person_date)

expect(page).not_to have_text(video_date)
end

Expand All @@ -80,6 +81,7 @@
execute_script("const el = document.getElementById('occurred_ending_at'); el.value = '#{4.days.ago.to_date}'; el.dispatchEvent(new Event('change', {bubbles: true}))")

expect(page).to have_text(old_date)

expect(page).not_to have_text(recent_date)
end

Expand Down Expand Up @@ -232,6 +234,7 @@
find("[aria-label='Resolve reminder']").click

expect(page).to have_css("[aria-label='Set reminder']")

expect(page).to have_no_css("[aria-label='Reminder set']")
expect(followup.reload.status).to eq("resolved")
end
Expand Down
4 changes: 3 additions & 1 deletion spec/system/case_contacts/contact_topic_answers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def notes_section
contact_topic_questions.each do |question|
expect(notes_section).to have_field(question, type: :checkbox)
end

expect(notes_section).to have_no_select(class: topic_select_class)
end

Expand Down Expand Up @@ -80,6 +81,7 @@ def notes_section
answer_topic contact_topics.first.question, "First discussion topic answer."
within notes_section do
expect(page).to have_text "Saved" # autosave success alert

expect(page).to have_no_text "Saved" # wait for clearing of alert
end
answer_topic contact_topics.first.question, "Changing the first topic answer."
Expand All @@ -103,8 +105,8 @@ def notes_section

it "displays a field for contact.notes", :js do
subject
expect(notes_section).to have_no_css("[data-topic-group]")
expect(notes_section).to have_field "Additional notes"
expect(notes_section).to have_no_css("[data-topic-group]")

fill_in_contact_details
fill_in "Additional notes", with: "This is a note."
Expand Down
5 changes: 3 additions & 2 deletions spec/system/case_contacts/drafts_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@

visit case_contacts_drafts_path

expect(page).to have_content("NOTE_C")
expect(page).to have_content("NOTE_E")

expect(page).not_to have_content("NOTE_A")
expect(page).not_to have_content("NOTE_B")
expect(page).to have_content("NOTE_C")
expect(page).not_to have_content("NOTE_D")
expect(page).to have_content("NOTE_E")
end
end
end
1 change: 1 addition & 0 deletions spec/system/case_contacts/edit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
check "Request travel or other reimbursement"
expect(page).to have_select("case_contact_reimbursement_volunteer_id")
expect(page).to have_field("case_contact_volunteer_address_line_1", disabled: false)

expect(page).to have_no_text("This is not currently possible")
end

Expand Down
18 changes: 13 additions & 5 deletions spec/system/case_contacts/index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@

within(".full-card", match: :first) do
expect(page).to have_text("Reimbursement pending")

expect(page).to have_no_text("Reimbursement complete")
end
end
Expand All @@ -82,6 +83,7 @@

within(".full-card", match: :first) do
expect(page).to have_text("Reimbursement complete")

expect(page).to have_no_text("Reimbursement pending")
end
end
Expand Down Expand Up @@ -122,9 +124,9 @@
fill_in "filterrific_occurred_starting_at", with: yesterday
fill_in "filterrific_occurred_ending_at", with: Time.zone.tomorrow

expect(page).to have_no_content day_before_yesterday_display
expect(page).to have_content yesterday_display
expect(page).to have_content today_display
expect(page).to have_no_content day_before_yesterday_display
end
end

Expand All @@ -138,15 +140,15 @@

subject

expect(page).to have_no_content "You have no case contacts for this case."
expect(page).to have_content "Draft"
expect(page).to have_no_content "You have no case contacts for this case."
end

it "only displays the filtered case" do
subject

expect(page).to have_no_content other_casa_case.case_number
expect(page).to have_content casa_case.case_number
expect(page).to have_no_content other_casa_case.case_number
end
end

Expand Down Expand Up @@ -175,6 +177,7 @@
check "Hide drafts"

expect(page).to have_field "Hide drafts", type: :checkbox

expect(page).to have_no_content "Other filters"
end

Expand Down Expand Up @@ -229,8 +232,8 @@

find(".clear-button").click

expect(page).to have_no_css(".ts-control .item")
expect(page).to have_content "Other filters"
expect(page).to have_no_css(".ts-control .item")
end

it "stays open when a hidden select goes back to All" do
Expand All @@ -253,6 +256,7 @@
check "Hide drafts"

expect(page).to have_field("Hide drafts", checked: true)

expect(page).to have_no_content "Other filters"
end
end
Expand Down Expand Up @@ -347,8 +351,8 @@

find(".clear-button").click

expect(page).to have_no_css(".ts-control .item")
expect(page).to have_text("Showing 1\u20132 of 2")
expect(page).to have_no_css(".ts-control .item")
end

# The auto-submit re-rendered the page on every chip, tearing down the open menu: picking N
Expand Down Expand Up @@ -543,11 +547,13 @@
# showing case 1 only
visit case_contacts_path(casa_case_id: casa_case.id)
expect(page).to have_content(case_number)

expect(page).to have_no_content(another_case_number)

# showing case 2 only
visit case_contacts_path(casa_case_id: another_case.id)
expect(page).to have_content(another_case_number)

expect(page).to have_no_content(case_number)

# a date range that keeps case 2's contact (today) and drops case 1's (day before yesterday)
Expand All @@ -556,6 +562,7 @@
fill_in "filterrific_occurred_ending_at", with: Time.zone.tomorrow

expect(page).to have_content(another_case_number)

expect(page).to have_no_content(case_number)

# case 1 + a date range that excludes its only contact -> no contact cards render
Expand Down Expand Up @@ -591,6 +598,7 @@

expect(page).to have_content(contact_topic.question)
expect(page).to have_content(contact_topic_answer.value)

expect(page).to have_no_content contact_topics.first.details
end
end
Expand Down
14 changes: 10 additions & 4 deletions spec/system/case_contacts/new_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
visit edit_case_contact_path(contact)

expect(page).to have_text("Editing existing case contact")

expect(page).to have_no_button("Discard draft")
end

Expand Down Expand Up @@ -157,6 +158,7 @@
find("#draft-case-id-selector .ts-control").click

expect(page).to have_css("#draft-case-id-selector .ts-dropdown .option", text: case_number)

expect(page).to have_no_css("#draft-case-id-selector .ts-dropdown .optgroup-header")
end
end
Expand Down Expand Up @@ -195,6 +197,7 @@
expect(page).to have_button("Submit")
expect(page).to have_button("Submit & add another")
end

expect(page).to have_no_css("#contact-form-action-buttons > button[type=button]", text: "Cancel")
end
end
Expand Down Expand Up @@ -263,12 +266,12 @@
subject

expect(page).to have_text(contact_type_group.name)
expect(page).to have_no_text("OnlyHiddenTypes")
expect(page).to have_no_text("Empty Group")

expect(page).to have_field(class: "contact-form-type-checkbox", count: 2)
expect(page).to have_field("School", class: "contact-form-type-checkbox")
expect(page).to have_field("Shown Checkbox", class: "contact-form-type-checkbox")

expect(page).to have_no_text("OnlyHiddenTypes")
expect(page).to have_no_text("Empty Group")
expect(page).to have_no_text("Empty")
expect(page).to have_no_text("Hidden")
end
Expand Down Expand Up @@ -311,6 +314,7 @@

within notes_section_selector do
expect(page).to have_field("Active Topic", type: :checkbox)

expect(page).to have_no_text("Inactive Not Soft Deleted")
expect(page).to have_no_text("Active Soft Deleted")
expect(page).to have_no_text("Inactive Soft Deleted")
Expand Down Expand Up @@ -572,8 +576,9 @@

# The reopened form carries the case forward but none of the last contact's other answers.
expect(page).to have_select("case_contact_draft_case_ids", selected: [case_number])
expect(page).to have_no_field("case_contact_medium_type", checked: true)
expect(page).to have_field("case_contact_notes", with: "")

expect(page).to have_no_field("case_contact_medium_type", checked: true)
end

it "does not reset referring location", :js do
Expand Down Expand Up @@ -643,6 +648,7 @@
visit new_case_contact_path(case_contact: {casa_case_id: first_case.id})

expect(page).to have_text(first_case.case_number)

expect(page).to have_no_text(second_case.case_number)
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
visit edit_case_contact_path(contact)

expect(page).to have_css("#case_contact_reimbursement_volunteer_id")

expect(page).to have_no_text("No volunteer is assigned")

find("#case_contact_reimbursement_volunteer_id option[value='#{vol2.id}']").select_option
Expand Down
7 changes: 5 additions & 2 deletions spec/system/case_court_reports/index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
it "generation modal hidden", :aggregate_failures do
expect(page).to have_selector "#btnGenerateReport", text: "Generate report", visible: :hidden
expect(page).to have_selector "#case-selection", visible: :hidden

expect(page).not_to have_selector ".select2"
end
end
Expand Down Expand Up @@ -145,8 +146,8 @@
# leaves no placeholder and no magnifier -- searchable, but with nothing saying so.
expect(page).to have_selector "#case-selection option:first-of-type", text: "Select case number", visible: :all
within "#generate-docx-report-modal" do
expect(page).to have_no_css ".ts-control .item"
expect(page).to have_css ".ts-control input[placeholder='Search case number']"
expect(page).to have_no_css ".ts-control .item"
end
state = page.evaluate_script(<<~JS)
(function () {
Expand All @@ -171,6 +172,7 @@

# Waiting matchers: reading the menu straight after the keystrokes reads it pre-filter.
expect(page).to have_css(".ts-dropdown .option", text: target.case_number)

expect(page).to have_no_css(".ts-dropdown .option", text: decoy.case_number)
end

Expand All @@ -197,6 +199,7 @@
# Same barrier as the success example: the button disables for the request and re-enables after,
# which is the page-level signal that the round trip finished. Counting before that reads 0.
expect(page).to have_selector "#btnGenerateReport[disabled]"

expect(page).to have_no_selector "#btnGenerateReport[disabled]", wait: 10

expect(page.evaluate_script("window.__opened.length")).to eq(1)
Expand Down Expand Up @@ -226,8 +229,8 @@
click_button "Generate report"

expect(page).to have_selector "#btnGenerateReport[disabled]"
expect(page).not_to have_selector "#btnGenerateReport[disabled]", wait: 10
expect(page).to have_selector "#spinner", visible: :hidden
expect(page).not_to have_selector "#btnGenerateReport[disabled]", wait: 10
end

opened_url = page.evaluate_script("window.__last_opened_url")
Expand Down
2 changes: 2 additions & 0 deletions spec/system/case_groups/case_groups_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
click_on "Submit"

expect(page).to have_text(casa_case1.case_number)

expect(page).not_to have_text(casa_case2.case_number)
end

Expand Down Expand Up @@ -106,6 +107,7 @@
end

expect(page).to have_text("Case group deleted!")

expect(page).to have_no_text("Doomed group")
end
end
7 changes: 6 additions & 1 deletion spec/system/court_dates/edit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,15 @@

expect(page).to have_content past_court_date.date.strftime("%B %-d, %Y")
expect(page).to have_content future_court_date.date.strftime("%B %-d, %Y")

page.find("a", text: future_court_date.date.strftime("%B %-d, %Y")).click
accept_alert "Are you sure?" do
page.find("a", text: "Delete future court date").click
end
expect(page).to have_content "Court date was successfully deleted"

expect(page).to have_content "Court date was successfully deleted"
expect(page).to have_content past_court_date.date.strftime("%B %-d, %Y")

expect(page).not_to have_content future_court_date.date.strftime("%B %-d, %Y")
end
end
Expand All @@ -98,13 +100,15 @@

expect(page).to have_content past_court_date.date.strftime("%B %-d, %Y")
expect(page).to have_content future_court_date.date.strftime("%B %-d, %Y")

page.find("a", text: future_court_date.date.strftime("%B %-d, %Y")).click
accept_alert "Are you sure?" do
page.find("a", text: "Delete future court date").click
end

expect(page).to have_content "Court date was successfully deleted."
expect(page).to have_content past_court_date.date.strftime("%B %-d, %Y")

expect(page).not_to have_content future_court_date.date.strftime("%B %-d, %Y")
end
end
Expand All @@ -120,6 +124,7 @@

expect(page).to have_content past_court_date.date.strftime("%B %-d, %Y")
expect(page).to have_content future_court_date.date.strftime("%B %-d, %Y")

page.find("a", text: future_court_date.date.strftime("%B %-d, %Y")).click

expect(page).not_to have_content "Delete future court date"
Expand Down
Loading
Loading