2022-01-01 13:38:12 +00:00
|
|
|
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
2021-08-25 12:24:42 +00:00
|
|
|
|
|
|
|
require 'rails_helper'
|
|
|
|
|
2021-09-21 07:29:59 +00:00
|
|
|
RSpec.describe 'Manage > Sla', type: :system do
|
2021-08-25 12:24:42 +00:00
|
|
|
before do
|
|
|
|
ensure_websocket do
|
|
|
|
visit 'manage/slas'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows correct required behaviour for checkboxes' do
|
|
|
|
page.find('.js-new').click
|
|
|
|
|
|
|
|
# enable all checkboxes
|
|
|
|
page.find('input#update_time', visible: false).find(:xpath, './/..').click
|
2021-10-27 09:38:45 +00:00
|
|
|
page.first('.js-updateTypeSelector', visible: false).click
|
2021-08-25 12:24:42 +00:00
|
|
|
page.find('input#solution_time', visible: false).find(:xpath, './/..').click
|
|
|
|
|
|
|
|
# check if required
|
|
|
|
expect(page.find('input[name=first_response_time_in_text]')[:required]).to eq('true')
|
|
|
|
expect(page.find('input[name=update_time_in_text]')[:required]).to eq('true')
|
|
|
|
expect(page.find('input[name=solution_time_in_text]')[:required]).to eq('true')
|
|
|
|
|
|
|
|
# drop all checkboxes
|
|
|
|
page.find('input#first_response_time', visible: false).find(:xpath, './/..').click
|
|
|
|
page.find('input#update_time', visible: false).find(:xpath, './/..').click
|
|
|
|
page.find('input#solution_time', visible: false).find(:xpath, './/..').click
|
|
|
|
|
|
|
|
# check if optional
|
|
|
|
expect(page.find('input[name=first_response_time_in_text]')[:required]).not_to eq('true')
|
|
|
|
expect(page.find('input[name=update_time_in_text]')[:required]).not_to eq('true')
|
|
|
|
expect(page.find('input[name=solution_time_in_text]')[:required]).not_to eq('true')
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'for saved entry', authenticated_as: :authenticate do
|
|
|
|
def authenticate
|
|
|
|
create(:sla, name: 'special sla', first_response_time: 3600, update_time: 3600, solution_time: 3600)
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows correct required behaviour for checkboxes' do
|
|
|
|
page.find('.js-edit').click
|
|
|
|
|
|
|
|
# check if required
|
|
|
|
expect(page.find('input[name=first_response_time_in_text]')[:required]).to eq('true')
|
|
|
|
expect(page.find('input[name=update_time_in_text]')[:required]).to eq('true')
|
|
|
|
expect(page.find('input[name=solution_time_in_text]')[:required]).to eq('true')
|
|
|
|
|
|
|
|
# drop all checkboxes
|
|
|
|
page.find('input#first_response_time', visible: false).find(:xpath, './/..').click
|
|
|
|
page.find('input#update_time', visible: false).find(:xpath, './/..').click
|
|
|
|
page.find('input#solution_time', visible: false).find(:xpath, './/..').click
|
|
|
|
|
|
|
|
# check if optional
|
|
|
|
expect(page.find('input[name=first_response_time_in_text]')[:required]).not_to eq('true')
|
|
|
|
expect(page.find('input[name=update_time_in_text]')[:required]).not_to eq('true')
|
|
|
|
expect(page.find('input[name=solution_time_in_text]')[:required]).not_to eq('true')
|
|
|
|
end
|
|
|
|
end
|
2021-09-29 09:01:24 +00:00
|
|
|
|
|
|
|
context 'when using custom calendars' do
|
|
|
|
let(:calendar) { create(:calendar) }
|
|
|
|
|
|
|
|
it 'allows to select custom calendars' do
|
|
|
|
calendar
|
|
|
|
page.refresh
|
|
|
|
click '.js-new'
|
|
|
|
|
|
|
|
within '.modal-dialog' do
|
|
|
|
fill_in :name, with: 'SLA with custom calendar'
|
|
|
|
select calendar.name, from: :calendar_id
|
|
|
|
click '.js-submit'
|
|
|
|
end
|
|
|
|
|
|
|
|
modal_disappear
|
|
|
|
expect(page).to have_text(calendar.name)
|
|
|
|
end
|
|
|
|
end
|
2021-08-25 12:24:42 +00:00
|
|
|
end
|