diff --git a/app/assets/javascripts/app/controllers/ticket_zoom.coffee b/app/assets/javascripts/app/controllers/ticket_zoom.coffee index 505dca99f..f9e9681a2 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom.coffee @@ -660,8 +660,6 @@ class App.TicketZoom extends App.Controller @formEnable(e) return - taskAction = @$('.js-secondaryActionButtonLabel').data('type') - ticketParams = @formParam(@$('.edit')) # validate ticket @@ -780,6 +778,8 @@ class App.TicketZoom extends App.Controller submitPost: (e, ticket) => + taskAction = @$('.js-secondaryActionButtonLabel').data('type') + # submit changes @ajax( id: "ticket_update_#{ticket.id}" diff --git a/script/build/test_slice_tests.sh b/script/build/test_slice_tests.sh index 6d5c0e79d..1422ff8dc 100755 --- a/script/build/test_slice_tests.sh +++ b/script/build/test_slice_tests.sh @@ -28,6 +28,7 @@ if [ "$LEVEL" == '1' ]; then rm test/browser/agent_ticket_online_notification_test.rb rm test/browser/agent_ticket_overview_level0_test.rb rm test/browser/agent_ticket_overview_level1_test.rb + rm test/browser/agent_ticket_overview_tab_test.rb rm test/browser/agent_ticket_tag_test.rb rm test/browser/agent_ticket_text_module_test.rb rm test/browser/agent_ticket_update1_test.rb @@ -83,6 +84,7 @@ elif [ "$LEVEL" == '2' ]; then rm test/browser/agent_ticket_online_notification_test.rb rm test/browser/agent_ticket_overview_level0_test.rb rm test/browser/agent_ticket_overview_level1_test.rb + rm test/browser/agent_ticket_overview_tab_test.rb rm test/browser/agent_ticket_tag_test.rb # test/browser/agent_ticket_text_module_test.rb # test/browser/agent_ticket_update1_test.rb @@ -138,6 +140,7 @@ elif [ "$LEVEL" == '3' ]; then rm test/browser/agent_ticket_online_notification_test.rb rm test/browser/agent_ticket_overview_level0_test.rb rm test/browser/agent_ticket_overview_level1_test.rb + rm test/browser/agent_ticket_overview_tab_test.rb # test/browser/agent_ticket_tag_test.rb rm test/browser/agent_ticket_text_module_test.rb rm test/browser/agent_ticket_update1_test.rb @@ -193,6 +196,7 @@ elif [ "$LEVEL" == '4' ]; then # test/browser/agent_ticket_online_notification_test.rb # test/browser/agent_ticket_overview_level0_test.rb # test/browser/agent_ticket_overview_level1_test.rb + # test/browser/agent_ticket_overview_tab_test.rb rm test/browser/agent_ticket_tag_test.rb rm test/browser/agent_ticket_text_module_test.rb rm test/browser/agent_ticket_update1_test.rb @@ -247,6 +251,7 @@ elif [ "$LEVEL" == '5' ]; then rm test/browser/agent_ticket_online_notification_test.rb rm test/browser/agent_ticket_overview_level0_test.rb rm test/browser/agent_ticket_overview_level1_test.rb + rm test/browser/agent_ticket_overview_tab_test.rb rm test/browser/agent_ticket_tag_test.rb rm test/browser/agent_ticket_text_module_test.rb rm test/browser/agent_ticket_update1_test.rb @@ -304,6 +309,7 @@ elif [ "$LEVEL" == '6' ]; then rm test/browser/agent_ticket_online_notification_test.rb rm test/browser/agent_ticket_overview_level0_test.rb rm test/browser/agent_ticket_overview_level1_test.rb + rm test/browser/agent_ticket_overview_tab_test.rb rm test/browser/agent_ticket_tag_test.rb rm test/browser/agent_ticket_text_module_test.rb rm test/browser/agent_ticket_update1_test.rb diff --git a/test/browser/agent_ticket_overview_tab_test.rb b/test/browser/agent_ticket_overview_tab_test.rb new file mode 100644 index 000000000..80d495d26 --- /dev/null +++ b/test/browser/agent_ticket_overview_tab_test.rb @@ -0,0 +1,87 @@ +# encoding: utf-8 +require 'browser_test_helper' + +class AgentTicketOverviewTabTest < TestCase + def test_i + @browser = browser_instance + login( + username: 'master@example.com', + password: 'test', + url: browser_url, + ) + tasks_close_all() + + title = "test #{rand(9_999_999)}" + + # create new ticket + ticket1 = ticket_create( + data: { + customer: 'nico', + group: 'Users', + title: "overview tab test #1 - #{title}", + body: "overview tab test #1 - #{title}", + } + ) + ticket2 = ticket_create( + data: { + customer: 'nico', + group: 'Users', + title: "overview tab test #2 - #{title}", + body: "overview tab test #2 - #{title}", + } + ) + ticket3 = ticket_create( + data: { + customer: 'nico', + group: 'Users', + title: "overview tab test #3 - #{title}", + body: "overview tab test #3 - #{title}", + } + ) + tasks_close_all() + + #click(text: 'Overviews') + # enable full overviews + #execute( + # js: '$(".content.active .sidebar").css("display", "block")', + #) + #click(text: 'Unassigned & Open') + sleep 8 # till overview is rendered + + ticket_open_by_overview( + number: ticket1[:number], + title: "overview tab test #1 - #{title}", + link: '#ticket/view/all_unassigned', + ) + + assert_equal(1, @browser.find_elements(css: '.tasks .task').count) + + ticket_update( + data: { + body: 'some body', + state: 'closed', + }, + task_type: 'closeNextInOverview', # default: stayOnTab / possible: closeTab, closeNextInOverview, stayOnTab + ) + + match( + css: '.tasks .task.is-active', + value: "overview tab test #2 - #{title}", + ) + + assert_equal(1, @browser.find_elements(css: '.tasks .task').count) + + ticket_update( + data: { + body: 'some body', + state: 'closed', + }, + task_type: 'closeTab', # default: stayOnTab / possible: closeTab, closeNextInOverview, stayOnTab + ) + + assert_equal(0, @browser.find_elements(css: '.tasks .task').count) + + # cleanup + tasks_close_all() + end +end diff --git a/test/browser_test_helper.rb b/test/browser_test_helper.rb index 520937c2d..d9067fc9c 100644 --- a/test/browser_test_helper.rb +++ b/test/browser_test_helper.rb @@ -963,6 +963,8 @@ class TestCase < Test::Unit::TestCase =begin +set type of task (closeTab, closeNextInOverview, stayOnTab) + task_type( browser: browser1, type: 'stayOnTab', @@ -975,7 +977,6 @@ class TestCase < Test::Unit::TestCase log('task_type', params) instance = params[:browser] || @browser - if params[:type] instance.find_elements(css: '.content.active .js-secondaryActionButtonLabel')[0].click instance.find_elements(css: ".content.active .js-secondaryActionLabel[data-type=#{params[:type]}]")[0].click @@ -2032,6 +2033,7 @@ wait untill text in selector disabppears key1: 'some value', }, do_not_submit: true, + task_type: 'stayOnTab', # default: stayOnTab / possible: closeTab, closeNextInOverview, stayOnTab ) =end @@ -2203,14 +2205,13 @@ wait untill text in selector disabppears } if !found screenshot(browser: instance, comment: 'ticket_update_discard_message_failed') - raise 'no discard message found' end end task_type( browser: instance, - type: 'stayOnTab', + type: params[:task_type] || 'stayOnTab', ) if params[:do_not_submit] @@ -2220,6 +2221,13 @@ wait untill text in selector disabppears instance.find_elements(css: '.content.active .js-submit')[0].click + # do not stay on tab + if params[:task_type] == 'closeTab' || params[:task_type] == 'closeNextInOverview' + sleep 1 + screenshot(browser: instance, comment: 'ticket_update') + return + end + 9.times { begin text = instance.find_elements(css: '.content.active .js-reset')[0].text @@ -2316,6 +2324,13 @@ wait untill text in selector disabppears link: "#ticket/view/#{name}", ) + ticket_open_by_overview( + browser: browser2, + number: ticket1[:number], + text: title, + link: "#ticket/view/#{name}", + ) + =end def ticket_open_by_overview(params) @@ -2338,12 +2353,25 @@ wait untill text in selector disabppears js: '$(".content.active .sidebar").css("display", "none")', ) screenshot(browser: instance, comment: 'ticket_open_by_overview_search') - instance.find_elements(partial_link_text: params[:number])[0].click + if params[:title] + element = instance.find_elements(partial_link_text: params[:title])[0] + if !element + screenshot(browser: instance, comment: 'ticket_open_by_overview_no_ticket_failed') + raise "unable to find ticket #{params[:title]} in overview #{params[:link]}!" + end + else + element = instance.find_elements(partial_link_text: params[:number])[0] + if !element + screenshot(browser: instance, comment: 'ticket_open_by_overview_no_ticket_failed') + raise "unable to find ticket #{params[:number]} in overview #{params[:link]}!" + end + end + element.click sleep 1 number = instance.find_elements(css: '.content.active .ticketZoom-header .ticket-number')[0].text if number !~ /#{params[:number]}/ - screenshot(browser: instance, comment: 'ticket_open_by_overview_failed') - raise "unable to search/find ticket #{params[:number]}!" + screenshot(browser: instance, comment: 'ticket_open_by_overview_open_failed_failed') + raise "unable to open ticket #{params[:number]}!" end sleep 1 assert(true, "ticket #{params[:number]} found")