report_profiles_spec.rb 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. require 'system/examples/pagination_examples'
  4. RSpec.describe 'Manage > Report Profiles', type: :system do
  5. context 'ajax pagination' do
  6. include_examples 'pagination', model: :report_profile, klass: Report::Profile, path: 'manage/report_profiles'
  7. end
  8. context 'for reporting profiles' do
  9. before do
  10. Report::Profile.destroy_all
  11. visit '#manage/report_profiles'
  12. within :active_content do
  13. click 'a[data-type=new]'
  14. in_modal do
  15. fill_in 'name', with: name
  16. select profile_active, from: 'active'
  17. select 'open', from: 'condition::ticket.state_id::value'
  18. click_button
  19. end
  20. end
  21. end
  22. context 'when creating an inactive profile' do
  23. let(:name) { 'inactive profile' }
  24. let(:profile_active) { 'inactive' }
  25. it 'creates an inactive profile report' do
  26. within :active_content do
  27. within '.page-content' do
  28. expect(page).to have_selector('tr.item.is-inactive')
  29. .and have_text(name)
  30. end
  31. end
  32. end
  33. end
  34. context 'when creating an active profile' do
  35. let(:name) { 'active profile' }
  36. let(:profile_active) { 'active' }
  37. it 'creates an active profile report on the ui' do
  38. within :active_content do
  39. within '.page-content' do
  40. expect(page).to have_no_selector('tr.item.is-inactive')
  41. .and have_text(name)
  42. end
  43. end
  44. end
  45. it 'creates an active profile report in the backend' do
  46. expect(Report::Profile.count).to be(1)
  47. end
  48. end
  49. end
  50. end