Commit 7e5c1737 authored by Rémy Coutable's avatar Rémy Coutable

Add wait_for_all_requests to search feature specs

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 9f3329c3
......@@ -30,6 +30,8 @@ RSpec.describe 'User uses header search field', :js do
before do
find('#search')
find('body').native.send_keys('s')
wait_for_all_requests
end
it 'shows the category search dropdown' do
......@@ -89,9 +91,7 @@ RSpec.describe 'User uses header search field', :js do
context 'when entering text into the search field' do
it 'does not display the category search dropdown' do
page.within('.search-input-wrap') do
fill_in('search', with: scope_name.first(4))
end
fill_in_search(scope_name.first(4))
expect(page).not_to have_selector('.dropdown-header', text: /#{scope_name}/i)
end
......@@ -105,9 +105,7 @@ RSpec.describe 'User uses header search field', :js do
end
it 'displays search options' do
page.within('.search-input-wrap') do
fill_in('search', with: 'test')
end
fill_in_search('test')
expect(page).to have_selector(scoped_search_link('test'))
end
......@@ -140,9 +138,7 @@ RSpec.describe 'User uses header search field', :js do
end
it 'displays search options' do
page.within('.search-input-wrap') do
fill_in('search', with: 'test')
end
fill_in_search('test')
expect(page).to have_selector(scoped_search_link('test'))
expect(page).to have_selector(scoped_search_link('test', group_id: group.id))
......@@ -157,9 +153,7 @@ RSpec.describe 'User uses header search field', :js do
end
it 'displays search options' do
page.within('.search-input-wrap') do
fill_in('search', with: 'test')
end
fill_in_search('test')
expect(page).to have_selector(scoped_search_link('test'))
expect(page).not_to have_selector(scoped_search_link('test', group_id: project.namespace_id))
......@@ -182,9 +176,7 @@ RSpec.describe 'User uses header search field', :js do
end
it 'displays search options' do
page.within('.search-input-wrap') do
fill_in('search', with: 'test')
end
fill_in_search('test')
expect(page).to have_selector(scoped_search_link('test'))
expect(page).to have_selector(scoped_search_link('test', group_id: group.id))
......@@ -208,9 +200,7 @@ RSpec.describe 'User uses header search field', :js do
end
it 'displays search options' do
page.within('.search-input-wrap') do
fill_in('search', with: 'test')
end
fill_in_search('test')
expect(page).to have_selector(scoped_search_link('test'))
expect(page).to have_selector(scoped_search_link('test', group_id: subgroup.id))
......
......@@ -124,6 +124,7 @@ RSpec.configure do |config|
config.include LoginHelpers, type: :feature
config.include SearchHelpers, type: :feature
config.include WaitHelpers, type: :feature
config.include WaitForRequests, type: :feature
config.include EmailHelpers, :mailer, type: :mailer
config.include Warden::Test::Helpers, type: :request
config.include Gitlab::Routing, type: :routing
......@@ -133,7 +134,6 @@ RSpec.configure do |config|
config.include InputHelper, :js
config.include SelectionHelper, :js
config.include InspectRequests, :js
config.include WaitForRequests, :js
config.include LiveDebugger, :js
config.include MigrationsHelpers, :migration
config.include RedisHelpers
......
# frozen_string_literal: true
module SearchHelpers
def fill_in_search(text)
page.within('.search-input-wrap') do
fill_in('search', with: text)
end
wait_for_all_requests
end
def submit_search(query, scope: nil)
page.within('.search-form, .search-page-form') do
field = find_field('search')
......@@ -11,6 +19,8 @@ module SearchHelpers
else
click_button('Search')
end
wait_for_all_requests
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment