2021-06-01 12:20:20 +00:00
|
|
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
|
|
|
|
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(:ticket) { create(:ticket, group: group) }
|
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
|
|
|
|
ticket.update(title: 'New Ticket Title')
|
|
|
|
ticket_article = create(:ticket_article, ticket: ticket, internal: true)
|
|
|
|
ticket.update! state: Ticket::State.lookup(name: 'open')
|
|
|
|
ticket.update! last_owner_update_at: current_time
|
|
|
|
ticket.update! priority: Ticket::Priority.lookup(name: '1 low')
|
|
|
|
ticket.update! last_contact_at: current_time
|
|
|
|
ticket.update! last_contact_customer_at: current_time
|
|
|
|
ticket.update! last_contact_agent_at: current_time
|
|
|
|
ticket_article.update! internal: false
|
|
|
|
|
|
|
|
travel_to DateTime.parse('2021-04-06 23:30:00 UTC')
|
|
|
|
current_time = Time.current
|
|
|
|
ticket.update! state: Ticket::State.lookup(name: 'pending close')
|
|
|
|
ticket.update! priority: Ticket::Priority.lookup(name: '3 high')
|
|
|
|
ticket_article.update! internal: true
|
|
|
|
ticket.update! last_contact_at: current_time
|
|
|
|
ticket.update! last_contact_customer_at: current_time
|
|
|
|
ticket.update! last_contact_agent_at: current_time
|
|
|
|
ticket.update! pending_time: current_time
|
|
|
|
ticket.update! first_response_escalation_at: current_time
|
|
|
|
|
|
|
|
travel_back
|
|
|
|
|
|
|
|
session_user.preferences[:locale] = 'de-de'
|
|
|
|
session_user.save!
|
|
|
|
|
2021-11-15 15:58:19 +00:00
|
|
|
# Suppress the modal dialog that invites to contributions for translations that are < 95% as this breaks the tests for de-de.
|
|
|
|
page.evaluate_script "App.LocalStorage.set('translation_support_no', true, App.Session.get('id'))"
|
|
|
|
|
2021-04-21 07:17:25 +00:00
|
|
|
refresh
|
|
|
|
|
|
|
|
visit "#ticket/zoom/#{ticket.id}"
|
|
|
|
find('[data-tab="ticket"] .js-actions').click
|
|
|
|
click('[data-type="ticket-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 13:40})
|
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 value when attribute is state' do
|
2021-05-12 11:37:44 +00:00
|
|
|
expect(page).to have_css('li', text: %r{Ticket Status von 'neu'})
|
2021-04-21 07:17:25 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'translates value when attribute is priority' do
|
2021-05-12 11:37:44 +00:00
|
|
|
expect(page).to have_css('li', text: %r{Ticket Priorität von '1 niedrig'})
|
2021-04-21 07:17:25 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'translates value when attribute is internal' do
|
2021-05-12 11:37:44 +00:00
|
|
|
expect(page).to have_css('li', text: %r{Artikel intern von 'true'})
|
2021-04-21 07:17:25 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'translates last_contact_at display attribute' do
|
2021-05-12 11:37:44 +00:00
|
|
|
expect(page).to have_css('li', text: %r{Ticket Letzter Kontakt von '22.01.2021 13:40' → '07.04.2021 00:30'})
|
2021-04-21 07:17:25 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'translates last_contact_customer_at display attribute' do
|
2021-05-12 11:37:44 +00:00
|
|
|
expect(page).to have_css('li', text: %r{Ticket Letzter Kontakt \(Kunde\) von '22.01.2021 13:40' → '07.04.2021 00:30'})
|
2021-04-21 07:17:25 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'translates last_contact_agent_at display attribute' do
|
2021-05-12 11:37:44 +00:00
|
|
|
expect(page).to have_css('li', text: %r{Ticket Letzter Kontakt \(Agent\) von '22.01.2021 13:40' → '07.04.2021 00:30'})
|
2021-04-21 07:17:25 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'translates pending_time display attribute' do
|
2021-05-12 11:37:44 +00:00
|
|
|
expect(page).to have_css('li', text: %r{Ticket Warten bis '07.04.2021 00:30'})
|
2021-04-21 07:17:25 +00:00
|
|
|
end
|
|
|
|
end
|