diff --git a/spec/system/all_casa_admins/sessions/new_spec.rb b/spec/system/all_casa_admins/sessions/new_spec.rb index a28bdb3d43..f83c940d69 100644 --- a/spec/system/all_casa_admins/sessions/new_spec.rb +++ b/spec/system/all_casa_admins/sessions/new_spec.rb @@ -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 diff --git a/spec/system/case_contacts/case_contacts_new_design_spec.rb b/spec/system/case_contacts/case_contacts_new_design_spec.rb index 98e39cf86f..b4d2cc9504 100644 --- a/spec/system/case_contacts/case_contacts_new_design_spec.rb +++ b/spec/system/case_contacts/case_contacts_new_design_spec.rb @@ -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 @@ -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 @@ -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 diff --git a/spec/system/case_contacts/contact_topic_answers_spec.rb b/spec/system/case_contacts/contact_topic_answers_spec.rb index 906202103c..807076af5c 100644 --- a/spec/system/case_contacts/contact_topic_answers_spec.rb +++ b/spec/system/case_contacts/contact_topic_answers_spec.rb @@ -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 @@ -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." @@ -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." diff --git a/spec/system/case_contacts/drafts_spec.rb b/spec/system/case_contacts/drafts_spec.rb index 5be7cd77e5..d1666e54a3 100644 --- a/spec/system/case_contacts/drafts_spec.rb +++ b/spec/system/case_contacts/drafts_spec.rb @@ -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 diff --git a/spec/system/case_contacts/edit_spec.rb b/spec/system/case_contacts/edit_spec.rb index 1f78fb5d21..5dba34ac09 100644 --- a/spec/system/case_contacts/edit_spec.rb +++ b/spec/system/case_contacts/edit_spec.rb @@ -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 diff --git a/spec/system/case_contacts/index_spec.rb b/spec/system/case_contacts/index_spec.rb index 9d07fbbab2..42dec80f01 100644 --- a/spec/system/case_contacts/index_spec.rb +++ b/spec/system/case_contacts/index_spec.rb @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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) @@ -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 @@ -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 diff --git a/spec/system/case_contacts/new_spec.rb b/spec/system/case_contacts/new_spec.rb index 998cf7d8db..0a54c831f0 100644 --- a/spec/system/case_contacts/new_spec.rb +++ b/spec/system/case_contacts/new_spec.rb @@ -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 @@ -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 @@ -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 @@ -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 @@ -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") @@ -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 @@ -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 diff --git a/spec/system/case_contacts/reimbursement_volunteer_spec.rb b/spec/system/case_contacts/reimbursement_volunteer_spec.rb index 66715aa805..6e68f24a85 100644 --- a/spec/system/case_contacts/reimbursement_volunteer_spec.rb +++ b/spec/system/case_contacts/reimbursement_volunteer_spec.rb @@ -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 diff --git a/spec/system/case_court_reports/index_spec.rb b/spec/system/case_court_reports/index_spec.rb index 40fe34a4cc..52111a2081 100644 --- a/spec/system/case_court_reports/index_spec.rb +++ b/spec/system/case_court_reports/index_spec.rb @@ -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 @@ -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 () { @@ -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 @@ -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) @@ -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") diff --git a/spec/system/case_groups/case_groups_spec.rb b/spec/system/case_groups/case_groups_spec.rb index 646b4bd378..2c93bc17b2 100644 --- a/spec/system/case_groups/case_groups_spec.rb +++ b/spec/system/case_groups/case_groups_spec.rb @@ -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 @@ -106,6 +107,7 @@ end expect(page).to have_text("Case group deleted!") + expect(page).to have_no_text("Doomed group") end end diff --git a/spec/system/court_dates/edit_spec.rb b/spec/system/court_dates/edit_spec.rb index 3efdda9522..7a565f8ea3 100644 --- a/spec/system/court_dates/edit_spec.rb +++ b/spec/system/court_dates/edit_spec.rb @@ -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 @@ -98,6 +100,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 accept_alert "Are you sure?" do page.find("a", text: "Delete future court date").click @@ -105,6 +108,7 @@ 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 @@ -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" diff --git a/spec/system/dashboard/show_spec.rb b/spec/system/dashboard/show_spec.rb index 1ec46ed939..39d5e7507b 100644 --- a/spec/system/dashboard/show_spec.rb +++ b/spec/system/dashboard/show_spec.rb @@ -20,6 +20,7 @@ expect(page).to have_text("My Cases") expect(page).to have_text(casa_case_1.case_number) expect(page).to have_text(casa_case_2.case_number) + expect(page).not_to have_text(casa_case_3.case_number) end @@ -35,6 +36,7 @@ it "displays 'No active cases' when they don't have any assignments", :js do visit casa_cases_path expect(page).to have_text("My Cases") + expect(page).not_to have_css("td", text: "Bob Loblaw") expect(page).not_to have_text("Detail View") end @@ -61,6 +63,9 @@ expect(section).to have_css("table tbody tr", count: 3) expect(section).to have_css("table thead th", minimum: 3) + # One action per row -- the name beside it is identifying text, not a second link to the same page. + section.all("table tbody tr").to_a.each { |row| expect(row.all("a").size).to eq 1 } + # Rows used to carry their own rose border, rose fill and a filled 40px icon tile nested inside # this card; a tint on every row signals nothing. Severity is stated once, by the heading. # Scoped to the row and its cells: an initials avatar may legitimately be bg-rose-100, since @@ -69,9 +74,6 @@ expect(section).to have_no_css("tr[class*='bg-rose'], tr[class*='border-rose']") expect(section).to have_no_css("td[class*='bg-rose'], td[class*='border-rose']") expect(section).to have_no_css("span.h-10") - - # One action per row -- the name beside it is identifying text, not a second link to the same page. - section.all("table tbody tr").to_a.each { |row| expect(row.all("a").size).to eq 1 } end end diff --git a/spec/system/devise/passwords/new_spec.rb b/spec/system/devise/passwords/new_spec.rb index 2cfb049cb5..a2948b0eb3 100644 --- a/spec/system/devise/passwords/new_spec.rb +++ b/spec/system/devise/passwords/new_spec.rb @@ -91,6 +91,7 @@ expect(page).to have_text(user.display_name) expect(page).to have_text("My Cases") + expect(page).not_to have_text("Sign in") end end diff --git a/spec/system/learning_hours/index_spec.rb b/spec/system/learning_hours/index_spec.rb index 92b4f4d8b9..9e1fee405c 100644 --- a/spec/system/learning_hours/index_spec.rb +++ b/spec/system/learning_hours/index_spec.rb @@ -70,6 +70,7 @@ within("table") do expect(page).to have_content(volunteer.display_name) + expect(page).not_to have_content(zero_hour_volunteer.display_name) end end diff --git a/spec/system/volunteers/edit_spec.rb b/spec/system/volunteers/edit_spec.rb index c41e86cf31..a2794d26fb 100644 --- a/spec/system/volunteers/edit_spec.rb +++ b/spec/system/volunteers/edit_spec.rb @@ -143,11 +143,12 @@ expect(page).to have_text "Volunteer was successfully updated." expect(page).to have_field("Email", with: "newemail@example.com") - expect(page).not_to have_field("Email", with: old_email) expect(volunteer.reload.email).to eq("newemail@example.com") expect(volunteer.unconfirmed_email).to be_nil expect(volunteer.old_emails).to eq([old_email]) expect(ActionMailer::Base.deliveries.count).to eq(0) + + expect(page).not_to have_field("Email", with: old_email) end end end @@ -186,9 +187,9 @@ click_on "Activate volunteer" - expect(page).not_to have_text("Volunteer was deactivated on") - expect(inactive_volunteer.reload).to be_active + + expect(page).not_to have_text("Volunteer was deactivated on") end it "allows the admin to unassign a volunteer from a supervisor" do @@ -217,12 +218,13 @@ sign_in admin visit edit_volunteer_path(volunteer) - expect(page).not_to have_select("supervisor_volunteer[supervisor_id]", with_options: [deactivated_supervisor.display_name]) # The leading "" is the blank option the searchable picker loads with -- it no longer pre-selects # whichever supervisor happens to sort first. expect(page).to have_select("supervisor_volunteer[supervisor_id]", options: ["", active_supervisor.display_name]) expect(page).to have_content("Select a supervisor") expect(page).to have_content("Assign a supervisor") + + expect(page).not_to have_select("supervisor_volunteer[supervisor_id]", with_options: [deactivated_supervisor.display_name]) end context "when the volunteer is unassigned from all of their cases" do @@ -352,6 +354,7 @@ within("#case_assignment_#{assignment2.id}") do expect(page).to have_text(casa_case_2.case_number) + expect(page).not_to have_button("Unassign case") end @@ -377,6 +380,7 @@ visit edit_volunteer_path(volunteer) expect(page).to have_content(active_casa_case.case_number) + expect(page).not_to have_content(inactive_casa_case.case_number) end end @@ -427,8 +431,9 @@ visit edit_volunteer_path(volunteer) expect(page).to have_content("Send reactivation alert (SMS)") - expect(page).not_to have_content("Enable Twilio") expect(page).to have_selector("#twilio_enabled") + + expect(page).not_to have_content("Enable Twilio") end context "admin's organization does not have twilio enabled" do @@ -528,8 +533,9 @@ sign_in user visit edit_volunteer_path(volunteer) - expect(page).not_to have_link("Impersonate") expect(page).to have_no_current_path(edit_volunteer_path(volunteer), ignore_query: true) + + expect(page).not_to have_link("Impersonate") end end end @@ -630,8 +636,9 @@ sign_in volunteer visit edit_volunteer_path(volunteer) - expect(page).not_to have_selector(".notes") expect(page).to have_content("Sorry, you are not authorized to perform this action.") + + expect(page).not_to have_selector(".notes") end end