summaryrefslogtreecommitdiff
path: root/spec/support/helpers/listbox_input_helper.rb
blob: ca7fbac5daa4fe9f2820383cd394ecc8723ca729 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

module ListboxInputHelper
  include WaitForRequests

  def listbox_input(value, from:)
    open_listbox_input(from) do
      find('[role="option"]', text: value).click
    end
  end

  def open_listbox_input(selector)
    page.within(selector) do
      page.find('button[aria-haspopup="listbox"]').click
      yield
    end
  end
end