summaryrefslogtreecommitdiff
path: root/spec/support/helpers
diff options
context:
space:
mode:
authorHeinrich Lee Yu <heinrich@gitlab.com>2019-04-27 00:09:20 +0800
committerHeinrich Lee Yu <heinrich@gitlab.com>2019-05-03 09:29:49 +0800
commit364d948b8e5f6f8bb0a2c44b50b00f0ef1eb6a1f (patch)
treedd7ca36ab859d2b926bcf65c850e975c82701cff /spec/support/helpers
parent7be2796e24e86c421c8988f454c51755b7f3e153 (diff)
downloadgitlab-ce-364d948b8e5f6f8bb0a2c44b50b00f0ef1eb6a1f.tar.gz
Fix false positives in filtered search specsfix-search-bar-specs
Assertions were made based on elements found so the specs still pass even if the elements don't exist
Diffstat (limited to 'spec/support/helpers')
-rw-r--r--spec/support/helpers/filtered_search_helpers.rb17
1 files changed, 7 insertions, 10 deletions
diff --git a/spec/support/helpers/filtered_search_helpers.rb b/spec/support/helpers/filtered_search_helpers.rb
index 03057a102c5..34ef185ea27 100644
--- a/spec/support/helpers/filtered_search_helpers.rb
+++ b/spec/support/helpers/filtered_search_helpers.rb
@@ -78,20 +78,17 @@ module FilteredSearchHelpers
# .tokens-container to make sure the correct names and values are rendered
def expect_tokens(tokens)
page.within '.filtered-search-box .tokens-container' do
- page.all(:css, '.tokens-container li .selectable').each_with_index do |el, index|
- token_name = tokens[index][:name]
- token_value = tokens[index][:value]
- token_emoji = tokens[index][:emoji_name]
+ token_elements = page.all(:css, 'li.filtered-search-token')
- expect(el.find('.name')).to have_content(token_name)
+ tokens.each_with_index do |token, index|
+ el = token_elements[index]
- if token_value
- expect(el.find('.value')).to have_content(token_value)
- end
+ expect(el.find('.name')).to have_content(token[:name])
+ expect(el.find('.value')).to have_content(token[:value]) if token[:value].present?
# gl-emoji content is blank when the emoji unicode is not supported
- if token_emoji
- selector = %(gl-emoji[data-name="#{token_emoji}"])
+ if token[:emoji_name].present?
+ selector = %(gl-emoji[data-name="#{token[:emoji_name]}"])
expect(el.find('.value')).to have_css(selector)
end
end