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
|
|
|
|
2021-04-21 07:17:25 +00:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2021-07-22 14:03:33 +00:00
|
|
|
RSpec.describe 'Ticket history', type: :system, time_zone: 'Europe/London' do
|
2021-04-21 07:17:25 +00:00
|
|
|
let(:group) { Group.find_by(name: 'Users') }
|
|
|
|
let(:customer) { create(:customer) }
|
2021-08-17 12:10:02 +00:00
|
|
|
let!(:session_user) { User.find_by(login: 'admin@example.com') }
|
2021-04-21 07:17:25 +00:00
|
|
|
|
|
|
|
before do
|
|
|
|
freeze_time
|
|
|
|
|
|
|
|
travel_to DateTime.parse('2021-01-22 13:40:00 UTC')
|
|
|
|
current_time = Time.current
|
|
|
|
customer.update! firstname: 'Customer'
|
|
|
|
customer.update! email: 'test@example.com'
|
|
|
|
customer.update! country: 'Germany'
|
|
|
|
customer.update! out_of_office_start_at: current_time
|
|
|
|
customer.update! last_login: current_time
|
|
|
|
|
|
|
|
travel_to DateTime.parse('2021-04-06 23:30:00 UTC')
|
|
|
|
current_time = Time.current
|
|
|
|
customer.update! lastname: 'Example'
|
|
|
|
customer.update! mobile: '5757473827'
|
|
|
|
customer.update! out_of_office_end_at: current_time
|
|
|
|
customer.update! last_login: current_time
|
|
|
|
|
|
|
|
travel_back
|
|
|
|
|
|
|
|
session_user.preferences[:locale] = 'de-de'
|
|
|
|
session_user.save!
|
|
|
|
|
|
|
|
refresh
|
|
|
|
|
|
|
|
visit "#user/profile/#{customer.id}"
|
|
|
|
find('#userAction').click
|
|
|
|
click('[data-type="history"]')
|
|
|
|
end
|
|
|
|
|
|
|
|
it "translates timestamp when attribute's tag is datetime" do
|
2021-05-12 11:37:44 +00:00
|
|
|
expect(page).to have_css('li', text: %r{'22.01.2021 00:00'})
|
2021-04-21 07:17:25 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not include time with UTC format' do
|
2021-05-12 11:37:44 +00:00
|
|
|
expect(page).to have_no_text(%r{ UTC})
|
2021-04-21 07:17:25 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'translates out_of_office_start_at value to time stamp' do
|
2021-05-12 11:37:44 +00:00
|
|
|
expect(page).to have_css('li', text: %r{Benutzer out_of_office_start_at '22.01.2021 00:00'})
|
2021-04-21 07:17:25 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'translates out_of_office_end_at value to time stamp' do
|
2021-05-12 11:37:44 +00:00
|
|
|
expect(page).to have_css('li', text: %r{Benutzer out_of_office_end_at '06.04.2021 01:00'})
|
2021-04-21 07:17:25 +00:00
|
|
|
end
|
|
|
|
end
|