guest_search_spec.rb 940 B

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