do let!(:user) { create(:user) } ! before do create_list(:message, 1_000, recipient: user) log_in(user) end ! it "is fast!" do measure do visit(messages_path) ! 10.times do |i| # Refresh the page twice 2.times { visit(current_path) } ! # Select the first 100 unread messages dom_messages = DOM::Message.all dom_messages.slice(i * 100, 100).each(&:select) ! # Mark the selected messages as read click_button("Mark as Read") end # Rinse, repeat end end end