diff options
Diffstat (limited to 'spec/support/filtered_search_helpers.rb')
-rw-r--r-- | spec/support/filtered_search_helpers.rb | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/spec/support/filtered_search_helpers.rb b/spec/support/filtered_search_helpers.rb index 58f6636e680..f43379f258e 100644 --- a/spec/support/filtered_search_helpers.rb +++ b/spec/support/filtered_search_helpers.rb @@ -4,7 +4,7 @@ module FilteredSearchHelpers end def input_filtered_search(search_term, submit: true) - filtered_search.set(search_term) + filtered_search.set("#{search_term} ") if submit filtered_search.send_keys(:enter) @@ -12,7 +12,7 @@ module FilteredSearchHelpers end def input_filtered_search_keys(search_term) - filtered_search.send_keys(search_term) + filtered_search.send_keys("#{search_term} ") filtered_search.send_keys(:enter) end @@ -34,4 +34,22 @@ module FilteredSearchHelpers # This ensures the dropdown is shown expect(find('#js-dropdown-label')).not_to have_css('.filter-dropdown-loading') end + + def expect_filtered_search_input_empty + expect(find('.filtered-search').value).to eq('') + end + + def expect_tokens(tokens) + page.find '.filtered-search-input-container .tokens-container' do + page.all(:css, '.tokens-container li').each_with_index do |el, index| + token_name = tokens[index]['Name'] + token_value = tokens[index]['Value'] + + expect(el.find('.name')).to have_content(token_name) + if token_value + expect(el.find('.value')).to have_content(token_value) + end + end + end + end end |