groups_spec.rb 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. # Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. require 'system/examples/core_workflow_examples'
  4. require 'system/examples/pagination_examples'
  5. RSpec.describe 'Manage > Groups', type: :system do
  6. context 'ajax pagination' do
  7. include_examples 'pagination', model: :group, klass: Group, path: 'manage/groups'
  8. end
  9. # Fixes GitHub Issue#3129 - Deactivation of signature does not clear it from groups
  10. describe 'When active status of signature assigned to a group is changed', authenticated_as: -> { user } do
  11. let(:user) { create(:admin, groups: [group]) }
  12. let(:group) { create(:group, signature_id: signature.id) }
  13. let(:signature) { create(:signature) }
  14. it 'does not display warning, when signature is active' do
  15. visit '#manage/groups'
  16. click "tr[data-id='#{group.id}']"
  17. expect(page).to have_select('signature_id', selected: signature.name)
  18. .and have_no_css('.alert--warning')
  19. end
  20. context 'When signature is marked inactive' do
  21. let(:signature) { create(:signature, active: false) }
  22. it 'displays warning' do
  23. visit '#manage/groups'
  24. click "tr[data-id='#{group.id}']"
  25. expect(page).to have_select('signature_id', selected: signature.name)
  26. .and have_css('.alert--warning')
  27. end
  28. end
  29. end
  30. describe 'Core Workflow' do
  31. include_examples 'core workflow' do
  32. let(:object_name) { 'Group' }
  33. let(:before_it) do
  34. lambda {
  35. ensure_websocket(check_if_pinged: false) do
  36. visit 'manage/groups'
  37. click_on 'New Group'
  38. end
  39. }
  40. end
  41. end
  42. end
  43. context "Issue 2544 - Can't remove auto assignment timeout" do
  44. before do
  45. visit '/#manage/groups'
  46. end
  47. it 'is possible to reset the assignment timeout of a group' do
  48. find('td', text: 'Users').click
  49. in_modal do
  50. fill_in 'Assignment Timeout', with: '30'
  51. # Needed for chrome, when element is outside viewport.
  52. scroll_into_view('button.js-submit', position: :bottom)
  53. click_button
  54. end
  55. expect(Group.find_by(name: 'Users').assignment_timeout).to eq(30)
  56. find('td', text: 'Users').click
  57. in_modal do
  58. fill_in 'Assignment Timeout', with: ''
  59. # Needed for chrome, when element is outside viewport.
  60. scroll_into_view('button.js-submit', position: :bottom)
  61. click_button
  62. end
  63. expect(Group.find_by(name: 'Users').assignment_timeout).to be_nil
  64. end
  65. end
  66. context 'Issue 4129 - Tooltips are not displayed correctly' do
  67. before do
  68. visit '/#manage/groups'
  69. end
  70. it 'renders tooltips correctly' do
  71. find('td', text: 'Users').click
  72. in_modal do
  73. find('div.select[data-attribute-name="follow_up_possible"] .js-helpMessage').hover
  74. expect(page).to have_css('div.tooltip')
  75. end
  76. end
  77. end
  78. end