editor_spec.rb 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe 'Public Knowledge Base for editor', authentication_type: :form, type: :system do
  4. include_context 'basic Knowledge Base'
  5. before do
  6. published_answer && draft_answer && internal_answer
  7. end
  8. context 'homepage' do
  9. before { visit help_no_locale_path }
  10. it { expect(page).to have_editor_bar }
  11. it 'expect to have edit button' do
  12. button = find '.topbar-btn'
  13. expect(button['href']).to match(%r{edit$})
  14. end
  15. end
  16. context 'category' do
  17. before { visit help_category_path(primary_locale.system_locale.locale, category) }
  18. it 'shows published answer' do
  19. within '.main' do
  20. expect(page).to have_selector(:link_containing, published_answer.translation.title)
  21. end
  22. end
  23. it 'shows draft answer' do
  24. within '.main' do
  25. expect(page).to have_selector(:link_containing, draft_answer.translation.title)
  26. end
  27. end
  28. it 'shows internal answer' do
  29. within '.main' do
  30. expect(page).to have_selector(:link_containing, internal_answer.translation.title)
  31. end
  32. end
  33. end
  34. end