Commit 9201e42a authored by Eric Eastwood's avatar Eric Eastwood

Update dropdown_assignee_spec with filtered_search_helpers

parent 2126f8f3
...@@ -31,7 +31,7 @@ describe 'Dropdown assignee', :js do ...@@ -31,7 +31,7 @@ describe 'Dropdown assignee', :js do
describe 'behavior' do describe 'behavior' do
it 'opens when the search bar has assignee:' do it 'opens when the search bar has assignee:' do
filtered_search.set('assignee:') input_filtered_search('assignee:', submit: false, extra_space: false)
expect(page).to have_css(js_dropdown_assignee, visible: true) expect(page).to have_css(js_dropdown_assignee, visible: true)
end end
...@@ -44,6 +44,7 @@ describe 'Dropdown assignee', :js do ...@@ -44,6 +44,7 @@ describe 'Dropdown assignee', :js do
it 'should show loading indicator when opened' do it 'should show loading indicator when opened' do
slow_requests do slow_requests do
# We aren't using `input_filtered_search` because we want to see the loading indicator
filtered_search.set('assignee:') filtered_search.set('assignee:')
expect(page).to have_css('#js-dropdown-assignee .filter-dropdown-loading', visible: true) expect(page).to have_css('#js-dropdown-assignee .filter-dropdown-loading', visible: true)
...@@ -51,19 +52,19 @@ describe 'Dropdown assignee', :js do ...@@ -51,19 +52,19 @@ describe 'Dropdown assignee', :js do
end end
it 'should hide loading indicator when loaded' do it 'should hide loading indicator when loaded' do
filtered_search.set('assignee:') input_filtered_search('assignee:', submit: false, extra_space: false)
expect(find(js_dropdown_assignee)).not_to have_css('.filter-dropdown-loading') expect(find(js_dropdown_assignee)).not_to have_css('.filter-dropdown-loading')
end end
it 'should load all the assignees when opened' do it 'should load all the assignees when opened' do
filtered_search.set('assignee:') input_filtered_search('assignee:', submit: false, extra_space: false)
expect(dropdown_assignee_size).to eq(4) expect(dropdown_assignee_size).to eq(4)
end end
it 'shows current user at top of dropdown' do it 'shows current user at top of dropdown' do
filtered_search.set('assignee:') input_filtered_search('assignee:', submit: false, extra_space: false)
expect(filter_dropdown.first('.filter-dropdown-item')).to have_content(user.name) expect(filter_dropdown.first('.filter-dropdown-item')).to have_content(user.name)
end end
...@@ -71,7 +72,7 @@ describe 'Dropdown assignee', :js do ...@@ -71,7 +72,7 @@ describe 'Dropdown assignee', :js do
describe 'filtering' do describe 'filtering' do
before do before do
filtered_search.set('assignee:') input_filtered_search('assignee:', submit: false, extra_space: false)
expect(find("#{js_dropdown_assignee} .filter-dropdown")).to have_content(user_john.name) expect(find("#{js_dropdown_assignee} .filter-dropdown")).to have_content(user_john.name)
expect(find("#{js_dropdown_assignee} .filter-dropdown")).to have_content(user_jacob.name) expect(find("#{js_dropdown_assignee} .filter-dropdown")).to have_content(user_jacob.name)
...@@ -109,7 +110,7 @@ describe 'Dropdown assignee', :js do ...@@ -109,7 +110,7 @@ describe 'Dropdown assignee', :js do
end end
it 'filters by username without symbol' do it 'filters by username without symbol' do
filtered_search.send_keys('ott') input_filtered_search('ott', submit: false, extra_space: false)
wait_for_requests wait_for_requests
...@@ -119,7 +120,7 @@ describe 'Dropdown assignee', :js do ...@@ -119,7 +120,7 @@ describe 'Dropdown assignee', :js do
end end
it 'filters by case insensitive username without symbol' do it 'filters by case insensitive username without symbol' do
filtered_search.send_keys('OTT') input_filtered_search('OTT', submit: false, extra_space: false)
wait_for_requests wait_for_requests
...@@ -131,7 +132,7 @@ describe 'Dropdown assignee', :js do ...@@ -131,7 +132,7 @@ describe 'Dropdown assignee', :js do
describe 'selecting from dropdown' do describe 'selecting from dropdown' do
before do before do
filtered_search.set('assignee:') input_filtered_search('assignee:', submit: false, extra_space: false)
end end
it 'fills in the assignee username when the assignee has not been filtered' do it 'fills in the assignee username when the assignee has not been filtered' do
...@@ -145,7 +146,7 @@ describe 'Dropdown assignee', :js do ...@@ -145,7 +146,7 @@ describe 'Dropdown assignee', :js do
end end
it 'fills in the assignee username when the assignee has been filtered' do it 'fills in the assignee username when the assignee has been filtered' do
filtered_search.send_keys('roo') input_filtered_search('roo', submit: false, extra_space: false)
click_assignee(user.name) click_assignee(user.name)
wait_for_requests wait_for_requests
...@@ -167,7 +168,7 @@ describe 'Dropdown assignee', :js do ...@@ -167,7 +168,7 @@ describe 'Dropdown assignee', :js do
describe 'selecting from dropdown without Ajax call' do describe 'selecting from dropdown without Ajax call' do
before do before do
Gitlab::Testing::RequestBlockerMiddleware.block_requests! Gitlab::Testing::RequestBlockerMiddleware.block_requests!
filtered_search.set('assignee:') input_filtered_search('assignee:', submit: false, extra_space: false)
end end
after do after do
...@@ -185,31 +186,31 @@ describe 'Dropdown assignee', :js do ...@@ -185,31 +186,31 @@ describe 'Dropdown assignee', :js do
describe 'input has existing content' do describe 'input has existing content' do
it 'opens assignee dropdown with existing search term' do it 'opens assignee dropdown with existing search term' do
filtered_search.set('searchTerm assignee:') input_filtered_search('searchTerm assignee:', submit: false, extra_space: false)
expect(page).to have_css(js_dropdown_assignee, visible: true) expect(page).to have_css(js_dropdown_assignee, visible: true)
end end
it 'opens assignee dropdown with existing author' do it 'opens assignee dropdown with existing author' do
filtered_search.set('author:@user assignee:') input_filtered_search('author:@user assignee:', submit: false, extra_space: false)
expect(page).to have_css(js_dropdown_assignee, visible: true) expect(page).to have_css(js_dropdown_assignee, visible: true)
end end
it 'opens assignee dropdown with existing label' do it 'opens assignee dropdown with existing label' do
filtered_search.set('label:~bug assignee:') input_filtered_search('label:~bug assignee:', submit: false, extra_space: false)
expect(page).to have_css(js_dropdown_assignee, visible: true) expect(page).to have_css(js_dropdown_assignee, visible: true)
end end
it 'opens assignee dropdown with existing milestone' do it 'opens assignee dropdown with existing milestone' do
filtered_search.set('milestone:%v1.0 assignee:') input_filtered_search('milestone:%v1.0 assignee:', submit: false, extra_space: false)
expect(page).to have_css(js_dropdown_assignee, visible: true) expect(page).to have_css(js_dropdown_assignee, visible: true)
end end
it 'opens assignee dropdown with existing my-reaction' do it 'opens assignee dropdown with existing my-reaction' do
filtered_search.set('my-reaction:star assignee:') input_filtered_search('my-reaction:star assignee:', submit: false, extra_space: false)
expect(page).to have_css(js_dropdown_assignee, visible: true) expect(page).to have_css(js_dropdown_assignee, visible: true)
end end
...@@ -217,8 +218,7 @@ describe 'Dropdown assignee', :js do ...@@ -217,8 +218,7 @@ describe 'Dropdown assignee', :js do
describe 'caching requests' do describe 'caching requests' do
it 'caches requests after the first load' do it 'caches requests after the first load' do
filtered_search.set('assignee') input_filtered_search('assignee:', submit: false, extra_space: false)
filtered_search.send_keys(':')
initial_size = dropdown_assignee_size initial_size = dropdown_assignee_size
expect(initial_size).to be > 0 expect(initial_size).to be > 0
...@@ -226,8 +226,7 @@ describe 'Dropdown assignee', :js do ...@@ -226,8 +226,7 @@ describe 'Dropdown assignee', :js do
new_user = create(:user) new_user = create(:user)
project.add_master(new_user) project.add_master(new_user)
find('.filtered-search-box .clear-search').click find('.filtered-search-box .clear-search').click
filtered_search.set('assignee') input_filtered_search('assignee:', submit: false, extra_space: false)
filtered_search.send_keys(':')
expect(dropdown_assignee_size).to eq(initial_size) expect(dropdown_assignee_size).to eq(initial_size)
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