Commit 2126f8f3 authored by Eric Eastwood's avatar Eric Eastwood

Fix flakey user/assignee autocomplete dropdown

Related to https://gitlab.com/gitlab-org/gitlab-ce/issues/38664

This previously worked because, it would assert the correct names
in the full list and then wait for the list to go blank for the NOT assertion

Example failure, https://gitlab.com/gitlab-org/gitlab-ee/-/jobs/74649299
parent 69966fcb
...@@ -79,23 +79,21 @@ describe 'Dropdown assignee', :js do ...@@ -79,23 +79,21 @@ describe 'Dropdown assignee', :js do
end end
it 'filters by name' do it 'filters by name' do
filtered_search.send_keys('j') input_filtered_search('jac', 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_jacob.name) expect(find("#{js_dropdown_assignee} .filter-dropdown")).to have_content(user_jacob.name)
expect(find("#{js_dropdown_assignee} .filter-dropdown")).to have_no_content(user.name) expect(find("#{js_dropdown_assignee} .filter-dropdown")).to have_no_content(user.name)
end end
it 'filters by case insensitive name' do it 'filters by case insensitive name' do
filtered_search.send_keys('J') input_filtered_search('JAC', 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_jacob.name) expect(find("#{js_dropdown_assignee} .filter-dropdown")).to have_content(user_jacob.name)
expect(find("#{js_dropdown_assignee} .filter-dropdown")).to have_no_content(user.name) expect(find("#{js_dropdown_assignee} .filter-dropdown")).to have_no_content(user.name)
end end
it 'filters by username with symbol' do it 'filters by username with symbol' do
filtered_search.send_keys('@ot') input_filtered_search('@ott', submit: false, extra_space: false)
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)
expect(find("#{js_dropdown_assignee} .filter-dropdown")).to have_content(user.name) expect(find("#{js_dropdown_assignee} .filter-dropdown")).to have_content(user.name)
...@@ -103,7 +101,7 @@ describe 'Dropdown assignee', :js do ...@@ -103,7 +101,7 @@ describe 'Dropdown assignee', :js do
end end
it 'filters by case insensitive username with symbol' do it 'filters by case insensitive username with symbol' do
filtered_search.send_keys('@OT') input_filtered_search('@OTT', submit: false, extra_space: false)
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)
expect(find("#{js_dropdown_assignee} .filter-dropdown")).to have_content(user.name) expect(find("#{js_dropdown_assignee} .filter-dropdown")).to have_content(user.name)
...@@ -111,7 +109,9 @@ describe 'Dropdown assignee', :js do ...@@ -111,7 +109,9 @@ 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('ot') filtered_search.send_keys('ott')
wait_for_requests
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)
expect(find("#{js_dropdown_assignee} .filter-dropdown")).to have_content(user.name) expect(find("#{js_dropdown_assignee} .filter-dropdown")).to have_content(user.name)
...@@ -119,7 +119,9 @@ describe 'Dropdown assignee', :js do ...@@ -119,7 +119,9 @@ 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('OT') filtered_search.send_keys('OTT')
wait_for_requests
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)
expect(find("#{js_dropdown_assignee} .filter-dropdown")).to have_content(user.name) expect(find("#{js_dropdown_assignee} .filter-dropdown")).to have_content(user.name)
......
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