closes #4024
[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     headless = Headless.new
6     headless.start
7     Capybara.current_driver = :selenium
8   end
9
10   # Chrome remembers what you had in the text field when you hit
11   # "back". Here, we simulate the same effect by sending an otherwise
12   # unused ?search=foo param to pre-populate the search field.
13   test 'no double-load if text input has a value at page load time' do
14     visit page_with_token('admin', '/pipeline_instances')
15     assert_text 'pipeline_2'
16     visit page_with_token('admin', '/pipeline_instances?search=pipeline_1')
17     # Horrible hack to ensure the search results can't load correctly
18     # on the second attempt.
19     assert_selector '#recent-pipeline-instances'
20     assert page.evaluate_script('$("#recent-pipeline-instances[data-infinite-content-href0]").attr("data-infinite-content-href0","/give-me-an-error").length == 1')
21     # Wait for the first page of results to appear.
22     assert_text 'pipeline_1'
23     # Make sure the results are filtered.
24     assert_no_text 'pipeline_2'
25     # Make sure pipeline_2 didn't disappear merely because the results
26     # were replaced with an error message.
27     assert_text 'pipeline_1'
28   end
29 end