2022-01-01 13:38:12 +00:00
|
|
|
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
2021-06-01 12:20:20 +00:00
|
|
|
|
2020-02-20 12:15:03 +00:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe 'Manage > Calendars', type: :system do
|
|
|
|
|
|
|
|
context 'Date' do
|
2021-09-20 10:47:05 +00:00
|
|
|
let(:calendar_title) { "test calendar #{SecureRandom.uuid}" }
|
2020-02-20 12:15:03 +00:00
|
|
|
|
|
|
|
it 'show festivity dates correctly far away from UTC', time_zone: 'America/Sao_Paulo' do
|
|
|
|
visit '/#manage/calendars'
|
|
|
|
|
|
|
|
click '.js-new'
|
|
|
|
|
|
|
|
modal_ready
|
|
|
|
|
|
|
|
within '.modal-dialog' do
|
2020-04-20 20:36:29 +00:00
|
|
|
fill_in 'name', with: calendar_title
|
2020-02-20 12:15:03 +00:00
|
|
|
|
|
|
|
click '.dropdown-toggle'
|
|
|
|
click '.dropdown-menu [data-value="America/Sao_Paulo"]'
|
|
|
|
|
|
|
|
find('.ical_feed select').select 'Brazil'
|
|
|
|
|
|
|
|
click '.js-submit'
|
|
|
|
end
|
|
|
|
|
|
|
|
modal_disappear
|
|
|
|
|
2020-04-20 20:36:29 +00:00
|
|
|
within :active_content do
|
|
|
|
within '.action', text: calendar_title do
|
|
|
|
find('.js-edit').click
|
|
|
|
end
|
|
|
|
end
|
2020-02-20 12:15:03 +00:00
|
|
|
|
2021-09-21 14:45:14 +00:00
|
|
|
# Check that holidays were imported by looking at the first entry.
|
|
|
|
expect(find('.modal-dialog .holiday_selector tbody tr:first-child td:nth-child(2)').text).to match(%r{^\d{4}-\d{2}-\d{2}$})
|
|
|
|
expect(find('.modal-dialog .holiday_selector tbody tr:first-child td input.js-summary').value).to be_present
|
2020-02-20 12:15:03 +00:00
|
|
|
end
|
|
|
|
end
|
2021-09-07 09:16:01 +00:00
|
|
|
|
|
|
|
# https://github.com/zammad/zammad/issues/2528
|
|
|
|
context 'ical feed - subscribe to public holidays in another country' do
|
|
|
|
it 'shows countries dropdown in sorted order' do
|
|
|
|
allow(Calendar).to receive(:ical_feeds).and_return({
|
|
|
|
'https://argentinien.de': 'Argentinien',
|
|
|
|
'https://australien.de': 'Australien',
|
|
|
|
'https://osterreich.de': 'Österreich',
|
|
|
|
'https://weibrussland.de': 'Weißrussland',
|
|
|
|
'https://kanada.de': 'Kanada',
|
|
|
|
'https://chile.de': 'Chile',
|
|
|
|
})
|
|
|
|
|
|
|
|
visit '/#manage/calendars'
|
|
|
|
|
|
|
|
click '.js-new'
|
|
|
|
|
|
|
|
in_modal disappears: false do
|
|
|
|
expect(all('.ical_feed select option').map(&:text)).to eq ['-', 'Argentinien', 'Australien', 'Chile', 'Kanada', 'Österreich', 'Weißrussland']
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2020-02-20 12:15:03 +00:00
|
|
|
end
|