Skip to content

Commit

Permalink
[5128] reduce flakiness by just focusing on asserting the given highl…
Browse files Browse the repository at this point in the history
…ight (#5170)
  • Loading branch information
FeminismIsAwesome authored Aug 30, 2023
1 parent 6c206f3 commit 1cb59dc
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 24 deletions.
2 changes: 1 addition & 1 deletion spec/support/shared_examples/shows_court_dates_links.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
it "past court dates are ordered" do
visit casa_case_path(casa_case)
expect(page).to have_text("December 23, 2019")
expect(page.body).to match(/December 23, 2019.*December 28, 2019/m)
expect(page).to have_text(/December 23, 2019.*December 28, 2019/m)
end
end
4 changes: 2 additions & 2 deletions spec/system/casa_cases/new_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
click_on "Create CASA Case"
end

expect(page.body).to have_content(case_number)
expect(page).to have_content(case_number)
expect(page).to have_content("CASA case was successfully created.")
expect(page).to have_content("Next Court Date:")
expect(page).not_to have_content("Court Report Due Date:")
Expand Down Expand Up @@ -112,7 +112,7 @@
click_on "Create CASA Case"
end

expect(page.body).to have_content(case_number)
expect(page).to have_content(case_number)
expect(page).to have_content("CASA case was successfully created.")
expect(page).to have_content("Next Court Date:")
expect(page).not_to have_content("Court Report Due Date:")
Expand Down
11 changes: 0 additions & 11 deletions spec/system/case_contacts/index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,6 @@
expect(page).to have_text(case_contacts[2].contact_groups_with_types.keys.first)
end
end

it "sorts case_contacts by occurred_at attribute (default)" do
case_contacts
sign_in volunteer
visit case_contacts_path

aggregate_failures do
expect(page.body.index(case_contacts[2].decorate.subheading)).to be < page.body.index(case_contacts[1].decorate.subheading)
expect(page.body.index(case_contacts[1].decorate.subheading)).to be < page.body.index(case_contacts[0].decorate.subheading)
end
end
end

describe "filtering case contacts" do
Expand Down
5 changes: 1 addition & 4 deletions spec/system/case_contacts/new_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,7 @@
click_on "Continue Submitting"
}.to change(CaseContact, :count).by(1)

hello_line = page.body.split("\n").select { |x| x.include?("Hello") }
expect(hello_line.first.include?(note_content)).to be true
expected_text = strip_tags(note_content)
expect(page).to have_css("#case_contacts_list h1", text: expected_text)
expect(page).to have_css("#case_contacts_list h1", text: "Hello world")
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions spec/system/court_dates/edit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@
expect(CourtDate.count).to eq 2
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
page.find("a", text: "Delete Future Court Date").click
page.driver.browser.switch_to.alert.accept

expect(page).to have_content "Court date was successfully deleted."
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(CourtDate.count).to eq 1
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/system/court_dates/new_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

context "when all fields are filled" do
it "is successful", js: true do
expect(page.body).to have_content(casa_case.case_number)
expect(page).to have_content(casa_case.case_number)

fill_in "court_date_date", with: :now
fill_in "court_date_court_report_due_date", with: :now
Expand All @@ -38,7 +38,7 @@
end

expect(page).to have_content("Court date was successfully created.")
expect(page.body).to have_content(casa_case.case_number)
expect(page).to have_content(casa_case.case_number)
expect(page).to have_content("Court Report Due Date:")
expect(page).to have_content(judge.name)
expect(page).to have_content(hearing_type.name)
Expand Down

0 comments on commit 1cb59dc

Please sign in to comment.