debian-mirror-gitlab/spec/support/helpers/listbox_helpers.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

25 lines
730 B
Ruby
Raw Normal View History

2023-03-17 16:20:25 +05:30
# 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)
2023-04-23 21:23:45 +05:30
find('.gl-new-dropdown-item[role="option"]', text: text, exact_text: exact_text).click
2023-03-17 16:20:25 +05:30
end
def expect_listbox_item(text)
2023-04-23 21:23:45 +05:30
expect(page).to have_css('.gl-new-dropdown-item[role="option"]', text: text)
2023-03-17 16:20:25 +05:30
end
def expect_no_listbox_item(text)
2023-04-23 21:23:45 +05:30
expect(page).not_to have_css('.gl-new-dropdown-item[role="option"]', text: text)
2023-03-17 16:20:25 +05:30
end
def expect_listbox_items(items)
2023-04-23 21:23:45 +05:30
expect(find_all('.gl-new-dropdown-item[role="option"]').map(&:text)).to eq(items)
2023-03-17 16:20:25 +05:30
end
end