diff --git a/app/assets/javascripts/app/controllers/dashboard.js.coffee b/app/assets/javascripts/app/controllers/dashboard.js.coffee index 3d028da8a..8ab077c65 100644 --- a/app/assets/javascripts/app/controllers/dashboard.js.coffee +++ b/app/assets/javascripts/app/controllers/dashboard.js.coffee @@ -1,4 +1,4 @@ -class Index extends App.ControllerContent +class App.Dashboard extends App.Controller constructor: -> super @@ -10,10 +10,6 @@ class Index extends App.ControllerContent @navigate '#' return - # set title - @title 'Dashboard' - @navupdate '#dashboard' - @plugins = { main: { my_assigned: { @@ -132,6 +128,46 @@ class Index extends App.ControllerContent ctx.closePath() 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', 'Dashboard', 'permanentTask' ) diff --git a/test/browser/agent_ticket_actions_level4_test.rb b/test/browser/agent_ticket_actions_level4_test.rb index ce88b59ef..4220e5c1d 100644 --- a/test/browser/agent_ticket_actions_level4_test.rb +++ b/test/browser/agent_ticket_actions_level4_test.rb @@ -3,65 +3,130 @@ require 'browser_test_helper' class AgentTicketActionLevel4Test < TestCase def test_agent_ticket_create_with_reload - tests = [ - { - :name => 'agent ticket create with reload', - :action => [ - { - :execute => 'close_all_tasks', - }, - # create ticket - { - :execute => 'create_ticket', - :group => 'Users', - :subject => 'some subject 4 - 123äöü', - :body => 'some body 4 - 123äöü', - :do_not_submit => true, - }, - { - :execute => 'wait', - :value => 10, - }, + @browser = browser_instance + login( + :username => 'agent1@example.com', + :password => 'test', + :url => browser_url, + ) + tasks_close_all() - # reload instances, verify autosave - { - :execute => 'reload', - }, - { - :execute => 'wait', - :value => 4, - }, - - { - :execute => 'click', - :css => '.content.active button.submit', - }, - { - :execute => 'wait', - :value => 5, - }, - { - :execute => 'check', - :element => :url, - :result => '#ticket/zoom/', - }, - - # check ticket - { - :execute => 'match', - :css => '.active div.ticket-article', - :value => 'some body 4 - 123äöü', - :match_result => true, - }, - - # close task/cleanup - { - :execute => 'close_all_tasks', - }, - ], + # create ticket + ticket_create( + :data => { + :customer => 'nicole', + :group => 'Users', + :title => 'some subject 4 - 123äöü', + :body => 'some body 4 - 123äöü', }, - ] - browser_signle_test_with_login(tests, { :username => 'agent1@example.com' }) + :do_not_submit => true, + ) + sleep 8 + + # 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() + + # check if customer is still shown in sidebar + watch_for( + :css => '.active .sidebar[data-tab="customer"]', + :value => 'nicole', + ) + + # finally create ticket + click( :css => '.content.active button.submit' ) + sleep 5 + + location_check( + :url => '#ticket/zoom/', + ) + + # check ticket + match( + :css => '.active div.ticket-article', + :value => 'some body 4 - 123äöü', + ) + + ticket_id = nil + if @browser.current_url =~ /ticket\/zoom\/(.+?)$/i + ticket_id = $1 + end + + # check task title + verify_task( + :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 \ No newline at end of file diff --git a/test/browser_test_helper.rb b/test/browser_test_helper.rb index f1366a258..49cd306f3 100644 --- a/test/browser_test_helper.rb +++ b/test/browser_test_helper.rb @@ -274,7 +274,8 @@ class TestCase < Test::Unit::TestCase if params[:contenteditable] value = instance.find_elements( { :css => params[:css] } )[0].text 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 @@ -863,7 +864,8 @@ wait untill text in selector disabppears value = instance.find_elements( { :css => '.content .newTicket div[data-name=body]' } )[0].text puts "V #{value.inspect}" 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 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 puts "V #{value.inspect}" 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 @@ -1391,6 +1394,14 @@ wait untill text in selector disabppears raise "text module creation failed" end + def quote(string) + string_quoted = string + string_quoted.gsub!(/&/, '&') + string_quoted.gsub!(//, '>') + string_quoted + end + # Add more helper methods to be used by all tests here... def browser_login(data) all_tests = [