guest_search_spec.rb 1002 B

1234567891011121314151617181920212223242526272829303132
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe 'Public Knowledge Base for guest search', authenticated_as: false, searchindex: true, type: :system do
  4. include_context 'basic Knowledge Base'
  5. before do
  6. published_answer && draft_answer && internal_answer
  7. searchindex_model_reload([KnowledgeBase::Translation, KnowledgeBase::Category::Translation, KnowledgeBase::Answer::Translation])
  8. visit help_no_locale_path
  9. end
  10. it 'shows no results notification for gibberish search' do
  11. find('.js-search-input').fill_in with: 'Asdasdasdasdasd'
  12. expect(page).to have_text 'No results were found'
  13. end
  14. it 'list published article' do
  15. expect(page).to produce_search_result_for published_answer
  16. end
  17. it 'not list draft article' do
  18. expect(page).not_to produce_search_result_for draft_answer
  19. end
  20. it 'not list internal article' do
  21. expect(page).not_to produce_search_result_for internal_answer
  22. end
  23. end