summaryrefslogtreecommitdiff
path: root/spec/features
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-10-30 09:08:39 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-10-30 09:08:39 +0000
commit6462f5216f381ffb04665581e71b70e859a6f398 (patch)
tree980c4c4bf913fae0316a1b7fcf63ddfcfd7b762d /spec/features
parentd91998617f3825e906b35f4406d641af7f59e832 (diff)
downloadgitlab-ce-6462f5216f381ffb04665581e71b70e859a6f398.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features')
-rw-r--r--spec/features/global_search_spec.rb8
-rw-r--r--spec/features/search/user_uses_header_search_field_spec.rb50
2 files changed, 51 insertions, 7 deletions
diff --git a/spec/features/global_search_spec.rb b/spec/features/global_search_spec.rb
index 0ca626381d4..e6e4a55c1bb 100644
--- a/spec/features/global_search_spec.rb
+++ b/spec/features/global_search_spec.rb
@@ -36,15 +36,15 @@ RSpec.describe 'Global search' do
end
end
- it 'closes the dropdown on blur', :js, quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/201841' do
+ it 'closes the dropdown on blur', :js do
+ find('#search').click
fill_in 'search', with: "a"
- dropdown = find('.js-dashboard-search-options')
- expect(dropdown[:class]).to include 'show'
+ expect(page).to have_selector("div[data-testid='dashboard-search-options'].show")
find('#search').send_keys(:backspace)
find('body').click
- expect(dropdown[:class]).not_to include 'show'
+ expect(page).to have_no_selector("div[data-testid='dashboard-search-options'].show")
end
end
diff --git a/spec/features/search/user_uses_header_search_field_spec.rb b/spec/features/search/user_uses_header_search_field_spec.rb
index c2d5b0acda6..9296a3f33d4 100644
--- a/spec/features/search/user_uses_header_search_field_spec.rb
+++ b/spec/features/search/user_uses_header_search_field_spec.rb
@@ -5,11 +5,18 @@ require 'spec_helper'
RSpec.describe 'User uses header search field', :js do
include FilteredSearchHelpers
- let(:project) { create(:project) }
- let(:user) { create(:user) }
+ let_it_be(:project) { create(:project, :repository) }
+ let_it_be(:reporter) { create(:user) }
+ let_it_be(:developer) { create(:user) }
+
+ let(:user) { reporter }
+
+ before_all do
+ project.add_reporter(reporter)
+ project.add_developer(developer)
+ end
before do
- project.add_reporter(user)
sign_in(user)
end
@@ -132,6 +139,10 @@ RSpec.describe 'User uses header search field', :js do
let(:group) { create(:group) }
let(:project) { create(:project, namespace: group) }
+ before do
+ project.add_reporter(user)
+ end
+
include_examples 'search field examples' do
let(:url) { project_path(project) }
let(:scope_name) { project.name }
@@ -159,6 +170,35 @@ RSpec.describe 'User uses header search field', :js do
expect(page).not_to have_selector(scoped_search_link('test', group_id: project.namespace_id))
expect(page).to have_selector(scoped_search_link('test', project_id: project.id))
end
+
+ it 'displays a link to project merge requests' do
+ fill_in_search('Merge')
+
+ within(dashboard_search_options_popup_menu) do
+ expect(page).to have_text('Merge Requests')
+ end
+ end
+
+ it 'does not display a link to project feature flags' do
+ fill_in_search('Feature')
+
+ within(dashboard_search_options_popup_menu) do
+ expect(page).to have_text('"Feature" in all GitLab')
+ expect(page).to have_no_text('Feature Flags')
+ end
+ end
+
+ context 'and user is a developer' do
+ let(:user) { developer }
+
+ it 'displays a link to project feature flags' do
+ fill_in_search('Feature')
+
+ within(dashboard_search_options_popup_menu) do
+ expect(page).to have_text('Feature Flags')
+ end
+ end
+ end
end
end
@@ -217,4 +257,8 @@ RSpec.describe 'User uses header search field', :js do
".dropdown a[href='#{href}']"
end
+
+ def dashboard_search_options_popup_menu
+ "div[data-testid='dashboard-search-options']"
+ end
end