2021-06-01 12:20:20 +00:00
|
|
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
|
|
|
|
2016-09-05 13:18:22 +00:00
|
|
|
require 'browser_test_helper'
|
|
|
|
|
|
|
|
class AgentTicketMacroTest < TestCase
|
2018-06-27 09:44:13 +00:00
|
|
|
|
|
|
|
def test_close_and_tag_as_spam_default
|
2018-06-20 09:39:33 +00:00
|
|
|
@browser = browser_instance
|
|
|
|
login(
|
|
|
|
username: 'agent1@example.com',
|
|
|
|
password: 'test',
|
2018-06-27 09:44:13 +00:00
|
|
|
url: browser_url,
|
2018-06-20 09:39:33 +00:00
|
|
|
)
|
|
|
|
tasks_close_all()
|
2018-06-11 07:28:03 +00:00
|
|
|
|
2018-06-27 09:44:13 +00:00
|
|
|
ticket = ticket_create(
|
2018-06-20 09:39:33 +00:00
|
|
|
data: {
|
|
|
|
customer: 'nico',
|
2018-06-27 09:44:13 +00:00
|
|
|
group: 'Users',
|
2019-11-28 06:59:22 +00:00
|
|
|
title: 'macro "Close & Tag as Spam" default',
|
2018-06-27 09:44:13 +00:00
|
|
|
body: 'some body - macro "Close & Tag as Spam" default',
|
2018-06-20 09:39:33 +00:00
|
|
|
},
|
|
|
|
)
|
2018-06-11 07:28:03 +00:00
|
|
|
|
2018-06-27 09:44:13 +00:00
|
|
|
perform_macro(name: 'Close & Tag as Spam')
|
|
|
|
|
|
|
|
# check redirect after perfoming macro
|
|
|
|
location_check(
|
|
|
|
url: "#{browser_url}/#dashboard",
|
|
|
|
)
|
|
|
|
|
|
|
|
# reopen ticket and verify tags
|
|
|
|
ticket_open_by_search(
|
|
|
|
number: ticket[:number],
|
|
|
|
)
|
2018-06-11 07:28:03 +00:00
|
|
|
|
2018-06-20 09:39:33 +00:00
|
|
|
tags_verify(
|
|
|
|
tags: {
|
|
|
|
'spam' => true,
|
|
|
|
'tag1' => false,
|
|
|
|
}
|
|
|
|
)
|
|
|
|
end
|
2018-06-11 07:28:03 +00:00
|
|
|
|
2018-06-27 09:44:13 +00:00
|
|
|
def test_ux_flow_next_up_stay_on_tab
|
2016-09-05 13:18:22 +00:00
|
|
|
@browser = browser_instance
|
|
|
|
login(
|
2018-06-11 07:28:03 +00:00
|
|
|
username: 'master@example.com',
|
2016-09-05 13:18:22 +00:00
|
|
|
password: 'test',
|
2018-06-27 09:44:13 +00:00
|
|
|
url: browser_url,
|
2016-09-05 13:18:22 +00:00
|
|
|
)
|
|
|
|
tasks_close_all()
|
|
|
|
|
2018-06-27 09:44:13 +00:00
|
|
|
ux_flow_next_up = 'Stay on tab'
|
|
|
|
macro_name = "Test #{ux_flow_next_up}"
|
|
|
|
macro_create(
|
|
|
|
name: macro_name,
|
|
|
|
ux_flow_next_up: ux_flow_next_up,
|
|
|
|
actions: {
|
|
|
|
'Tags' => {
|
|
|
|
operator: 'add',
|
|
|
|
value: 'spam',
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
ticket = ticket_create(
|
2016-09-05 13:18:22 +00:00
|
|
|
data: {
|
2018-06-27 09:44:13 +00:00
|
|
|
customer: 'nico',
|
|
|
|
group: 'Users',
|
2019-11-28 06:59:22 +00:00
|
|
|
title: "macro #{macro_name}",
|
2018-06-27 09:44:13 +00:00
|
|
|
body: "some body - macro #{macro_name}",
|
2016-09-05 13:18:22 +00:00
|
|
|
},
|
|
|
|
)
|
|
|
|
|
2018-06-27 09:44:13 +00:00
|
|
|
perform_macro(name: macro_name)
|
|
|
|
|
|
|
|
location_check(
|
|
|
|
url: "#{browser_url}/#ticket/zoom/#{ticket[:id]}",
|
|
|
|
)
|
|
|
|
|
|
|
|
tags_verify(
|
|
|
|
tags: {
|
|
|
|
'spam' => true,
|
|
|
|
'tag1' => false,
|
|
|
|
}
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_ux_flow_next_up_close_tab
|
|
|
|
@browser = browser_instance
|
|
|
|
login(
|
|
|
|
username: 'master@example.com',
|
|
|
|
password: 'test',
|
|
|
|
url: browser_url,
|
|
|
|
)
|
|
|
|
tasks_close_all()
|
|
|
|
|
|
|
|
ux_flow_next_up = 'Close tab'
|
|
|
|
macro_name = "Test #{ux_flow_next_up}"
|
|
|
|
macro_create(
|
|
|
|
name: macro_name,
|
|
|
|
ux_flow_next_up: ux_flow_next_up,
|
|
|
|
)
|
|
|
|
|
2019-06-28 11:38:49 +00:00
|
|
|
ticket_create(
|
2018-06-11 07:28:03 +00:00
|
|
|
data: {
|
2018-06-27 09:44:13 +00:00
|
|
|
customer: 'nico',
|
|
|
|
group: 'Users',
|
2019-11-28 06:59:22 +00:00
|
|
|
title: "macro #{macro_name}",
|
2018-06-27 09:44:13 +00:00
|
|
|
body: "some body - macro #{macro_name}",
|
2018-06-11 07:28:03 +00:00
|
|
|
},
|
2016-09-05 13:18:22 +00:00
|
|
|
)
|
2018-06-11 07:28:03 +00:00
|
|
|
|
2018-06-27 09:44:13 +00:00
|
|
|
perform_macro(name: macro_name)
|
2018-06-11 07:28:03 +00:00
|
|
|
|
2018-07-24 18:12:48 +00:00
|
|
|
watch_for_disappear(
|
|
|
|
css: '.tasks > a',
|
|
|
|
timeout: 5,
|
|
|
|
)
|
2018-06-27 09:44:13 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_ux_flow_next_up_advance_to_next_ticket_from_overview
|
|
|
|
@browser = browser_instance
|
|
|
|
login(
|
|
|
|
username: 'master@example.com',
|
|
|
|
password: 'test',
|
|
|
|
url: browser_url,
|
|
|
|
)
|
|
|
|
tasks_close_all()
|
|
|
|
|
|
|
|
ux_flow_next_up = 'Advance to next ticket from overview'
|
|
|
|
macro_name = "Test #{ux_flow_next_up}"
|
|
|
|
macro_create(
|
|
|
|
name: macro_name,
|
|
|
|
ux_flow_next_up: ux_flow_next_up,
|
|
|
|
)
|
|
|
|
|
2019-11-28 06:59:22 +00:00
|
|
|
title_prefix = "macro #{macro_name}"
|
2018-06-27 09:44:13 +00:00
|
|
|
ticket1 = ticket_create(
|
|
|
|
data: {
|
|
|
|
customer: 'nico',
|
|
|
|
group: 'Users',
|
|
|
|
title: "#{title_prefix} - 1",
|
|
|
|
body: "some body - macro #{macro_name}",
|
|
|
|
},
|
|
|
|
)
|
2018-06-11 07:28:03 +00:00
|
|
|
|
2018-06-27 09:44:13 +00:00
|
|
|
ticket2 = ticket_create(
|
|
|
|
data: {
|
|
|
|
customer: 'nico',
|
|
|
|
group: 'Users',
|
|
|
|
title: "#{title_prefix} - 2",
|
|
|
|
body: "some body - macro #{macro_name}",
|
|
|
|
},
|
|
|
|
)
|
2018-06-11 07:28:03 +00:00
|
|
|
|
2018-06-27 09:44:13 +00:00
|
|
|
# we need to close all open ticket tasks because
|
|
|
|
# otherwise the Zoom view won't change in "Overview"-mode
|
|
|
|
# when we re-enter the Zoom view for a ticket via the overview
|
2018-06-11 07:28:03 +00:00
|
|
|
tasks_close_all()
|
|
|
|
|
2020-03-19 08:17:49 +00:00
|
|
|
sleep 8 # to update overview list to open correct/next ticket in overview
|
|
|
|
|
2018-06-27 09:44:13 +00:00
|
|
|
ticket_open_by_overview(
|
|
|
|
title: ticket1[:title],
|
|
|
|
link: '#ticket/view/all_unassigned',
|
|
|
|
)
|
|
|
|
|
|
|
|
verify_task(
|
|
|
|
data: {
|
|
|
|
title: ticket1[:title],
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
perform_macro(name: macro_name)
|
|
|
|
|
|
|
|
verify_task(
|
|
|
|
data: {
|
|
|
|
title: ticket2[:title],
|
|
|
|
}
|
|
|
|
)
|
2016-09-05 13:18:22 +00:00
|
|
|
end
|
|
|
|
end
|