Added task modified tests. Added attachment reference tests.
This commit is contained in:
parent
cf16efcc17
commit
87be963296
7 changed files with 231 additions and 25 deletions
|
@ -419,6 +419,13 @@ class App.TicketCreate extends App.Controller
|
||||||
# save ticket, create article
|
# save ticket, create article
|
||||||
else
|
else
|
||||||
|
|
||||||
|
# check attachment
|
||||||
|
if article['body']
|
||||||
|
if App.Utils.checkAttachmentReference( article['body'] )
|
||||||
|
if @$('.richtext .attachments .attachment').length < 1
|
||||||
|
if !confirm( App.i18n.translateContent('You use attachment in text but no attachment is attached. Do you want to continue?') )
|
||||||
|
return
|
||||||
|
|
||||||
# disable form
|
# disable form
|
||||||
@formDisable(e)
|
@formDisable(e)
|
||||||
ui = @
|
ui = @
|
||||||
|
|
|
@ -262,6 +262,7 @@ class App.TicketZoom extends App.Controller
|
||||||
ticket: @ticket
|
ticket: @ticket
|
||||||
overview_id: @overview_id
|
overview_id: @overview_id
|
||||||
el: @el.find('.ticket-title')
|
el: @el.find('.ticket-title')
|
||||||
|
task_key: @task_key
|
||||||
)
|
)
|
||||||
|
|
||||||
new TicketMeta(
|
new TicketMeta(
|
||||||
|
@ -639,8 +640,7 @@ class App.TicketZoom extends App.Controller
|
||||||
# validate article
|
# validate article
|
||||||
articleParams = @formParam( @$('.article-add') )
|
articleParams = @formParam( @$('.article-add') )
|
||||||
console.log "submit article", articleParams
|
console.log "submit article", articleParams
|
||||||
articleAttributes = App.TicketArticle.attributesGet( 'edit' )
|
if articleParams['body']
|
||||||
if articleParams['body'] #&& $( articleParams['body'] ).text()
|
|
||||||
articleParams.from = @Session.get().displayName()
|
articleParams.from = @Session.get().displayName()
|
||||||
articleParams.ticket_id = ticket.id
|
articleParams.ticket_id = ticket.id
|
||||||
articleParams.form_id = @form_id
|
articleParams.form_id = @form_id
|
||||||
|
@ -670,21 +670,23 @@ class App.TicketZoom extends App.Controller
|
||||||
# check if recipient exists
|
# check if recipient exists
|
||||||
if !articleParams['to'] && !articleParams['cc']
|
if !articleParams['to'] && !articleParams['cc']
|
||||||
alert( App.i18n.translateContent('Need recipient in "To" or "Cc".') )
|
alert( App.i18n.translateContent('Need recipient in "To" or "Cc".') )
|
||||||
|
@formEnable(e)
|
||||||
@autosaveStart()
|
@autosaveStart()
|
||||||
return
|
return
|
||||||
|
|
||||||
# check if message exists
|
# check if message exists
|
||||||
if !articleParams['body']
|
if !articleParams['body']
|
||||||
alert( App.i18n.translateContent('Text needed') )
|
alert( App.i18n.translateContent('Text needed') )
|
||||||
|
@formEnable(e)
|
||||||
@autosaveStart()
|
@autosaveStart()
|
||||||
return
|
return
|
||||||
|
|
||||||
# check attachment
|
# check attachment
|
||||||
if articleParams['body']
|
if articleParams['body']
|
||||||
attachmentTranslated = App.i18n.translateContent('Attachment')
|
if App.Utils.checkAttachmentReference( articleParams['body'] )
|
||||||
attachmentTranslatedRegExp = new RegExp( attachmentTranslated, 'i' )
|
if @$('.article-add .textBubble .attachments .attachment').length < 1
|
||||||
if articleParams['body'].match(/attachment/i) || articleParams['body'].match( attachmentTranslatedRegExp )
|
|
||||||
if !confirm( App.i18n.translateContent('You use attachment in text but no attachment is attached. Do you want to continue?') )
|
if !confirm( App.i18n.translateContent('You use attachment in text but no attachment is attached. Do you want to continue?') )
|
||||||
|
@formEnable(e)
|
||||||
@autosaveStart()
|
@autosaveStart()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -714,6 +716,8 @@ class App.TicketZoom extends App.Controller
|
||||||
# reset form after save
|
# reset form after save
|
||||||
@taskReset()
|
@taskReset()
|
||||||
|
|
||||||
|
App.TaskManager.mute( @task_key )
|
||||||
|
|
||||||
@fetch( ticket.id, true )
|
@fetch( ticket.id, true )
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -800,6 +804,8 @@ class TicketTitle extends App.Controller
|
||||||
|
|
||||||
@ticket.save()
|
@ticket.save()
|
||||||
|
|
||||||
|
App.TaskManager.mute( @task_key )
|
||||||
|
|
||||||
# update taskbar with new meta data
|
# update taskbar with new meta data
|
||||||
App.Event.trigger 'task:render'
|
App.Event.trigger 'task:render'
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,11 @@ class App.TaskManager
|
||||||
_instance ?= new _taskManagerSingleton
|
_instance ?= new _taskManagerSingleton
|
||||||
_instance.notify( key )
|
_instance.notify( key )
|
||||||
|
|
||||||
|
@mute: ( key ) ->
|
||||||
|
if _instance == undefined
|
||||||
|
_instance ?= new _taskManagerSingleton
|
||||||
|
_instance.mute( key )
|
||||||
|
|
||||||
@reorder: ( order ) ->
|
@reorder: ( order ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _taskManagerSingleton
|
_instance ?= new _taskManagerSingleton
|
||||||
|
@ -328,6 +333,14 @@ class _taskManagerSingleton extends Spine.Module
|
||||||
task.notify = true
|
task.notify = true
|
||||||
@taskUpdate( task )
|
@taskUpdate( task )
|
||||||
|
|
||||||
|
# unset notify of task
|
||||||
|
mute: ( key ) =>
|
||||||
|
task = @get( key )
|
||||||
|
if !task
|
||||||
|
throw "No such task with '#{key}' to mute"
|
||||||
|
task.notify = false
|
||||||
|
@taskUpdate( task )
|
||||||
|
|
||||||
# set new order of tasks (needed for dnd)
|
# set new order of tasks (needed for dnd)
|
||||||
reorder: ( order ) =>
|
reorder: ( order ) =>
|
||||||
prio = 0
|
prio = 0
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
class App.TestHelper
|
||||||
|
@attachmentUploadFake: ( selector ) ->
|
||||||
|
|
||||||
|
fileTemplate = '''<div class="attachment horizontal">
|
||||||
|
<div class="attachment-name u-highlight">fake.file</div>
|
||||||
|
<div class="attachment-size">30 KB</div>
|
||||||
|
<div class="attachment-delete js-delete align-right u-clickable" data-id="33009">
|
||||||
|
<div class="delete icon"></div>Delete File
|
||||||
|
</div>
|
||||||
|
</div>'''
|
||||||
|
$(selector).append(fileTemplate)
|
|
@ -264,3 +264,12 @@ class App.Utils
|
||||||
value = undefined
|
value = undefined
|
||||||
|
|
||||||
value
|
value
|
||||||
|
|
||||||
|
# check if attachment is referenced in message
|
||||||
|
@checkAttachmentReference: (message) ->
|
||||||
|
return false if !message
|
||||||
|
return true if message.match(/attachment/i)
|
||||||
|
attachmentTranslated = App.i18n.translateContent('Attachment')
|
||||||
|
attachmentTranslatedRegExp = new RegExp( attachmentTranslated, 'i' )
|
||||||
|
return true if message.match( attachmentTranslatedRegExp )
|
||||||
|
false
|
||||||
|
|
|
@ -90,6 +90,7 @@ class AgentTicketActionsLevel2Test < TestCase
|
||||||
:browser => browser2,
|
:browser => browser2,
|
||||||
:data => {
|
:data => {
|
||||||
:title => 'TTTsome level 2 <b>subject<\/b> 123äöü',
|
:title => 'TTTsome level 2 <b>subject<\/b> 123äöü',
|
||||||
|
:modified => false,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -108,6 +109,7 @@ class AgentTicketActionsLevel2Test < TestCase
|
||||||
:browser => browser1,
|
:browser => browser1,
|
||||||
:data => {
|
:data => {
|
||||||
:title => 'TTTsome level 2 <b>subject<\/b> 123äöü',
|
:title => 'TTTsome level 2 <b>subject<\/b> 123äöü',
|
||||||
|
:modified => true,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -137,6 +139,13 @@ class AgentTicketActionsLevel2Test < TestCase
|
||||||
:css => '.active div.ticket-article',
|
:css => '.active div.ticket-article',
|
||||||
:value => 'some update 4711',
|
:value => 'some update 4711',
|
||||||
)
|
)
|
||||||
|
verify_task(
|
||||||
|
:browser => browser1,
|
||||||
|
:data => {
|
||||||
|
:title => 'TTTsome level 2 <b>subject<\/b> 123äöü',
|
||||||
|
:modified => false,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
# verify if text in input body is now empty
|
# verify if text in input body is now empty
|
||||||
ticket_verify(
|
ticket_verify(
|
||||||
|
@ -154,6 +163,15 @@ class AgentTicketActionsLevel2Test < TestCase
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# verify task
|
||||||
|
verify_task(
|
||||||
|
:browser => browser2,
|
||||||
|
:data => {
|
||||||
|
:title => 'TTTsome level 2 <b>subject<\/b> 123äöü',
|
||||||
|
:modified => true,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
# reload instances, verify again
|
# reload instances, verify again
|
||||||
reload(
|
reload(
|
||||||
:browser => browser1,
|
:browser => browser1,
|
||||||
|
@ -178,6 +196,7 @@ class AgentTicketActionsLevel2Test < TestCase
|
||||||
:browser => browser2,
|
:browser => browser2,
|
||||||
:data => {
|
:data => {
|
||||||
:title => 'TTTsome level 2 <b>subject<\/b> 123äöü',
|
:title => 'TTTsome level 2 <b>subject<\/b> 123äöü',
|
||||||
|
:modified => false, # modify was muted at reload ticket tab
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -195,6 +214,7 @@ class AgentTicketActionsLevel2Test < TestCase
|
||||||
:browser => browser1,
|
:browser => browser1,
|
||||||
:data => {
|
:data => {
|
||||||
:title => 'TTTsome level 2 <b>subject<\/b> 123äöü',
|
:title => 'TTTsome level 2 <b>subject<\/b> 123äöü',
|
||||||
|
:modified => false,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -210,7 +230,6 @@ class AgentTicketActionsLevel2Test < TestCase
|
||||||
:value => 'some update 4711',
|
:value => 'some update 4711',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# verify if text in input body is now empty
|
# verify if text in input body is now empty
|
||||||
ticket_verify(
|
ticket_verify(
|
||||||
:browser => browser1,
|
:browser => browser1,
|
||||||
|
|
141
test/browser/agent_ticket_actions_level6_test.rb
Normal file
141
test/browser/agent_ticket_actions_level6_test.rb
Normal file
|
@ -0,0 +1,141 @@
|
||||||
|
# encoding: utf-8
|
||||||
|
require 'browser_test_helper'
|
||||||
|
|
||||||
|
class AgentTicketActionLevel6Test < TestCase
|
||||||
|
def test_ticket
|
||||||
|
|
||||||
|
@browser = browser_instance
|
||||||
|
login(
|
||||||
|
:username => 'agent1@example.com',
|
||||||
|
:password => 'test',
|
||||||
|
:url => browser_url,
|
||||||
|
)
|
||||||
|
tasks_close_all()
|
||||||
|
|
||||||
|
#
|
||||||
|
# attachment checks - new ticket
|
||||||
|
#
|
||||||
|
|
||||||
|
# create new ticket with no attachment, attachment check should pop up
|
||||||
|
ticket1 = ticket_create(
|
||||||
|
:data => {
|
||||||
|
:customer => 'nico',
|
||||||
|
:group => 'Users',
|
||||||
|
:title => 'test 6 - ticket 1',
|
||||||
|
:body => 'test 6 - ticket 1 - with the word attachment, but not attachment atteched it should give an warning on submit',
|
||||||
|
},
|
||||||
|
:do_not_submit => true,
|
||||||
|
)
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
# submit form
|
||||||
|
click( :css => '.content.active button.submit' )
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
# check warning
|
||||||
|
alert = @browser.switch_to.alert
|
||||||
|
alert.dismiss()
|
||||||
|
#alert.accept()
|
||||||
|
#alert = alert.text
|
||||||
|
|
||||||
|
# add attachment, attachment check should quiet
|
||||||
|
@browser.execute_script( "App.TestHelper.attachmentUploadFake('.active .richtext .attachments')" )
|
||||||
|
|
||||||
|
# submit form
|
||||||
|
click( :css => '.content.active button.submit' )
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
# no warning
|
||||||
|
#alert = @browser.switch_to.alert
|
||||||
|
|
||||||
|
# check if ticket is shown
|
||||||
|
location_check( :url => '#ticket/zoom/' )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# attachment checks - update ticket
|
||||||
|
#
|
||||||
|
|
||||||
|
# update ticket with no attachment, attachment check should pop up
|
||||||
|
ticket_update(
|
||||||
|
:data => {
|
||||||
|
:body => 'test 6 - ticket 1-1 - with the word attachment, but not attachment atteched it should give an warning on submit',
|
||||||
|
},
|
||||||
|
:do_not_submit => true,
|
||||||
|
)
|
||||||
|
|
||||||
|
# submit form
|
||||||
|
click(
|
||||||
|
:css => '.active button.js-submit',
|
||||||
|
)
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
# check warning
|
||||||
|
alert = @browser.switch_to.alert
|
||||||
|
alert.dismiss()
|
||||||
|
|
||||||
|
# add attachment, attachment check should quiet
|
||||||
|
@browser.execute_script( "App.TestHelper.attachmentUploadFake('.active .article-add .textBubble .attachments')" )
|
||||||
|
|
||||||
|
# submit form
|
||||||
|
click(
|
||||||
|
:css => '.active button.js-submit',
|
||||||
|
)
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
# no warning
|
||||||
|
#alert = @browser.switch_to.alert
|
||||||
|
|
||||||
|
# check if article exists
|
||||||
|
|
||||||
|
# discard changes should gone away
|
||||||
|
watch_for_disappear(
|
||||||
|
:css => '.content.active .js-reset',
|
||||||
|
:value => '(Discard your unsaved changes.|Verwerfen der)',
|
||||||
|
:no_quote => true,
|
||||||
|
)
|
||||||
|
ticket_verify(
|
||||||
|
:data => {
|
||||||
|
:body => '',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
# check content and edit screen in instance 1
|
||||||
|
match(
|
||||||
|
:css => '.active div.ticket-article',
|
||||||
|
:value => 'test 6 - ticket 1-1',
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# ticket customer change checks
|
||||||
|
#
|
||||||
|
|
||||||
|
# update customer, check if new customer is shown in side bar
|
||||||
|
|
||||||
|
|
||||||
|
# check if customer has changed in second browser
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# ticket customer organization change checks
|
||||||
|
#
|
||||||
|
|
||||||
|
# change org of customer, check if org is shown in sidebar
|
||||||
|
|
||||||
|
|
||||||
|
# check if org has changed in second browser
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# form change/reset checks
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
# some form reset checks
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue