Fix 2.4.2 upgrade notes formatting refs #19330
[arvados.git] / apps / workbench / test / integration / filterable_infinite_scroll_test.rb
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: AGPL-3.0
4
5 require 'integration_helper'
6
7 class FilterableInfiniteScrollTest < ActionDispatch::IntegrationTest
8   setup do
9     need_javascript
10   end
11
12   # Chrome remembers what you had in the text field when you hit
13   # "back". Here, we simulate the same effect by sending an otherwise
14   # unused ?search=foo param to pre-populate the search field.
15   test 'no double-load if text input has a value at page load time' do
16     visit page_with_token('admin', '/pipeline_instances')
17     assert_text 'pipeline_with_job'
18     visit page_with_token('admin', '/pipeline_instances?search=pipeline_with_tagged')
19     # Horrible hack to ensure the search results can't load correctly
20     # on the second attempt.
21     assert_selector '#recent-pipeline-instances'
22     assert page.evaluate_script('$("#recent-pipeline-instances[data-infinite-content-href0]").attr("data-infinite-content-href0","/give-me-an-error").length == 1')
23     # Wait for the first page of results to appear.
24     assert_text 'pipeline_with_tagged_collection_input'
25     # Make sure the results are filtered.
26     assert_no_text 'pipeline_with_job'
27     # Make sure pipeline_with_job didn't disappear merely because
28     # the results were replaced with an error message.
29     assert_text 'pipeline_with_tagged_collection_input'
30   end
31 end