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

user_searches_for_wiki_pages_spec.rb « search « features « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4de28a99c21564ec6b4bd1e39383f58efb6c0ab2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'User searches for wiki pages', :js, :clean_gitlab_redis_rate_limiting,
  feature_category: :global_search do
  include ListboxHelpers
  let_it_be(:user) { create(:user) }
  let_it_be(:project) { create(:project, :repository, :wiki_repo, namespace: user.namespace) }
  let_it_be(:wiki_page) do
    create(:wiki_page, wiki: project.wiki, title: 'directory/title', content: 'Some Wiki content')
  end

  before do
    project.add_maintainer(user)
    sign_in(user)

    visit(search_path)
  end

  include_examples 'top right search form'
  include_examples 'search timeouts', 'wiki_blobs' do
    let(:additional_params) { { project_id: project.id } }
  end

  shared_examples 'search wiki blobs' do
    it 'finds a page' do
      find('[data-testid="project-filter"]').click

      wait_for_requests

      page.within('[data-testid="project-filter"]') do
        select_listbox_item project.name
      end

      submit_dashboard_search(search_term)
      select_search_scope('Wiki')

      page.within('.results') do
        expect(page).to have_link(wiki_page.title, href: project_wiki_path(project, wiki_page.slug))
      end
    end
  end

  context 'when searching by content' do
    it_behaves_like 'search wiki blobs' do
      let(:search_term) { 'content' }
    end
  end

  context 'when searching by title' do
    it_behaves_like 'search wiki blobs' do
      let(:search_term) { 'title' }
    end
  end
end