2022-01-01 13:38:12 +00:00
|
|
|
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
2021-06-01 12:20:20 +00:00
|
|
|
|
2019-09-24 13:04:42 +00:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2020-06-18 11:51:25 +00:00
|
|
|
RSpec.describe 'Public Knowledge Base for guest search', type: :system, authenticated_as: false, searchindex: true do
|
2019-09-24 13:04:42 +00:00
|
|
|
include_context 'basic Knowledge Base'
|
|
|
|
|
|
|
|
before do
|
|
|
|
configure_elasticsearch(required: true, rebuild: true) do
|
2019-09-24 15:44:32 +00:00
|
|
|
published_answer && draft_answer && internal_answer
|
2019-09-24 13:04:42 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
visit help_no_locale_path
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows no results notification for gibberish search' do
|
|
|
|
find('.js-search-input').fill_in with: 'Asdasdasdasdasd'
|
|
|
|
expect(page).to have_text 'No results were found'
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'list published article' do
|
2019-10-22 09:40:35 +00:00
|
|
|
expect(page).to produce_search_result_for published_answer
|
2019-09-24 13:04:42 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'not list draft article' do
|
2019-10-22 09:40:35 +00:00
|
|
|
expect(page).not_to produce_search_result_for draft_answer
|
2019-09-24 13:04:42 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'not list internal article' do
|
2019-10-22 09:40:35 +00:00
|
|
|
expect(page).not_to produce_search_result_for internal_answer
|
2019-09-24 13:04:42 +00:00
|
|
|
end
|
|
|
|
end
|