diff options
Diffstat (limited to 'qa/qa/page/component/select2.rb')
-rw-r--r-- | qa/qa/page/component/select2.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/qa/qa/page/component/select2.rb b/qa/qa/page/component/select2.rb index b8beb64b6bd..761bbb17168 100644 --- a/qa/qa/page/component/select2.rb +++ b/qa/qa/page/component/select2.rb @@ -8,6 +8,10 @@ module QA find('.select2-result-label', text: item_text, match: :prefer_exact).click end + def has_item?(item_text) + has_css?('.select2-result-label', text: item_text, match: :prefer_exact) + end + def current_selection find('.select2-chosen').text end @@ -25,8 +29,12 @@ module QA end def search_and_select(item_text) + QA::Runtime::Logger.info "Searching and selecting: #{item_text}" + search_item(item_text) + raise QA::Page::Base::ElementNotFound, %Q(Couldn't find option named "#{item_text}") unless has_item?(item_text) + select_item(item_text) end |