summaryrefslogtreecommitdiff
path: root/spec/support/helpers/listbox_helpers.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-01-18 19:00:14 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-01-18 19:00:14 +0000
commit05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2 (patch)
tree11d0f2a6ec31c7793c184106cedc2ded3d9a2cc5 /spec/support/helpers/listbox_helpers.rb
parentec73467c23693d0db63a797d10194da9e72a74af (diff)
downloadgitlab-ce-05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2.tar.gz
Add latest changes from gitlab-org/gitlab@15-8-stable-eev15.8.0-rc42
Diffstat (limited to 'spec/support/helpers/listbox_helpers.rb')
-rw-r--r--spec/support/helpers/listbox_helpers.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/support/helpers/listbox_helpers.rb b/spec/support/helpers/listbox_helpers.rb
new file mode 100644
index 00000000000..5fcd05f31fb
--- /dev/null
+++ b/spec/support/helpers/listbox_helpers.rb
@@ -0,0 +1,24 @@
+# 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-listbox-item[role="option"]', text: text, exact_text: exact_text).click
+ end
+
+ def expect_listbox_item(text)
+ expect(page).to have_css('.gl-listbox-item[role="option"]', text: text)
+ end
+
+ def expect_no_listbox_item(text)
+ expect(page).not_to have_css('.gl-listbox-item[role="option"]', text: text)
+ end
+
+ def expect_listbox_items(items)
+ expect(find_all('.gl-listbox-item[role="option"]').map(&:text)).to eq(items)
+ end
+end