2021-06-01 12:20:20 +00:00
|
|
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
|
|
|
|
2020-10-30 07:59:32 +00:00
|
|
|
require 'rails_helper'
|
2021-08-25 12:24:42 +00:00
|
|
|
require 'system/examples/core_workflow_examples'
|
2020-10-30 07:59:32 +00:00
|
|
|
require 'system/examples/pagination_examples'
|
|
|
|
|
|
|
|
RSpec.describe 'Manage > Groups', type: :system do
|
|
|
|
context 'ajax pagination' do
|
|
|
|
include_examples 'pagination', model: :group, klass: Group, path: 'manage/groups'
|
|
|
|
end
|
2021-08-24 14:37:19 +00:00
|
|
|
|
2021-12-20 14:01:34 +00:00
|
|
|
# Fixes GitHub Issue#3129 - Deactivation of signature does not clear it from groups
|
|
|
|
describe 'When active status of signature assigned to a group is changed', authenticated_as: -> { user } do
|
|
|
|
let(:user) { create(:admin, groups: [group]) }
|
|
|
|
let(:group) { create(:group, signature_id: signature.id) }
|
|
|
|
let(:signature) { create(:signature) }
|
|
|
|
|
|
|
|
it 'does not display warning, when signature is active' do
|
|
|
|
visit '#manage/groups'
|
|
|
|
|
|
|
|
click "tr[data-id='#{group.id}']"
|
|
|
|
|
|
|
|
expect(page).to have_select('signature_id', selected: signature.name)
|
|
|
|
.and have_no_css('.alert--warning')
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'When signature is marked inactive' do
|
|
|
|
let(:signature) { create(:signature, active: false) }
|
|
|
|
|
|
|
|
it 'displays warning' do
|
|
|
|
visit '#manage/groups'
|
|
|
|
|
|
|
|
click "tr[data-id='#{group.id}']"
|
|
|
|
|
|
|
|
expect(page).to have_select('signature_id', selected: signature.name)
|
|
|
|
.and have_css('.alert--warning')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-08-25 12:24:42 +00:00
|
|
|
describe 'Core Workflow' do
|
|
|
|
include_examples 'core workflow' do
|
|
|
|
let(:object_name) { 'Group' }
|
|
|
|
let(:before_it) do
|
|
|
|
lambda {
|
|
|
|
ensure_websocket(check_if_pinged: false) do
|
|
|
|
visit 'manage/groups'
|
|
|
|
click_on 'New Group'
|
|
|
|
end
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-08-24 14:37:19 +00:00
|
|
|
context "Issue 2544 - Can't remove auto assignment timeout" do
|
|
|
|
before do
|
|
|
|
visit '/#manage/groups'
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'is possible to reset the assignment timeout of a group' do
|
|
|
|
find('td', text: 'Users').click
|
2021-09-22 20:01:39 +00:00
|
|
|
|
|
|
|
within '.modal-dialog' do
|
|
|
|
fill_in 'Assignment Timeout', with: '30'
|
|
|
|
|
|
|
|
# Needed for chrome, when element is outside viewport.
|
|
|
|
scroll_into_view('button.js-submit', position: :bottom)
|
|
|
|
|
|
|
|
click_button
|
|
|
|
end
|
|
|
|
|
2021-08-24 14:37:19 +00:00
|
|
|
expect(Group.find_by(name: 'Users').assignment_timeout).to eq(30)
|
|
|
|
|
|
|
|
find('td', text: 'Users').click
|
2021-09-22 20:01:39 +00:00
|
|
|
|
|
|
|
within '.modal-dialog' do
|
|
|
|
fill_in 'Assignment Timeout', with: ''
|
|
|
|
|
|
|
|
# Needed for chrome, when element is outside viewport.
|
|
|
|
scroll_into_view('button.js-submit', position: :bottom)
|
|
|
|
|
|
|
|
click_button
|
|
|
|
end
|
2021-08-24 14:37:19 +00:00
|
|
|
expect(Group.find_by(name: 'Users').assignment_timeout).to be nil
|
|
|
|
end
|
|
|
|
end
|
2020-10-30 07:59:32 +00:00
|
|
|
end
|