Skip to content

Commit

Permalink
Make course group best efforts spec more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
moveson committed Dec 22, 2024
1 parent 1bb0eb4 commit 0026118
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion spec/system/visit_course_group_best_efforts_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
let(:organization) { course_group.organization }
# Expected count is the number of finished efforts + 1 for the header row
let(:expected_count) { ::Effort.where(event: course_group_events).finished.count + 1 }
let(:half_of_expected) { expected_count / 2 }

before { EffortSegment.set_all }
after { EffortSegment.delete_all }
Expand All @@ -21,12 +22,17 @@
end

scenario "Visitor visits the page and uses auto pagination" do
visit_page_with_pagination(20)
visit_page_with_pagination(half_of_expected)
scroll_to_bottom_of_page
expect(page).not_to have_link("Show More")
expect(page).to have_text("End of List")
end

def visit_page_with_pagination(per_page)
visit organization_course_group_best_efforts_path(course_group.organization, course_group, per_page: per_page)
end

def scroll_to_bottom_of_page
execute_script('window.scrollTo(0, document.body.scrollHeight)')
end
end

0 comments on commit 0026118

Please sign in to comment.