diff options
Diffstat (limited to 'spec/features/search/user_searches_for_milestones_spec.rb')
-rw-r--r-- | spec/features/search/user_searches_for_milestones_spec.rb | 62 |
1 files changed, 27 insertions, 35 deletions
diff --git a/spec/features/search/user_searches_for_milestones_spec.rb b/spec/features/search/user_searches_for_milestones_spec.rb index e87c2176380..238e59be940 100644 --- a/spec/features/search/user_searches_for_milestones_spec.rb +++ b/spec/features/search/user_searches_for_milestones_spec.rb @@ -4,29 +4,42 @@ require 'spec_helper' RSpec.describe 'User searches for milestones', :js, :clean_gitlab_redis_rate_limiting, feature_category: :global_search do - using RSpec::Parameterized::TableSyntax - let_it_be(:user) { create(:user) } let_it_be(:project) { create(:project, namespace: user.namespace) } + let_it_be(:milestone1) { create(:milestone, title: 'Foo', project: project) } + let_it_be(:milestone2) { create(:milestone, title: 'Bar', project: project) } + + before do + project.add_maintainer(user) + sign_in(user) - let!(:milestone1) { create(:milestone, title: 'Foo', project: project) } - let!(:milestone2) { create(:milestone, title: 'Bar', project: project) } + visit(search_path) + end - where(search_page_vertical_nav_enabled: [true, false]) + include_examples 'top right search form' + include_examples 'search timeouts', 'milestones' - with_them do - before do - project.add_maintainer(user) - sign_in(user) - stub_feature_flags(search_page_vertical_nav: search_page_vertical_nav_enabled) + it 'finds a milestone' do + fill_in('dashboard_search', with: milestone1.title) + find('.gl-search-box-by-click-search-button').click + select_search_scope('Milestones') - visit(search_path) + page.within('.results') do + expect(page).to have_link(milestone1.title) + expect(page).not_to have_link(milestone2.title) end + end - include_examples 'top right search form' - include_examples 'search timeouts', 'milestones' - + context 'when on a project page' do it 'finds a milestone' do + find('[data-testid="project-filter"]').click + + wait_for_requests + + page.within('[data-testid="project-filter"]') do + click_on(project.name) + end + fill_in('dashboard_search', with: milestone1.title) find('.gl-search-box-by-click-search-button').click select_search_scope('Milestones') @@ -36,26 +49,5 @@ feature_category: :global_search do expect(page).not_to have_link(milestone2.title) end end - - context 'when on a project page' do - it 'finds a milestone' do - find('[data-testid="project-filter"]').click - - wait_for_requests - - page.within('[data-testid="project-filter"]') do - click_on(project.name) - end - - fill_in('dashboard_search', with: milestone1.title) - find('.gl-search-box-by-click-search-button').click - select_search_scope('Milestones') - - page.within('.results') do - expect(page).to have_link(milestone1.title) - expect(page).not_to have_link(milestone2.title) - end - end - end end end |