4754: search_test assertions
[arvados.git] / apps / workbench / test / performance / search_test.rb
1 # http://guides.rubyonrails.org/v3.2.13/performance_testing.html
2
3 require 'test_helper'
4 require 'rails/performance_test_help'
5 require 'integration_helper'
6 require 'selenium-webdriver'
7 require 'headless'
8
9 class SearchTest < ActionDispatch::PerformanceTest
10   self.profile_options = { :runs => 10,
11                            :metrics => [:wall_time],
12                            :output => 'tmp/performance',
13                            :formats => [:flat] }
14
15   setup do
16     headless = Headless.new
17     headless.start
18     Capybara.current_driver = :selenium
19     Capybara.current_session.driver.browser.manage.window.resize_to(1024, 768)
20   end
21
22   def test_search
23     visit page_with_token('active')
24
25     within('.navbar-fixed-top') do
26       page.find_field('search').set('hash')
27       page.find('.glyphicon-search').click
28     end
29
30     # We should now be in the search dialog. Expect at least one item in the result display.
31     within '.modal-content' do
32       assert_text 'All projects'
33       assert_text 'Search'
34       assert_selector('div', text: 'zzzzz-')
35     end
36   end
37 end