Fixed issue #730 - "Close Tab" & "Next in Overview" don't work.

This commit is contained in:
Martin Edenhofer 2017-02-05 19:24:48 +01:00
parent c944c9999a
commit 7e947dc4bf
4 changed files with 129 additions and 8 deletions

View file

@ -660,8 +660,6 @@ class App.TicketZoom extends App.Controller
@formEnable(e) @formEnable(e)
return return
taskAction = @$('.js-secondaryActionButtonLabel').data('type')
ticketParams = @formParam(@$('.edit')) ticketParams = @formParam(@$('.edit'))
# validate ticket # validate ticket
@ -780,6 +778,8 @@ class App.TicketZoom extends App.Controller
submitPost: (e, ticket) => submitPost: (e, ticket) =>
taskAction = @$('.js-secondaryActionButtonLabel').data('type')
# submit changes # submit changes
@ajax( @ajax(
id: "ticket_update_#{ticket.id}" id: "ticket_update_#{ticket.id}"

View file

@ -28,6 +28,7 @@ if [ "$LEVEL" == '1' ]; then
rm test/browser/agent_ticket_online_notification_test.rb rm test/browser/agent_ticket_online_notification_test.rb
rm test/browser/agent_ticket_overview_level0_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_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_tag_test.rb
rm test/browser/agent_ticket_text_module_test.rb rm test/browser/agent_ticket_text_module_test.rb
rm test/browser/agent_ticket_update1_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_online_notification_test.rb
rm test/browser/agent_ticket_overview_level0_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_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_tag_test.rb
# test/browser/agent_ticket_text_module_test.rb # test/browser/agent_ticket_text_module_test.rb
# test/browser/agent_ticket_update1_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_online_notification_test.rb
rm test/browser/agent_ticket_overview_level0_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_level1_test.rb
rm test/browser/agent_ticket_overview_tab_test.rb
# test/browser/agent_ticket_tag_test.rb # test/browser/agent_ticket_tag_test.rb
rm test/browser/agent_ticket_text_module_test.rb rm test/browser/agent_ticket_text_module_test.rb
rm test/browser/agent_ticket_update1_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_online_notification_test.rb
# test/browser/agent_ticket_overview_level0_test.rb # test/browser/agent_ticket_overview_level0_test.rb
# test/browser/agent_ticket_overview_level1_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_tag_test.rb
rm test/browser/agent_ticket_text_module_test.rb rm test/browser/agent_ticket_text_module_test.rb
rm test/browser/agent_ticket_update1_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_online_notification_test.rb
rm test/browser/agent_ticket_overview_level0_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_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_tag_test.rb
rm test/browser/agent_ticket_text_module_test.rb rm test/browser/agent_ticket_text_module_test.rb
rm test/browser/agent_ticket_update1_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_online_notification_test.rb
rm test/browser/agent_ticket_overview_level0_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_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_tag_test.rb
rm test/browser/agent_ticket_text_module_test.rb rm test/browser/agent_ticket_text_module_test.rb
rm test/browser/agent_ticket_update1_test.rb rm test/browser/agent_ticket_update1_test.rb

View file

@ -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

View file

@ -963,6 +963,8 @@ class TestCase < Test::Unit::TestCase
=begin =begin
set type of task (closeTab, closeNextInOverview, stayOnTab)
task_type( task_type(
browser: browser1, browser: browser1,
type: 'stayOnTab', type: 'stayOnTab',
@ -975,7 +977,6 @@ class TestCase < Test::Unit::TestCase
log('task_type', params) log('task_type', params)
instance = params[:browser] || @browser instance = params[:browser] || @browser
if params[:type] if params[:type]
instance.find_elements(css: '.content.active .js-secondaryActionButtonLabel')[0].click instance.find_elements(css: '.content.active .js-secondaryActionButtonLabel')[0].click
instance.find_elements(css: ".content.active .js-secondaryActionLabel[data-type=#{params[:type]}]")[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', key1: 'some value',
}, },
do_not_submit: true, do_not_submit: true,
task_type: 'stayOnTab', # default: stayOnTab / possible: closeTab, closeNextInOverview, stayOnTab
) )
=end =end
@ -2203,14 +2205,13 @@ wait untill text in selector disabppears
} }
if !found if !found
screenshot(browser: instance, comment: 'ticket_update_discard_message_failed') screenshot(browser: instance, comment: 'ticket_update_discard_message_failed')
raise 'no discard message found' raise 'no discard message found'
end end
end end
task_type( task_type(
browser: instance, browser: instance,
type: 'stayOnTab', type: params[:task_type] || 'stayOnTab',
) )
if params[:do_not_submit] 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 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 { 9.times {
begin begin
text = instance.find_elements(css: '.content.active .js-reset')[0].text 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}", link: "#ticket/view/#{name}",
) )
ticket_open_by_overview(
browser: browser2,
number: ticket1[:number],
text: title,
link: "#ticket/view/#{name}",
)
=end =end
def ticket_open_by_overview(params) def ticket_open_by_overview(params)
@ -2338,12 +2353,25 @@ wait untill text in selector disabppears
js: '$(".content.active .sidebar").css("display", "none")', js: '$(".content.active .sidebar").css("display", "none")',
) )
screenshot(browser: instance, comment: 'ticket_open_by_overview_search') 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 sleep 1
number = instance.find_elements(css: '.content.active .ticketZoom-header .ticket-number')[0].text number = instance.find_elements(css: '.content.active .ticketZoom-header .ticket-number')[0].text
if number !~ /#{params[:number]}/ if number !~ /#{params[:number]}/
screenshot(browser: instance, comment: 'ticket_open_by_overview_failed') screenshot(browser: instance, comment: 'ticket_open_by_overview_open_failed_failed')
raise "unable to search/find ticket #{params[:number]}!" raise "unable to open ticket #{params[:number]}!"
end end
sleep 1 sleep 1
assert(true, "ticket #{params[:number]} found") assert(true, "ticket #{params[:number]} found")