Refactored failing Macro browser test.
This commit is contained in:
parent
fb397822be
commit
d4ac9302d8
1 changed files with 132 additions and 71 deletions
|
@ -2,7 +2,8 @@
|
||||||
require 'browser_test_helper'
|
require 'browser_test_helper'
|
||||||
|
|
||||||
class AgentTicketMacroTest < TestCase
|
class AgentTicketMacroTest < TestCase
|
||||||
def test_macro
|
|
||||||
|
def test_close_and_tag_as_spam_default
|
||||||
@browser = browser_instance
|
@browser = browser_instance
|
||||||
login(
|
login(
|
||||||
username: 'agent1@example.com',
|
username: 'agent1@example.com',
|
||||||
|
@ -11,19 +12,27 @@ class AgentTicketMacroTest < TestCase
|
||||||
)
|
)
|
||||||
tasks_close_all()
|
tasks_close_all()
|
||||||
|
|
||||||
ticket1 = ticket_create(
|
ticket = ticket_create(
|
||||||
data: {
|
data: {
|
||||||
customer: 'nico',
|
customer: 'nico',
|
||||||
group: 'Users',
|
group: 'Users',
|
||||||
title: 'some subject - macro#1',
|
title: 'some subject - macro "Close & Tag as Spam" default',
|
||||||
body: 'some body - macro#1',
|
body: 'some body - macro "Close & Tag as Spam" default',
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
click(css: '.active.content .js-submitDropdown .js-openDropdownMacro')
|
perform_macro(name: 'Close & Tag as Spam')
|
||||||
click(css: '.active.content .js-submitDropdown .js-dropdownActionMacro')
|
|
||||||
|
# check redirect after perfoming macro
|
||||||
|
location_check(
|
||||||
|
url: "#{browser_url}/#dashboard",
|
||||||
|
)
|
||||||
|
|
||||||
|
# reopen ticket and verify tags
|
||||||
|
ticket_open_by_search(
|
||||||
|
number: ticket[:number],
|
||||||
|
)
|
||||||
|
|
||||||
# verify tags
|
|
||||||
tags_verify(
|
tags_verify(
|
||||||
tags: {
|
tags: {
|
||||||
'spam' => true,
|
'spam' => true,
|
||||||
|
@ -32,7 +41,7 @@ class AgentTicketMacroTest < TestCase
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_macro_ux_flow_next_up
|
def test_ux_flow_next_up_stay_on_tab
|
||||||
@browser = browser_instance
|
@browser = browser_instance
|
||||||
login(
|
login(
|
||||||
username: 'master@example.com',
|
username: 'master@example.com',
|
||||||
|
@ -41,77 +50,129 @@ class AgentTicketMacroTest < TestCase
|
||||||
)
|
)
|
||||||
tasks_close_all()
|
tasks_close_all()
|
||||||
|
|
||||||
# Setup: Create two tickets
|
ux_flow_next_up = 'Stay on tab'
|
||||||
ticket_create(
|
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(
|
||||||
data: {
|
data: {
|
||||||
customer: 'nicole.braun',
|
customer: 'nico',
|
||||||
group: 'Users',
|
group: 'Users',
|
||||||
title: 'Sample Ticket 1',
|
title: "some subject - macro #{macro_name}",
|
||||||
body: 'Lorem ipsum dolor sit amet consectetur adipisicing elit.',
|
body: "some body - macro #{macro_name}",
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
ticket_create(
|
perform_macro(name: macro_name)
|
||||||
data: {
|
|
||||||
customer: 'nicole.braun',
|
location_check(
|
||||||
group: 'Users',
|
url: "#{browser_url}/#ticket/zoom/#{ticket[:id]}",
|
||||||
title: 'Sample Ticket 2',
|
|
||||||
body: 'Suspendisse volutpat lectus sem, in fermentum orci semper sit amet.',
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Setup: Create three macros (one for each ux_flow_next_up option)
|
tags_verify(
|
||||||
click(css: 'a[href="#manage"]')
|
tags: {
|
||||||
click(css: '.sidebar a[href="#manage/macros"]')
|
'spam' => true,
|
||||||
macro_options = ['Stay on tab', 'Close tab', 'Advance to next ticket from overview']
|
'tag1' => false,
|
||||||
macro_options.each.with_index do |o, i|
|
}
|
||||||
click(css: '.page-header-meta > a[data-type="new"]')
|
)
|
||||||
sendkey(css: '.modal-body input[name="name"]', value: "Test Macro #{i + 1}")
|
|
||||||
select(css: '.modal-body select[name="ux_flow_next_up"]', value: o)
|
|
||||||
click(css: '.modal-footer button[type="submit"]')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
click(css: 'a[title$="Sample Ticket 1"]')
|
def test_ux_flow_next_up_close_tab
|
||||||
|
@browser = browser_instance
|
||||||
# Assert: Run the first macro and verify the tab is still open
|
login(
|
||||||
click(css: '.active.content .js-submitDropdown .js-openDropdownMacro')
|
username: 'master@example.com',
|
||||||
click(css: '.active.content .js-submitDropdown .js-dropdownActionMacro[data-id="2"]')
|
password: 'test',
|
||||||
match(css: '.tasks > a.is-active > .nav-tab-name', value: 'Sample Ticket 1',)
|
url: browser_url,
|
||||||
|
)
|
||||||
# Setup: Close all tabs and reopen only the first ticket
|
|
||||||
tasks_close_all()
|
tasks_close_all()
|
||||||
click(css: 'a[href="#ticket/view"]')
|
|
||||||
begin
|
|
||||||
remaining_retries = 1
|
|
||||||
click(css: 'a[href="#ticket/view/all_unassigned"]')
|
|
||||||
# responsive design means some elements are un-clickable at certain viewport sizes
|
|
||||||
rescue Selenium::WebDriver::Error::WebDriverError => e
|
|
||||||
raise e if remaining_retries.zero?
|
|
||||||
(remaining_retries -= 1) && click(css: 'a.tab.js-tab[href="#ticket/view/all_unassigned"]')
|
|
||||||
end
|
|
||||||
click(css: 'td[title="Sample Ticket 1"]')
|
|
||||||
|
|
||||||
# Assert: Run the second macro and verify the tab is closed
|
ux_flow_next_up = 'Close tab'
|
||||||
click(css: '.active.content .js-submitDropdown .js-openDropdownMacro')
|
macro_name = "Test #{ux_flow_next_up}"
|
||||||
click(css: '.active.content .js-submitDropdown .js-dropdownActionMacro[data-id="3"]')
|
macro_create(
|
||||||
|
name: macro_name,
|
||||||
|
ux_flow_next_up: ux_flow_next_up,
|
||||||
|
)
|
||||||
|
|
||||||
|
ticket = ticket_create(
|
||||||
|
data: {
|
||||||
|
customer: 'nico',
|
||||||
|
group: 'Users',
|
||||||
|
title: "some subject - macro #{macro_name}",
|
||||||
|
body: "some body - macro #{macro_name}",
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
perform_macro(name: macro_name)
|
||||||
|
|
||||||
exists_not(css: '.tasks > a')
|
exists_not(css: '.tasks > a')
|
||||||
|
end
|
||||||
|
|
||||||
# Setup: Reopen the first ticket via a Ticket Overview
|
def test_ux_flow_next_up_advance_to_next_ticket_from_overview
|
||||||
click(css: 'a[href="#ticket/view"]')
|
@browser = browser_instance
|
||||||
begin
|
login(
|
||||||
remaining_retries = 1
|
username: 'master@example.com',
|
||||||
click(css: 'a[href="#ticket/view/all_unassigned"]')
|
password: 'test',
|
||||||
# responsive design means some elements are un-clickable at certain viewport sizes
|
url: browser_url,
|
||||||
rescue Selenium::WebDriver::Error::WebDriverError => e
|
)
|
||||||
raise e if remaining_retries.zero?
|
tasks_close_all()
|
||||||
(remaining_retries -= 1) && click(css: 'a.tab.js-tab[href="#ticket/view/all_unassigned"]')
|
|
||||||
end
|
|
||||||
click(css: 'td[title="Sample Ticket 1"]')
|
|
||||||
|
|
||||||
# Assert: Run the third macro and verify the second ticket opens
|
ux_flow_next_up = 'Advance to next ticket from overview'
|
||||||
click(css: '.active.content .js-submitDropdown .js-openDropdownMacro')
|
macro_name = "Test #{ux_flow_next_up}"
|
||||||
click(css: '.active.content .js-submitDropdown .js-dropdownActionMacro[data-id="4"]')
|
macro_create(
|
||||||
match_not(css: '.tasks > a.task > .nav-tab-name', value: 'Sample Ticket 1',)
|
name: macro_name,
|
||||||
match(css: '.tasks > a.is-active > .nav-tab-name', value: 'Sample Ticket 2',)
|
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}",
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
ticket2 = ticket_create(
|
||||||
|
data: {
|
||||||
|
customer: 'nico',
|
||||||
|
group: 'Users',
|
||||||
|
title: "#{title_prefix} - 2",
|
||||||
|
body: "some body - macro #{macro_name}",
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
# 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()
|
||||||
|
|
||||||
|
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],
|
||||||
|
}
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue