Maintenance: Port admin_calendar_sla_test.rb to Capybara.

This commit is contained in:
Martin Gruner 2021-09-29 11:01:24 +02:00 committed by Dominik Klein
parent 6d8f5b7d95
commit 36aa35f765
3 changed files with 19 additions and 91 deletions

View file

@ -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

View file

@ -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

View file

@ -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