lib/agilibox/cucumber_helpers/select2.rb in agilibox-1.5.0 vs lib/agilibox/cucumber_helpers/select2.rb in agilibox-1.5.1

- old
+ new

@@ -1,10 +1,23 @@ module CapybaraSelect2 - def select2(selector, query, label = query) - selector = "##{selector}" if selector.is_a?(Symbol) - find("#{selector} + .select2-container").click + def select2_search(id, query) + find("##{id} + .select2-container").click find(".select2-search__field").set(query.to_s) + end + + def select2(id, query, label = query) + select2_search(id, query) find(".select2-results li", text: label.to_s).click + end + + def select2_expect_have_result(id, query, label = query) + select2_search(id, query) + expect(page).to have_selector(".select2-results li", text: label.to_s) + end + + def select2_expect_have_no_result(id, query, label = query) + select2_search(id, query) + expect(page).to have_no_selector(".select2-results li", text: label.to_s) end end World(CapybaraSelect2)