diff options
author | khm <khm@sciops.net> | 2019-04-29 14:31:28 +0300 |
---|---|---|
committer | James Lopez <james@gitlab.com> | 2019-04-29 14:31:28 +0300 |
commit | 2f36efa0871b61df2aa5f8c7546ac95148ecf4de (patch) | |
tree | f99cb9317506812f4ccbd9a4ffa4a023c2505137 /spec/features/search | |
parent | 33d5ec5b56b680f299ddd2b2f5bd666141eafefc (diff) |
Fix links to wiki pages with subdirectories
This commit contains the patch suggested by @fjsanpedro in the issue
covering broken links in wiki search results.
Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/56234
Diffstat (limited to 'spec/features/search')
-rw-r--r-- | spec/features/search/user_searches_for_wiki_pages_spec.rb | 36 |
1 files changed, 25 insertions, 11 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 7225ca65492..6d4facd0649 100644 --- a/spec/features/search/user_searches_for_wiki_pages_spec.rb +++ b/spec/features/search/user_searches_for_wiki_pages_spec.rb @@ -14,22 +14,36 @@ describe 'User searches for wiki pages', :js do include_examples 'top right search form' - it 'finds a page' do - find('.js-search-project-dropdown').click + shared_examples 'search wiki blobs' do + it 'finds a page' do + find('.js-search-project-dropdown').click - page.within('.project-filter') do - click_link(project.full_name) - end + page.within('.project-filter') do + click_link(project.full_name) + end + + fill_in('dashboard_search', with: 'content') + find('.btn-search').click + + page.within('.search-filter') do + click_link('Wiki') + end - fill_in('dashboard_search', with: 'content') - find('.btn-search').click + page.within('.results') do + expect(find(:css, '.search-results')).to have_link(wiki_page.title, href: project_wiki_path(project, wiki_page.slug)) + end + end + end - page.within('.search-filter') do - click_link('Wiki') + context 'when searching by content' do + it_behaves_like 'search wiki blobs' do + let(:search_term) { 'content' } end + end - page.within('.results') do - expect(find(:css, '.search-results')).to have_link(wiki_page.title) + context 'when searching by title' do + it_behaves_like 'search wiki blobs' do + let(:search_term) { 'test_wiki' } end end end |