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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/shared_examples/features/search_settings_shared_examples.rb')
-rw-r--r--spec/support/shared_examples/features/search_settings_shared_examples.rb42
1 files changed, 42 insertions, 0 deletions
diff --git a/spec/support/shared_examples/features/search_settings_shared_examples.rb b/spec/support/shared_examples/features/search_settings_shared_examples.rb
new file mode 100644
index 00000000000..6a507c4be56
--- /dev/null
+++ b/spec/support/shared_examples/features/search_settings_shared_examples.rb
@@ -0,0 +1,42 @@
+# frozen_string_literal: true
+
+RSpec.shared_examples 'cannot search settings' do
+ it 'does note have search settings field' do
+ expect(page).not_to have_field(placeholder: SearchHelpers::INPUT_PLACEHOLDER)
+ end
+end
+
+RSpec.shared_examples 'can search settings' do |search_term, non_match_section|
+ it 'has search settings field' do
+ expect(page).to have_field(placeholder: SearchHelpers::INPUT_PLACEHOLDER)
+ end
+
+ it 'hides unmatching sections on search' do
+ expect(page).to have_content(non_match_section)
+
+ fill_in SearchHelpers::INPUT_PLACEHOLDER, with: search_term
+
+ expect(page).to have_content(search_term)
+ expect(page).not_to have_content(non_match_section)
+ end
+end
+
+RSpec.shared_examples 'can search settings with feature flag check' do |search_term, non_match_section|
+ let(:flag) { true }
+
+ before do
+ stub_feature_flags(search_settings_in_page: flag)
+
+ visit(visit_path)
+ end
+
+ context 'with feature flag on' do
+ it_behaves_like 'can search settings', search_term, non_match_section
+ end
+
+ context 'with feature flag off' do
+ let(:flag) { false }
+
+ it_behaves_like 'cannot search settings'
+ end
+end