2021-06-01 12:20:20 +00:00
|
|
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
|
|
|
|
2015-10-08 10:26:35 +00:00
|
|
|
require 'browser_test_helper'
|
|
|
|
|
2016-09-05 13:18:22 +00:00
|
|
|
class AgentTicketEmailReplyKeepBodyTest < TestCase
|
2015-10-08 10:26:35 +00:00
|
|
|
def test_reply_message_keep_body
|
|
|
|
|
|
|
|
# merge ticket with closed tab
|
|
|
|
@browser = browser_instance
|
|
|
|
login(
|
|
|
|
username: 'agent1@example.com',
|
|
|
|
password: 'test',
|
2018-12-19 17:31:51 +00:00
|
|
|
url: browser_url,
|
2015-10-08 10:26:35 +00:00
|
|
|
)
|
|
|
|
tasks_close_all()
|
|
|
|
|
|
|
|
# create new ticket
|
2019-06-28 11:38:49 +00:00
|
|
|
ticket_create(
|
2015-10-08 10:26:35 +00:00
|
|
|
data: {
|
|
|
|
customer: 'nico',
|
2018-12-19 17:31:51 +00:00
|
|
|
group: 'Users',
|
|
|
|
title: 'some subject 123äöü - reply test',
|
|
|
|
body: 'some body 123äöü - reply test',
|
2015-10-08 10:26:35 +00:00
|
|
|
},
|
|
|
|
)
|
|
|
|
sleep 1
|
|
|
|
|
|
|
|
# fill body
|
|
|
|
ticket_update(
|
2018-12-19 17:31:51 +00:00
|
|
|
data: {
|
2015-10-08 10:26:35 +00:00
|
|
|
body: 'keep me',
|
|
|
|
},
|
|
|
|
do_not_submit: true,
|
|
|
|
)
|
|
|
|
|
2015-11-17 18:57:15 +00:00
|
|
|
# scroll to reply - needed for chrome
|
|
|
|
scroll_to(
|
|
|
|
position: 'botton',
|
2015-12-14 16:09:09 +00:00
|
|
|
css: '.content.active [data-type="emailReply"]',
|
2015-11-17 18:57:15 +00:00
|
|
|
)
|
|
|
|
|
2015-10-08 10:26:35 +00:00
|
|
|
# click reply
|
2016-03-22 23:12:50 +00:00
|
|
|
click(css: '.content.active [data-type="emailReply"]')
|
2015-10-08 10:26:35 +00:00
|
|
|
|
|
|
|
# check body
|
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .js-reset',
|
|
|
|
value: '(Discard your unsaved changes.|Verwerfen der)',
|
2015-10-08 10:26:35 +00:00
|
|
|
no_quote: true,
|
|
|
|
)
|
|
|
|
|
|
|
|
# check body
|
|
|
|
ticket_verify(
|
|
|
|
data: {
|
|
|
|
body: 'keep me',
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
2015-11-17 18:57:15 +00:00
|
|
|
# scroll to reply - needed for chrome
|
2016-03-23 05:55:34 +00:00
|
|
|
sleep 5
|
2015-11-17 18:57:15 +00:00
|
|
|
scroll_to(
|
|
|
|
position: 'botton',
|
2015-12-14 16:09:09 +00:00
|
|
|
css: '.content.active [data-type="emailReply"]',
|
2015-11-17 18:57:15 +00:00
|
|
|
)
|
2015-10-08 10:26:35 +00:00
|
|
|
# click reply
|
2016-03-22 23:12:50 +00:00
|
|
|
click(css: '.content.active [data-type="emailReply"]')
|
2015-10-08 10:26:35 +00:00
|
|
|
|
|
|
|
# check body
|
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .js-reset',
|
|
|
|
value: '(Discard your unsaved changes.|Verwerfen der)',
|
2015-10-08 10:26:35 +00:00
|
|
|
no_quote: true,
|
|
|
|
)
|
|
|
|
|
2016-03-22 23:12:50 +00:00
|
|
|
# check body
|
|
|
|
ticket_verify(
|
|
|
|
data: {
|
|
|
|
body: 'keep me',
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
2015-10-08 10:26:35 +00:00
|
|
|
end
|
2018-08-22 07:55:39 +00:00
|
|
|
|
2018-12-03 13:06:47 +00:00
|
|
|
def change_quote_config(params = {})
|
|
|
|
scroll_to(
|
|
|
|
position: 'botton',
|
|
|
|
css: '.content.active .js-settingContainer .js-setting',
|
|
|
|
)
|
|
|
|
click(css: '.content.active .js-settingContainer .js-setting')
|
|
|
|
modal_ready()
|
|
|
|
select(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: params[:css],
|
2018-12-03 13:06:47 +00:00
|
|
|
value: params[:value]
|
|
|
|
)
|
|
|
|
click(
|
|
|
|
css: params[:submit_css],
|
|
|
|
)
|
|
|
|
modal_close()
|
|
|
|
modal_disappear()
|
|
|
|
end
|
|
|
|
|
2018-08-22 07:55:39 +00:00
|
|
|
def test_full_quote
|
2019-06-28 11:38:49 +00:00
|
|
|
@browser = browser_instance
|
2018-08-22 07:55:39 +00:00
|
|
|
login(
|
|
|
|
username: 'master@example.com',
|
|
|
|
password: 'test',
|
2018-12-19 17:31:51 +00:00
|
|
|
url: browser_url,
|
2018-08-22 07:55:39 +00:00
|
|
|
)
|
|
|
|
tasks_close_all()
|
|
|
|
|
|
|
|
ticket_open_by_title(
|
|
|
|
title: 'Welcome to Zammad',
|
|
|
|
)
|
|
|
|
watch_for(
|
2020-06-22 09:57:45 +00:00
|
|
|
css: '.content.active .js-settingContainer .js-setting .dropdown-icon',
|
2018-08-22 07:55:39 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# enable email full quote in the ticket zoom config page
|
2018-12-03 13:06:47 +00:00
|
|
|
change_quote_config(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.modal #ui_ticket_zoom_article_email_full_quote select[name="ui_ticket_zoom_article_email_full_quote"]',
|
|
|
|
value: 'yes',
|
2018-12-03 13:06:47 +00:00
|
|
|
submit_css: '.modal #ui_ticket_zoom_article_email_full_quote .btn[type="submit"]',
|
2018-08-22 07:55:39 +00:00
|
|
|
)
|
2018-12-03 13:06:47 +00:00
|
|
|
change_quote_config(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.modal #ui_ticket_zoom_article_email_full_quote_header select[name="ui_ticket_zoom_article_email_full_quote_header"]',
|
|
|
|
value: 'yes',
|
2018-12-03 13:06:47 +00:00
|
|
|
submit_css: '.modal #ui_ticket_zoom_article_email_full_quote_header .btn[type="submit"]',
|
2018-08-22 07:55:39 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
scroll_to(
|
|
|
|
position: 'botton',
|
|
|
|
css: '.content.active .ticket-article [data-type="emailReply"]',
|
|
|
|
)
|
|
|
|
click(css: '.content.active .ticket-article [data-type="emailReply"]')
|
|
|
|
|
|
|
|
full_text = @browser.find_element(css: '.content.active .article-new .articleNewEdit-body').text
|
|
|
|
|
2021-05-12 11:37:44 +00:00
|
|
|
match = full_text.match(%r{\nOn (.*?) Nicole Braun wrote:})
|
2018-08-22 07:55:39 +00:00
|
|
|
assert match
|
|
|
|
assert match[1]
|
|
|
|
assert Time.zone.parse(match[1])
|
2018-12-03 13:06:47 +00:00
|
|
|
|
|
|
|
# try again, but with the full quote header disabled
|
|
|
|
tasks_close_all()
|
|
|
|
ticket_open_by_title(
|
|
|
|
title: 'Welcome to Zammad',
|
|
|
|
)
|
|
|
|
change_quote_config(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.modal #ui_ticket_zoom_article_email_full_quote_header select[name="ui_ticket_zoom_article_email_full_quote_header"]',
|
|
|
|
value: 'no',
|
2018-12-03 13:06:47 +00:00
|
|
|
submit_css: '.modal #ui_ticket_zoom_article_email_full_quote_header .btn[type="submit"]',
|
|
|
|
)
|
|
|
|
|
|
|
|
scroll_to(
|
|
|
|
position: 'botton',
|
|
|
|
css: '.content.active .ticket-article [data-type="emailReply"]',
|
|
|
|
)
|
|
|
|
click(css: '.content.active .ticket-article [data-type="emailReply"]')
|
|
|
|
|
|
|
|
full_text = @browser.find_element(css: '.content.active .article-new .articleNewEdit-body').text
|
|
|
|
|
2021-05-12 11:37:44 +00:00
|
|
|
match = full_text.match(%r{\nOn (.*?) Nicole Braun wrote:})
|
2018-12-03 13:06:47 +00:00
|
|
|
assert_nil match
|
|
|
|
|
|
|
|
# after test, turn full quote header back on again
|
|
|
|
tasks_close_all()
|
|
|
|
ticket_open_by_title(
|
|
|
|
title: 'Welcome to Zammad',
|
|
|
|
)
|
|
|
|
change_quote_config(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.modal #ui_ticket_zoom_article_email_full_quote_header select[name="ui_ticket_zoom_article_email_full_quote_header"]',
|
|
|
|
value: 'yes',
|
2018-12-03 13:06:47 +00:00
|
|
|
submit_css: '.modal #ui_ticket_zoom_article_email_full_quote_header .btn[type="submit"]',
|
|
|
|
)
|
2018-08-22 07:55:39 +00:00
|
|
|
end
|
2018-11-28 16:12:24 +00:00
|
|
|
|
|
|
|
# Regression test for issue #2344 - Missing translation for Full-Quote-Text "on xy wrote"
|
|
|
|
def test_full_quote_german_locale
|
2019-06-28 11:38:49 +00:00
|
|
|
@browser = browser_instance
|
2018-11-28 16:12:24 +00:00
|
|
|
login(
|
|
|
|
username: 'master@example.com',
|
|
|
|
password: 'test',
|
2018-12-19 17:31:51 +00:00
|
|
|
url: browser_url,
|
2018-11-28 16:12:24 +00:00
|
|
|
)
|
|
|
|
tasks_close_all()
|
|
|
|
|
|
|
|
ticket_open_by_title(
|
|
|
|
title: 'Welcome to Zammad',
|
|
|
|
)
|
|
|
|
watch_for(
|
2020-06-22 09:57:45 +00:00
|
|
|
css: '.content.active .js-settingContainer .js-setting .dropdown-icon',
|
2018-11-28 16:12:24 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# enable email full quote in the ticket zoom config page
|
2018-12-03 13:06:47 +00:00
|
|
|
change_quote_config(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.modal #ui_ticket_zoom_article_email_full_quote select[name="ui_ticket_zoom_article_email_full_quote"]',
|
|
|
|
value: 'yes',
|
2018-12-03 13:06:47 +00:00
|
|
|
submit_css: '.modal #ui_ticket_zoom_article_email_full_quote .btn[type="submit"]',
|
2018-11-28 16:12:24 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# switch user profile language to German
|
|
|
|
switch_language(
|
|
|
|
data: {
|
|
|
|
language: 'Deutsch'
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
ticket_open_by_title(
|
|
|
|
title: 'Welcome to Zammad',
|
|
|
|
)
|
|
|
|
|
|
|
|
scroll_to(
|
|
|
|
position: 'botton',
|
|
|
|
css: '.content.active .ticket-article [data-type="emailReply"]',
|
|
|
|
)
|
|
|
|
click(css: '.content.active .ticket-article [data-type="emailReply"]')
|
|
|
|
|
|
|
|
full_text = @browser.find_element(css: '.content.active .article-new .articleNewEdit-body').text
|
|
|
|
|
2021-05-12 11:37:44 +00:00
|
|
|
match = full_text.match(%r{\nAm (.*?), schrieb Nicole Braun:})
|
2018-11-28 16:12:24 +00:00
|
|
|
assert match
|
|
|
|
|
|
|
|
datestamp = match[1]
|
|
|
|
assert datestamp
|
|
|
|
assert Time.zone.parse(datestamp)
|
|
|
|
day_of_week = datestamp.split(',').first
|
|
|
|
assert %w[Montag Dienstag Mittwoch Donnerstag Freitag Samstag Sonntag].include? day_of_week
|
|
|
|
|
|
|
|
# switch user profile language to English again for other tests
|
|
|
|
switch_language(
|
|
|
|
data: {
|
|
|
|
language: 'English (United States)'
|
|
|
|
},
|
|
|
|
)
|
|
|
|
end
|
2015-10-08 10:26:35 +00:00
|
|
|
end
|