Welcome to mirror list, hosted at ThFree Co, Russian Federation.

listbox_helpers.rb « helpers « support « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7a734d2b0975f7eb7499e3dc82f48875b2311f6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# frozen_string_literal: true

module ListboxHelpers
  def select_from_listbox(text, from:, exact_item_text: false)
    click_button from
    select_listbox_item(text, exact_text: exact_item_text)
  end

  def select_listbox_item(text, exact_text: false)
    find('.gl-new-dropdown-item[role="option"]', text: text, exact_text: exact_text).click
  end

  def select_disclosure_dropdown_item(text, exact_text: false)
    find('.gl-new-dropdown-item', text: text, exact_text: exact_text).click
  end

  def expect_listbox_item(text)
    expect(page).to have_css('.gl-new-dropdown-item[role="option"]', text: text)
  end

  def expect_no_listbox_item(text)
    expect(page).not_to have_css('.gl-new-dropdown-item[role="option"]', text: text)
  end

  def expect_listbox_items(items)
    expect(find_all('.gl-new-dropdown-item[role="option"]').map(&:text)).to eq(items)
  end
end