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