diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-16 21:11:26 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-16 21:11:26 +0300 |
commit | 8fa0c53e26c947ac647b8067fde3e9673b77b1a6 (patch) | |
tree | da32e7224125973e9e87d3856fb7e672ff41c8b1 /spec/features/search/user_searches_for_wiki_pages_spec.rb | |
parent | 0552020767452da44de2bf5424096f2cb2ea6bf5 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features/search/user_searches_for_wiki_pages_spec.rb')
-rw-r--r-- | spec/features/search/user_searches_for_wiki_pages_spec.rb | 70 |
1 files changed, 37 insertions, 33 deletions
diff --git a/spec/features/search/user_searches_for_wiki_pages_spec.rb b/spec/features/search/user_searches_for_wiki_pages_spec.rb index 2e390309022..0f20ad0aa07 100644 --- a/spec/features/search/user_searches_for_wiki_pages_spec.rb +++ b/spec/features/search/user_searches_for_wiki_pages_spec.rb @@ -2,55 +2,59 @@ require 'spec_helper' -RSpec.describe 'User searches for wiki pages', :js do - let(:user) { create(:user) } +RSpec.describe 'User searches for wiki pages', :js, :clean_gitlab_redis_rate_limiting do + using RSpec::Parameterized::TableSyntax + + let_it_be(:user) { create(:user) } + let(:project) { create(:project, :repository, :wiki_repo, namespace: user.namespace) } let!(:wiki_page) { create(:wiki_page, wiki: project.wiki, title: 'directory/title', content: 'Some Wiki content') } - before do - stub_feature_flags(search_page_vertical_nav: false) - project.add_maintainer(user) - sign_in(user) - - visit(search_path) - end + where(search_page_vertical_nav_enabled: [true, false]) + with_them do + before do + stub_feature_flags(search_page_vertical_nav: search_page_vertical_nav_enabled) + project.add_maintainer(user) + sign_in(user) - include_examples 'top right search form' - include_examples 'search timeouts', 'wiki_blobs' + visit(search_path) + end - shared_examples 'search wiki blobs' do - before do - stub_feature_flags(search_page_vertical_nav: false) + include_examples 'top right search form' + include_examples 'search timeouts', 'wiki_blobs' do + let(:additional_params) { { project_id: project.id } } end - it 'finds a page' do - find('[data-testid="project-filter"]').click + shared_examples 'search wiki blobs' do + it 'finds a page' do + find('[data-testid="project-filter"]').click - wait_for_requests + wait_for_requests - page.within('[data-testid="project-filter"]') do - click_on(project.name) - end + page.within('[data-testid="project-filter"]') do + click_on(project.name) + end - fill_in('dashboard_search', with: search_term) - find('.gl-search-box-by-click-search-button').click - select_search_scope('Wiki') + fill_in('dashboard_search', with: search_term) + find('.gl-search-box-by-click-search-button').click + select_search_scope('Wiki') - page.within('.results') do - expect(page).to have_link(wiki_page.title, href: project_wiki_path(project, wiki_page.slug)) + page.within('.results') do + expect(page).to have_link(wiki_page.title, href: project_wiki_path(project, wiki_page.slug)) + end end end - end - context 'when searching by content' do - it_behaves_like 'search wiki blobs' do - let(:search_term) { 'content' } + context 'when searching by content' do + it_behaves_like 'search wiki blobs' do + let(:search_term) { 'content' } + end end - end - context 'when searching by title' do - it_behaves_like 'search wiki blobs' do - let(:search_term) { 'title' } + context 'when searching by title' do + it_behaves_like 'search wiki blobs' do + let(:search_term) { 'title' } + end end end end |