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
|
||||
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
|
||||
@formDisable(e)
|
||||
ui = @
|
||||
|
|
|
@ -262,6 +262,7 @@ class App.TicketZoom extends App.Controller
|
|||
ticket: @ticket
|
||||
overview_id: @overview_id
|
||||
el: @el.find('.ticket-title')
|
||||
task_key: @task_key
|
||||
)
|
||||
|
||||
new TicketMeta(
|
||||
|
@ -639,8 +640,7 @@ class App.TicketZoom extends App.Controller
|
|||
# validate article
|
||||
articleParams = @formParam( @$('.article-add') )
|
||||
console.log "submit article", articleParams
|
||||
articleAttributes = App.TicketArticle.attributesGet( 'edit' )
|
||||
if articleParams['body'] #&& $( articleParams['body'] ).text()
|
||||
if articleParams['body']
|
||||
articleParams.from = @Session.get().displayName()
|
||||
articleParams.ticket_id = ticket.id
|
||||
articleParams.form_id = @form_id
|
||||
|
@ -670,21 +670,23 @@ class App.TicketZoom extends App.Controller
|
|||
# check if recipient exists
|
||||
if !articleParams['to'] && !articleParams['cc']
|
||||
alert( App.i18n.translateContent('Need recipient in "To" or "Cc".') )
|
||||
@formEnable(e)
|
||||
@autosaveStart()
|
||||
return
|
||||
|
||||
# check if message exists
|
||||
if !articleParams['body']
|
||||
alert( App.i18n.translateContent('Text needed') )
|
||||
@formEnable(e)
|
||||
@autosaveStart()
|
||||
return
|
||||
|
||||
# check attachment
|
||||
if articleParams['body']
|
||||
attachmentTranslated = App.i18n.translateContent('Attachment')
|
||||
attachmentTranslatedRegExp = new RegExp( attachmentTranslated, 'i' )
|
||||
if articleParams['body'].match(/attachment/i) || articleParams['body'].match( attachmentTranslatedRegExp )
|
||||
if App.Utils.checkAttachmentReference( articleParams['body'] )
|
||||
if @$('.article-add .textBubble .attachments .attachment').length < 1
|
||||
if !confirm( App.i18n.translateContent('You use attachment in text but no attachment is attached. Do you want to continue?') )
|
||||
@formEnable(e)
|
||||
@autosaveStart()
|
||||
return
|
||||
|
||||
|
@ -714,6 +716,8 @@ class App.TicketZoom extends App.Controller
|
|||
# reset form after save
|
||||
@taskReset()
|
||||
|
||||
App.TaskManager.mute( @task_key )
|
||||
|
||||
@fetch( ticket.id, true )
|
||||
)
|
||||
|
||||
|
@ -800,6 +804,8 @@ class TicketTitle extends App.Controller
|
|||
|
||||
@ticket.save()
|
||||
|
||||
App.TaskManager.mute( @task_key )
|
||||
|
||||
# update taskbar with new meta data
|
||||
App.Event.trigger 'task:render'
|
||||
|
||||
|
|
|
@ -34,6 +34,11 @@ class App.TaskManager
|
|||
_instance ?= new _taskManagerSingleton
|
||||
_instance.notify( key )
|
||||
|
||||
@mute: ( key ) ->
|
||||
if _instance == undefined
|
||||
_instance ?= new _taskManagerSingleton
|
||||
_instance.mute( key )
|
||||
|
||||
@reorder: ( order ) ->
|
||||
if _instance == undefined
|
||||
_instance ?= new _taskManagerSingleton
|
||||
|
@ -328,6 +333,14 @@ class _taskManagerSingleton extends Spine.Module
|
|||
task.notify = true
|
||||
@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)
|
||||
reorder: ( order ) =>
|
||||
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
|
||||
|
||||
# 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,
|
||||
:data => {
|
||||
:title => 'TTTsome level 2 <b>subject<\/b> 123äöü',
|
||||
:modified => false,
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -108,6 +109,7 @@ class AgentTicketActionsLevel2Test < TestCase
|
|||
:browser => browser1,
|
||||
:data => {
|
||||
:title => 'TTTsome level 2 <b>subject<\/b> 123äöü',
|
||||
:modified => true,
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -137,6 +139,13 @@ class AgentTicketActionsLevel2Test < TestCase
|
|||
:css => '.active div.ticket-article',
|
||||
: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
|
||||
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(
|
||||
:browser => browser1,
|
||||
|
@ -178,6 +196,7 @@ class AgentTicketActionsLevel2Test < TestCase
|
|||
:browser => browser2,
|
||||
:data => {
|
||||
: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,
|
||||
:data => {
|
||||
:title => 'TTTsome level 2 <b>subject<\/b> 123äöü',
|
||||
:modified => false,
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -210,7 +230,6 @@ class AgentTicketActionsLevel2Test < TestCase
|
|||
:value => 'some update 4711',
|
||||
)
|
||||
|
||||
|
||||
# verify if text in input body is now empty
|
||||
ticket_verify(
|
||||
: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