Added tests for tagging and linking tickets.
This commit is contained in:
parent
c1c1930bdc
commit
7d45be9a8e
5 changed files with 195 additions and 12 deletions
|
@ -62,7 +62,6 @@ class App.TicketZoomSidebar extends App.Controller
|
|||
object_type: 'Ticket'
|
||||
object: ticket
|
||||
links: @links
|
||||
container: @el.closest('.content')
|
||||
)
|
||||
|
||||
showTicketHistory = =>
|
||||
|
|
|
@ -2,6 +2,7 @@ class App.WidgetLink extends App.Controller
|
|||
events:
|
||||
'click .js-add': 'add'
|
||||
'click .js-delete': 'delete'
|
||||
'click .js-delete .icon': 'delete'
|
||||
|
||||
constructor: ->
|
||||
super
|
||||
|
@ -48,9 +49,9 @@ class App.WidgetLink extends App.Controller
|
|||
|
||||
delete: (e) =>
|
||||
e.preventDefault()
|
||||
link_type = $(e.target).data('link-type')
|
||||
link_object_source = $(e.target).data('object')
|
||||
link_object_source_value = $(e.target).data('object-id')
|
||||
link_type = $(e.currentTarget).data('link-type')
|
||||
link_object_source = $(e.currentTarget).data('object')
|
||||
link_object_source_value = $(e.currentTarget).data('object-id')
|
||||
link_object_target = @object_type
|
||||
link_object_target_value = @object.id
|
||||
|
||||
|
@ -77,7 +78,7 @@ class App.WidgetLink extends App.Controller
|
|||
link_object_id: @object.id
|
||||
object: @object
|
||||
parent: @
|
||||
container: @container
|
||||
container: @el.closest('.content')
|
||||
)
|
||||
|
||||
class App.LinkAdd extends App.ControllerModal
|
||||
|
@ -92,7 +93,7 @@ class App.LinkAdd extends App.ControllerModal
|
|||
@ticket = @object
|
||||
@fetch()
|
||||
|
||||
fetch: ->
|
||||
fetch: =>
|
||||
@ajax(
|
||||
id: 'ticket_related'
|
||||
type: 'GET'
|
||||
|
|
|
@ -56,7 +56,12 @@ class App.WidgetTag extends App.Controller
|
|||
return if !item
|
||||
@add(item)
|
||||
|
||||
add: (item) =>
|
||||
add: (items) =>
|
||||
for item in items.split(',')
|
||||
item = item.trim()
|
||||
@addItem(item)
|
||||
|
||||
addItem: (item) =>
|
||||
if _.contains(@tags, item)
|
||||
@render()
|
||||
return
|
||||
|
|
176
test/browser/agent_ticket_actions_level8_test.rb
Normal file
176
test/browser/agent_ticket_actions_level8_test.rb
Normal file
|
@ -0,0 +1,176 @@
|
|||
# encoding: utf-8
|
||||
require 'browser_test_helper'
|
||||
|
||||
class AgentTicketActionLevel8Test < TestCase
|
||||
def test_tags
|
||||
|
||||
@browser = browser_instance
|
||||
login(
|
||||
username: 'agent1@example.com',
|
||||
password: 'test',
|
||||
url: browser_url,
|
||||
)
|
||||
tasks_close_all()
|
||||
|
||||
# create new ticket
|
||||
ticket1 = ticket_create(
|
||||
data: {
|
||||
customer: 'nico',
|
||||
group: 'Users',
|
||||
title: 'some subject 123äöü - tags',
|
||||
body: 'some body 123äöü - tags',
|
||||
},
|
||||
)
|
||||
|
||||
# set tag #1
|
||||
click(
|
||||
css: '.content.active .js-newTagLabel',
|
||||
)
|
||||
set(
|
||||
css: '.content.active .js-newTagInput',
|
||||
value: 'tag1',
|
||||
)
|
||||
sendkey(
|
||||
value: :enter,
|
||||
)
|
||||
|
||||
# set tag #2
|
||||
click(
|
||||
css: '.content.active .js-newTagLabel',
|
||||
)
|
||||
set(
|
||||
css: '.content.active .js-newTagInput',
|
||||
value: 'tag 2',
|
||||
)
|
||||
sendkey(
|
||||
value: :enter,
|
||||
)
|
||||
|
||||
# set tag #3 + #4
|
||||
click(
|
||||
css: '.content.active .js-newTagLabel',
|
||||
)
|
||||
set(
|
||||
css: '.content.active .js-newTagInput',
|
||||
value: 'tag3, tag4',
|
||||
)
|
||||
sendkey(
|
||||
value: :enter,
|
||||
)
|
||||
|
||||
# verify tags
|
||||
tags = @browser.find_elements({ css: '.content.active .js-tag' })
|
||||
assert(tags)
|
||||
assert(tags[0])
|
||||
tags.each {|element|
|
||||
text = element.text
|
||||
if text == 'tag1'
|
||||
assert(true, 'tag1 exists')
|
||||
elsif text == 'tag 2'
|
||||
assert(true, 'tag 2 exists')
|
||||
elsif text == 'tag3'
|
||||
assert(true, 'tag3 exists')
|
||||
elsif text == 'tag4'
|
||||
assert(true, 'tag4 exists')
|
||||
else
|
||||
assert(false, "invalid tag '#{text}'")
|
||||
end
|
||||
}
|
||||
|
||||
# reload browser
|
||||
reload()
|
||||
|
||||
# verify tags
|
||||
tags = @browser.find_elements({ css: '.content.active .js-tag' })
|
||||
assert(tags)
|
||||
assert(tags[0])
|
||||
tags.each {|element|
|
||||
text = element.text
|
||||
if text == 'tag1'
|
||||
assert(true, 'tag1 exists')
|
||||
elsif text == 'tag 2'
|
||||
assert(true, 'tag 2 exists')
|
||||
elsif text == 'tag3'
|
||||
assert(true, 'tag3 exists')
|
||||
elsif text == 'tag4'
|
||||
assert(true, 'tag4 exists')
|
||||
else
|
||||
assert(false, "invalid tag '#{text}'")
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
def test_link
|
||||
|
||||
@browser = browser_instance
|
||||
login(
|
||||
username: 'agent1@example.com',
|
||||
password: 'test',
|
||||
url: browser_url,
|
||||
)
|
||||
tasks_close_all()
|
||||
|
||||
ticket1 = ticket_create(
|
||||
data: {
|
||||
customer: 'nico',
|
||||
group: 'Users',
|
||||
title: 'some subject - link#1',
|
||||
body: 'some body - link#1',
|
||||
},
|
||||
)
|
||||
|
||||
ticket2 = ticket_create(
|
||||
data: {
|
||||
customer: 'nico',
|
||||
group: 'Users',
|
||||
title: 'some subject - link#2',
|
||||
body: 'some body - link#2',
|
||||
},
|
||||
)
|
||||
|
||||
click(
|
||||
css: '.content.active .links .js-add',
|
||||
)
|
||||
sleep 2
|
||||
|
||||
set(
|
||||
css: '.content.active .modal-body [name="ticket_number"]',
|
||||
value: ticket1[:number],
|
||||
)
|
||||
select(
|
||||
css: '.content.active .modal-body [name="link_type"]',
|
||||
value: 'normal',
|
||||
)
|
||||
click(
|
||||
css: '.content.active .modal-footer .js-submit',
|
||||
)
|
||||
|
||||
watch_for(
|
||||
css: '.content.active .ticketLinks',
|
||||
value: ticket1[:title],
|
||||
)
|
||||
|
||||
reload()
|
||||
|
||||
watch_for(
|
||||
css: '.content.active .ticketLinks',
|
||||
value: ticket1[:title],
|
||||
)
|
||||
click(
|
||||
css: '.content.active .ticketLinks .js-delete'
|
||||
)
|
||||
watch_for_disappear(
|
||||
css: '.content.active .ticketLinks',
|
||||
value: ticket1[:title],
|
||||
)
|
||||
|
||||
reload()
|
||||
|
||||
watch_for_disappear(
|
||||
css: '.content.active .ticketLinks',
|
||||
value: ticket1[:title],
|
||||
)
|
||||
|
||||
end
|
||||
|
||||
end
|
|
@ -1202,6 +1202,7 @@ wait untill text in selector disabppears
|
|||
{
|
||||
id: 123,
|
||||
number: '100001',
|
||||
title: 'overview #1',
|
||||
}
|
||||
|
||||
=end
|
||||
|
@ -1308,6 +1309,7 @@ wait untill text in selector disabppears
|
|||
ticket = {
|
||||
id: id,
|
||||
number: number,
|
||||
title: data[:title],
|
||||
}
|
||||
sleep 3 # wait until notify is gone
|
||||
screenshot(browser: instance, comment: 'ticket_create_ok')
|
||||
|
|
Loading…
Reference in a new issue