trabajo-afectivo/test/browser/agent_ticket_macro_test.rb

181 lines
3.9 KiB
Ruby
Raw Normal View History

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
@browser = browser_instance
login(
username: 'agent1@example.com',
password: 'test',
2018-06-27 09:44:13 +00:00
url: browser_url,
)
tasks_close_all()
2018-06-27 09:44:13 +00:00
ticket = ticket_create(
data: {
customer: 'nico',
2018-06-27 09:44:13 +00:00
group: 'Users',
title: 'some subject - macro "Close & Tag as Spam" default',
body: 'some body - macro "Close & Tag as Spam" default',
},
)
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],
)
tags_verify(
tags: {
'spam' => true,
'tag1' => false,
}
)
end
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(
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',
title: "some subject - macro #{macro_name}",
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(
data: {
2018-06-27 09:44:13 +00:00
customer: 'nico',
group: 'Users',
title: "some subject - macro #{macro_name}",
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)
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,
)
title_prefix = "some subject - macro #{macro_name}"
ticket1 = ticket_create(
data: {
customer: 'nico',
group: 'Users',
title: "#{title_prefix} - 1",
body: "some body - macro #{macro_name}",
},
)
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-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
tasks_close_all()
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