From 36aa35f765874b941b3df612a7448bd881a5a509 Mon Sep 17 00:00:00 2001 From: Martin Gruner Date: Wed, 29 Sep 2021 11:01:24 +0200 Subject: [PATCH] Maintenance: Port admin_calendar_sla_test.rb to Capybara. --- script/build/test_slice_tests.sh | 6 -- spec/system/manage/sla_spec.rb | 19 ++++++ test/browser/admin_calendar_sla_test.rb | 85 ------------------------- 3 files changed, 19 insertions(+), 91 deletions(-) delete mode 100644 test/browser/admin_calendar_sla_test.rb diff --git a/script/build/test_slice_tests.sh b/script/build/test_slice_tests.sh index cd4919851..8da4c701d 100755 --- a/script/build/test_slice_tests.sh +++ b/script/build/test_slice_tests.sh @@ -12,7 +12,6 @@ if [ "$LEVEL" == '1' ]; then cp test/integration/aaa_auto_wizard_base_setup_test.rb test/browser/aaa_auto_wizard_base_setup_test.rb rm test/browser/abb_one_group_test.rb rm test/browser/admin_channel_email_test.rb - rm test/browser/admin_calendar_sla_test.rb rm test/browser/admin_drag_drop_to_new_group_test.rb rm test/browser/admin_overview_test.rb rm test/browser/admin_permissions_granular_vs_full_test.rb @@ -72,7 +71,6 @@ elif [ "$LEVEL" == '2' ]; then # test/browser/aaa_getting_started_test.rb # test/browser/abb_one_group_test.rb rm test/browser/admin_channel_email_test.rb - rm test/browser/admin_calendar_sla_test.rb rm test/browser/admin_drag_drop_to_new_group_test.rb rm test/browser/admin_overview_test.rb rm test/browser/admin_permissions_granular_vs_full_test.rb @@ -132,7 +130,6 @@ elif [ "$LEVEL" == '3' ]; then # test/browser/aaa_getting_started_test.rb # test/browser/abb_one_group_test.rb rm test/browser/admin_channel_email_test.rb - rm test/browser/admin_calendar_sla_test.rb rm test/browser/admin_drag_drop_to_new_group_test.rb rm test/browser/admin_overview_test.rb rm test/browser/admin_permissions_granular_vs_full_test.rb @@ -192,7 +189,6 @@ elif [ "$LEVEL" == '4' ]; then # test/browser/aaa_getting_started_test.rb # test/browser/abb_one_group_test.rb rm test/browser/admin_channel_email_test.rb - rm test/browser/admin_calendar_sla_test.rb rm test/browser/admin_drag_drop_to_new_group_test.rb rm test/browser/admin_overview_test.rb rm test/browser/admin_permissions_granular_vs_full_test.rb @@ -251,7 +247,6 @@ elif [ "$LEVEL" == '5' ]; then # only profile action & admin # test/browser/abb_one_group_test.rb # test/browser/admin_channel_email_test.rb - # test/browser/admin_calendar_sla_test.rb # rm test/browser/admin_drag_drop_to_new_group_test.rb # test/browser/admin_overview_test.rb # rm test/browser/admin_permissions_granular_vs_full_test.rb @@ -313,7 +308,6 @@ elif [ "$LEVEL" == '6' ]; then cp test/integration/aaa_auto_wizard_base_setup_test.rb test/browser/aaa_auto_wizard_base_setup_test.rb rm test/browser/abb_one_group_test.rb rm test/browser/admin_channel_email_test.rb - rm test/browser/admin_calendar_sla_test.rb rm test/browser/admin_drag_drop_to_new_group_test.rb rm test/browser/admin_overview_test.rb rm test/browser/admin_permissions_granular_vs_full_test.rb diff --git a/spec/system/manage/sla_spec.rb b/spec/system/manage/sla_spec.rb index e667856ef..385109e81 100644 --- a/spec/system/manage/sla_spec.rb +++ b/spec/system/manage/sla_spec.rb @@ -57,4 +57,23 @@ RSpec.describe 'Manage > Sla', type: :system do expect(page.find('input[name=solution_time_in_text]')[:required]).not_to eq('true') end end + + 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 end diff --git a/test/browser/admin_calendar_sla_test.rb b/test/browser/admin_calendar_sla_test.rb deleted file mode 100644 index 8f0580aa2..000000000 --- a/test/browser/admin_calendar_sla_test.rb +++ /dev/null @@ -1,85 +0,0 @@ -# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/ - -require 'browser_test_helper' - -class AdminCalendarSlaTest < TestCase - def test_calendar - @browser = browser_instance - login( - username: 'admin@example.com', - password: 'test', - url: browser_url, - ) - tasks_close_all - - calendar_name = "ZZZ some calendar #{SecureRandom.uuid}" - sla_name = "ZZZ some sla #{SecureRandom.uuid}" - timezone = 'Europe/Berlin' - timezone_verify = "Europe/Berlin\s\\(GMT\\+(2|1)\\)" - calendar_create( - data: { - name: calendar_name, - timezone: timezone, - } - ) - - # got to maintanance - click(css: '[href="#manage"]') - click(css: '[href="#system/maintenance"]') - watch_for( - css: '.content.active', - value: 'Enable or disable the maintenance mode', - timeout: 4, - ) - - # go back - click(css: '[href="#manage"]') - click(css: '[href="#manage/calendars"]') - watch_for( - css: '.content.active', - value: calendar_name, - timeout: 4, - ) - - logout - - login( - username: 'admin@example.com', - password: 'test', - ) - - # check if admin exists - click(css: '[href="#manage"]') - click(css: '[href="#manage/calendars"]') - watch_for( - css: '.content.active', - value: calendar_name, - timeout: 4, - ) - - # @browser.execute_script('$(\'.content.active table tr td:contains(" ' + data[:name] + '")\').first().click()') - @browser.execute_script('$(\'.content.active .main .js-edit\').last().click()') - - modal_ready(browser: @browser) - watch_for( - css: '.content.active .modal input[name=name]', - value: calendar_name, - timeout: 4, - ) - watch_for( - css: '.content.active .modal input.js-input', - value: timezone_verify, - timeout: 4, - ) - modal_close - - sla_create( - data: { - name: sla_name, - calendar: "#{calendar_name} - #{timezone}", - first_response_time_in_text: 61 - }, - ) - - end -end