Improved tests with task and title check.
This commit is contained in:
parent
18838cb7c5
commit
08bc3bda3e
3 changed files with 179 additions and 67 deletions
|
@ -1,4 +1,4 @@
|
||||||
class Index extends App.ControllerContent
|
class App.Dashboard extends App.Controller
|
||||||
|
|
||||||
constructor: ->
|
constructor: ->
|
||||||
super
|
super
|
||||||
|
@ -10,10 +10,6 @@ class Index extends App.ControllerContent
|
||||||
@navigate '#'
|
@navigate '#'
|
||||||
return
|
return
|
||||||
|
|
||||||
# set title
|
|
||||||
@title 'Dashboard'
|
|
||||||
@navupdate '#dashboard'
|
|
||||||
|
|
||||||
@plugins = {
|
@plugins = {
|
||||||
main: {
|
main: {
|
||||||
my_assigned: {
|
my_assigned: {
|
||||||
|
@ -132,6 +128,46 @@ class Index extends App.ControllerContent
|
||||||
ctx.closePath()
|
ctx.closePath()
|
||||||
ctx.fill()
|
ctx.fill()
|
||||||
|
|
||||||
App.Config.set( 'dashboard', Index, 'Routes' )
|
active: (state) =>
|
||||||
|
@activeState = state
|
||||||
|
|
||||||
|
isActive: =>
|
||||||
|
@activeState
|
||||||
|
|
||||||
|
url: =>
|
||||||
|
'#dashboard'
|
||||||
|
|
||||||
|
show: (params) =>
|
||||||
|
|
||||||
|
# set title
|
||||||
|
@title 'Dashboard'
|
||||||
|
|
||||||
|
# highlight navbar
|
||||||
|
@navupdate '#dashboard'
|
||||||
|
|
||||||
|
hide: =>
|
||||||
|
# no
|
||||||
|
|
||||||
|
changed: =>
|
||||||
|
false
|
||||||
|
|
||||||
|
release: =>
|
||||||
|
# no
|
||||||
|
|
||||||
|
class DashboardRouter extends App.ControllerPermanent
|
||||||
|
constructor: (params) ->
|
||||||
|
super
|
||||||
|
|
||||||
|
App.TaskManager.execute(
|
||||||
|
key: 'Dashboard'
|
||||||
|
controller: 'Dashboard'
|
||||||
|
params: {}
|
||||||
|
show: true
|
||||||
|
persistent: true
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
App.Config.set( 'dashboard', DashboardRouter, 'Routes' )
|
||||||
App.Config.set( 'Dashboard', { prio: 100, parent: '', name: 'Dashboard', target: '#dashboard', role: ['Agent'], class: 'dashboard' }, 'NavBar' )
|
App.Config.set( 'Dashboard', { prio: 100, parent: '', name: 'Dashboard', target: '#dashboard', role: ['Agent'], class: 'dashboard' }, 'NavBar' )
|
||||||
|
|
||||||
|
App.Config.set( 'Dashboard', 'Dashboard', 'permanentTask' )
|
||||||
|
|
|
@ -3,65 +3,130 @@ require 'browser_test_helper'
|
||||||
|
|
||||||
class AgentTicketActionLevel4Test < TestCase
|
class AgentTicketActionLevel4Test < TestCase
|
||||||
def test_agent_ticket_create_with_reload
|
def test_agent_ticket_create_with_reload
|
||||||
tests = [
|
|
||||||
{
|
@browser = browser_instance
|
||||||
:name => 'agent ticket create with reload',
|
login(
|
||||||
:action => [
|
:username => 'agent1@example.com',
|
||||||
{
|
:password => 'test',
|
||||||
:execute => 'close_all_tasks',
|
:url => browser_url,
|
||||||
},
|
)
|
||||||
|
tasks_close_all()
|
||||||
|
|
||||||
# create ticket
|
# create ticket
|
||||||
{
|
ticket_create(
|
||||||
:execute => 'create_ticket',
|
:data => {
|
||||||
|
:customer => 'nicole',
|
||||||
:group => 'Users',
|
:group => 'Users',
|
||||||
:subject => 'some subject 4 - 123äöü',
|
:title => 'some subject 4 - 123äöü',
|
||||||
:body => 'some body 4 - 123äöü',
|
:body => 'some body 4 - 123äöü',
|
||||||
|
},
|
||||||
:do_not_submit => true,
|
:do_not_submit => true,
|
||||||
},
|
)
|
||||||
{
|
sleep 8
|
||||||
:execute => 'wait',
|
|
||||||
:value => 10,
|
# check if customer is shown in sidebar
|
||||||
},
|
match(
|
||||||
|
:css => '.active .sidebar[data-tab="customer"]',
|
||||||
|
:value => 'nicole',
|
||||||
|
)
|
||||||
|
|
||||||
|
# check task title
|
||||||
|
verify_task(
|
||||||
|
:data => {
|
||||||
|
:title => 'some subject 4 - 123äöü',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
# check page title
|
||||||
|
verify_title(
|
||||||
|
:value => 'some subject 4 - 123äöü',
|
||||||
|
)
|
||||||
|
|
||||||
# reload instances, verify autosave
|
# reload instances, verify autosave
|
||||||
{
|
reload()
|
||||||
:execute => 'reload',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
:execute => 'wait',
|
|
||||||
:value => 4,
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
# check if customer is still shown in sidebar
|
||||||
:execute => 'click',
|
watch_for(
|
||||||
:css => '.content.active button.submit',
|
:css => '.active .sidebar[data-tab="customer"]',
|
||||||
},
|
:value => 'nicole',
|
||||||
{
|
)
|
||||||
:execute => 'wait',
|
|
||||||
:value => 5,
|
# finally create ticket
|
||||||
},
|
click( :css => '.content.active button.submit' )
|
||||||
{
|
sleep 5
|
||||||
:execute => 'check',
|
|
||||||
:element => :url,
|
location_check(
|
||||||
:result => '#ticket/zoom/',
|
:url => '#ticket/zoom/',
|
||||||
},
|
)
|
||||||
|
|
||||||
# check ticket
|
# check ticket
|
||||||
{
|
match(
|
||||||
:execute => 'match',
|
|
||||||
:css => '.active div.ticket-article',
|
:css => '.active div.ticket-article',
|
||||||
:value => 'some body 4 - 123äöü',
|
:value => 'some body 4 - 123äöü',
|
||||||
:match_result => true,
|
)
|
||||||
},
|
|
||||||
|
|
||||||
# close task/cleanup
|
ticket_id = nil
|
||||||
{
|
if @browser.current_url =~ /ticket\/zoom\/(.+?)$/i
|
||||||
:execute => 'close_all_tasks',
|
ticket_id = $1
|
||||||
},
|
end
|
||||||
],
|
|
||||||
},
|
# check task title
|
||||||
]
|
verify_task(
|
||||||
browser_signle_test_with_login(tests, { :username => 'agent1@example.com' })
|
:data => {
|
||||||
|
:title => 'some subject 4 - 123äöü',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
# check page title
|
||||||
|
verify_title(
|
||||||
|
:value => 'some subject 4 - 123äöü',
|
||||||
|
)
|
||||||
|
|
||||||
|
# check if task is not marked as modified
|
||||||
|
exists(
|
||||||
|
:css => ".tasks a[href=\"#ticket/zoom/#{ticket_id}\"]",
|
||||||
|
)
|
||||||
|
exists_not(
|
||||||
|
:css => ".tasks a[href=\"#ticket/zoom/#{ticket_id}\"] .modified",
|
||||||
|
)
|
||||||
|
|
||||||
|
# reload
|
||||||
|
reload()
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
# check task title
|
||||||
|
verify_task(
|
||||||
|
:data => {
|
||||||
|
:title => 'some subject 4 - 123äöü',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
# check page title
|
||||||
|
verify_title(
|
||||||
|
:value => 'some subject 4 - 123äöü',
|
||||||
|
)
|
||||||
|
|
||||||
|
# go to dashboard
|
||||||
|
location(
|
||||||
|
:url => browser_url
|
||||||
|
)
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
# check page title
|
||||||
|
verify_title(
|
||||||
|
:value => 'Dashboard',
|
||||||
|
)
|
||||||
|
|
||||||
|
# reload
|
||||||
|
reload()
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
# check page title
|
||||||
|
verify_title(
|
||||||
|
:value => 'Dashboard',
|
||||||
|
)
|
||||||
|
|
||||||
|
# cleanup
|
||||||
|
tasks_close_all()
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -274,7 +274,8 @@ class TestCase < Test::Unit::TestCase
|
||||||
if params[:contenteditable]
|
if params[:contenteditable]
|
||||||
value = instance.find_elements( { :css => params[:css] } )[0].text
|
value = instance.find_elements( { :css => params[:css] } )[0].text
|
||||||
if value != params[:value]
|
if value != params[:value]
|
||||||
instance.execute_script( "$('#{params[:css]}').focus().html('#{params[:value]}').trigger('focusout')" )
|
body_quoted = quote( params[:value] )
|
||||||
|
instance.execute_script( "$('#{params[:css]}').focus().html('#{body_quoted}').trigger('focusout')" )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -863,7 +864,8 @@ wait untill text in selector disabppears
|
||||||
value = instance.find_elements( { :css => '.content .newTicket div[data-name=body]' } )[0].text
|
value = instance.find_elements( { :css => '.content .newTicket div[data-name=body]' } )[0].text
|
||||||
puts "V #{value.inspect}"
|
puts "V #{value.inspect}"
|
||||||
if value != data[:body]
|
if value != data[:body]
|
||||||
instance.execute_script( "$('.content.active div[data-name=body]').html('#{data[:body]}').trigger('focusout')" )
|
body_quoted = quote( data[:body] )
|
||||||
|
instance.execute_script( "$('.content.active div[data-name=body]').html('#{body_quoted}').trigger('focusout')" )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if data[:customer]
|
if data[:customer]
|
||||||
|
@ -982,7 +984,8 @@ wait untill text in selector disabppears
|
||||||
value = instance.find_elements( { :css => '.content.active div[data-name=body]' } )[0].text
|
value = instance.find_elements( { :css => '.content.active div[data-name=body]' } )[0].text
|
||||||
puts "V #{value.inspect}"
|
puts "V #{value.inspect}"
|
||||||
if value != data[:body]
|
if value != data[:body]
|
||||||
instance.execute_script( "$('.content.active div[data-name=body]').html('#{data[:body]}').trigger('focusout')" )
|
body_quoted = quote( data[:body] )
|
||||||
|
instance.execute_script( "$('.content.active div[data-name=body]').html('#{body_quoted}').trigger('focusout')" )
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -1391,6 +1394,14 @@ wait untill text in selector disabppears
|
||||||
raise "text module creation failed"
|
raise "text module creation failed"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def quote(string)
|
||||||
|
string_quoted = string
|
||||||
|
string_quoted.gsub!(/&/, '&')
|
||||||
|
string_quoted.gsub!(/</, '<')
|
||||||
|
string_quoted.gsub!(/>/, '>')
|
||||||
|
string_quoted
|
||||||
|
end
|
||||||
|
|
||||||
# Add more helper methods to be used by all tests here...
|
# Add more helper methods to be used by all tests here...
|
||||||
def browser_login(data)
|
def browser_login(data)
|
||||||
all_tests = [
|
all_tests = [
|
||||||
|
|
Loading…
Reference in a new issue