Improved timing.

This commit is contained in:
Martin Edenhofer 2016-03-22 13:58:48 +01:00
parent fe9174da9c
commit 5907f51808
2 changed files with 26 additions and 28 deletions

View file

@ -11,8 +11,8 @@ class CustomerTicketCreateTest < TestCase
) )
# customer ticket create # customer ticket create
click( css: 'a[href="#new"]' ) click(css: 'a[href="#new"]')
click( css: 'a[href="#customer_ticket_new"]' ) click(css: 'a[href="#customer_ticket_new"]')
sleep 2 sleep 2
select( select(
@ -28,11 +28,11 @@ class CustomerTicketCreateTest < TestCase
css: '.newTicket [data-name="body"]', css: '.newTicket [data-name="body"]',
value: 'some body 123äöü', value: 'some body 123äöü',
) )
click( css: '.newTicket button.js-submit' ) click(css: '.newTicket button.js-submit')
sleep 5 sleep 5
# check if ticket is shown # check if ticket is shown
location_check( url: '#ticket/zoom/' ) location_check(url: '#ticket/zoom/')
match( match(
css: '.active div.ticket-article', css: '.active div.ticket-article',
@ -51,7 +51,7 @@ class CustomerTicketCreateTest < TestCase
type: 'stayOnTab', type: 'stayOnTab',
) )
click( css: '.active .js-submit' ) click(css: '.active .js-submit')
watch_for( watch_for(
css: '.active div.ticket-article', css: '.active div.ticket-article',

View file

@ -366,7 +366,6 @@ class TestCase < Test::Unit::TestCase
#if element #if element
# instance.mouse.move_to(element) # instance.mouse.move_to(element)
#end #end
sleep 0.2
element.click element.click
rescue => e rescue => e
sleep 0.5 sleep 0.5
@ -377,15 +376,14 @@ class TestCase < Test::Unit::TestCase
#if element #if element
# instance.mouse.move_to(element) # instance.mouse.move_to(element)
#end #end
sleep 0.2
element.click element.click
end end
else else
sleep 1 sleep 0.5
instance.find_elements(partial_link_text: params[:text])[0].click instance.find_elements(partial_link_text: params[:text])[0].click
end end
sleep 0.4 if !params[:fast] sleep 0.2 if !params[:fast]
sleep params[:wait] if params[:wait] sleep params[:wait] if params[:wait]
end end
@ -520,7 +518,7 @@ class TestCase < Test::Unit::TestCase
instance.execute_script("$('#{params[:css]}').blur()") instance.execute_script("$('#{params[:css]}').blur()")
end end
sleep 0.5 sleep 0.2
end end
=begin =begin
@ -546,11 +544,11 @@ class TestCase < Test::Unit::TestCase
element = instance.find_elements(css: "#{params[:css]}.js-shadow + .js-input")[0] element = instance.find_elements(css: "#{params[:css]}.js-shadow + .js-input")[0]
element.click element.click
element.clear element.clear
sleep 1 sleep 0.5
element.send_keys(params[:value]) element.send_keys(params[:value])
sleep 0.5 sleep 0.2
element.send_keys(:enter) element.send_keys(:enter)
sleep 0.5 sleep 0.2
return return
end end
@ -576,7 +574,7 @@ class TestCase < Test::Unit::TestCase
dropdown.select_by(:text, params[:value]) dropdown.select_by(:text, params[:value])
#puts "select2 - #{params.inspect}" #puts "select2 - #{params.inspect}"
end end
sleep 0.8 sleep 0.5
end end
=begin =begin
@ -671,9 +669,9 @@ class TestCase < Test::Unit::TestCase
end end
instance.action.send_keys(params[:value]).perform instance.action.send_keys(params[:value]).perform
if params[:slow] if params[:slow]
sleep 2 sleep 1.5
else else
sleep 0.3 sleep 0.2
end end
end end
@ -760,7 +758,7 @@ class TestCase < Test::Unit::TestCase
elsif !params[:should_not_match] elsif !params[:should_not_match]
raise "not matching '#{params[:value]}' in content '#{text}' but should!" raise "not matching '#{params[:value]}' in content '#{text}' but should!"
end end
sleep 0.8 sleep 0.2
match match
end end
@ -1218,7 +1216,7 @@ wait untill text in selector disabppears
# accept task close warning # accept task close warning
if instance.find_elements(css: '.modal button.js-submit')[0] if instance.find_elements(css: '.modal button.js-submit')[0]
sleep 0.5 sleep 0.4
instance.find_elements(css: '.modal button.js-submit')[0].click instance.find_elements(css: '.modal button.js-submit')[0].click
end end
end end
@ -1287,16 +1285,16 @@ wait untill text in selector disabppears
# workaround, sometimes focus is not triggered # workaround, sometimes focus is not triggered
element.send_keys(params[:customer]) element.send_keys(params[:customer])
sleep 3.5 sleep 2.5
# check if pulldown is open, it's not working stable via selenium # check if pulldown is open, it's not working stable via selenium
#instance.execute_script("$('#{params[:css]} .js-recipientDropdown').addClass('open')") #instance.execute_script("$('#{params[:css]} .js-recipientDropdown').addClass('open')")
#sleep 0.5 #sleep 0.5
element.send_keys(:arrow_down) element.send_keys(:arrow_down)
sleep 0.3 sleep 0.2
element.send_keys(:enter) element.send_keys(:enter)
#instance.find_elements(css: params[:css] + ' .recipientList-entry.js-user.is-active')[0].click #instance.find_elements(css: params[:css] + ' .recipientList-entry.js-user.is-active')[0].click
sleep 0.6 sleep 0.4
assert(true, 'ticket_customer_select') assert(true, 'ticket_customer_select')
end end
@ -1548,7 +1546,7 @@ wait untill text in selector disabppears
screenshot(browser: instance, comment: 'ticket_create_failed') screenshot(browser: instance, comment: 'ticket_create_failed')
raise 'no ticket create screen found!' raise 'no ticket create screen found!'
end end
sleep 1 sleep 0.4
if data[:group] if data[:group]
if data[:group] == '-NONE-' if data[:group] == '-NONE-'
@ -1616,16 +1614,16 @@ wait untill text in selector disabppears
# workaround, sometimes focus is not triggered # workaround, sometimes focus is not triggered
element.send_keys(data[:customer]) element.send_keys(data[:customer])
sleep 3.5 sleep 2.5
# check if pulldown is open, it's not working stable via selenium # check if pulldown is open, it's not working stable via selenium
#instance.execute_script("$('.active .newTicket .js-recipientDropdown').addClass('open')") #instance.execute_script("$('.active .newTicket .js-recipientDropdown').addClass('open')")
#sleep 0.5 #sleep 0.5
element.send_keys(:arrow_down) element.send_keys(:arrow_down)
sleep 0.3 sleep 0.2
element.send_keys(:enter) element.send_keys(:enter)
#instance.find_elements(css: '.active .newTicket .recipientList-entry.js-user.is-active')[0].click #instance.find_elements(css: '.active .newTicket .recipientList-entry.js-user.is-active')[0].click
sleep 0.6 sleep 0.4
end end
if data[:attachment] if data[:attachment]
@ -1745,16 +1743,16 @@ wait untill text in selector disabppears
# workaround, sometimes focus is not triggered # workaround, sometimes focus is not triggered
element.send_keys(data[:customer]) element.send_keys(data[:customer])
sleep 3.5 sleep 2.5
# check if pulldown is open, it's not working stable via selenium # check if pulldown is open, it's not working stable via selenium
#instance.execute_script("$('.modal .user_autocompletion .js-recipientDropdown').addClass('open')") #instance.execute_script("$('.modal .user_autocompletion .js-recipientDropdown').addClass('open')")
#sleep 0.5 #sleep 0.5
element.send_keys(:arrow_down) element.send_keys(:arrow_down)
sleep 0.6 sleep 0.4
element.send_keys(:enter) element.send_keys(:enter)
#instance.find_elements(css: '.modal .user_autocompletion .recipientList-entry.js-user.is-active')[0].click #instance.find_elements(css: '.modal .user_autocompletion .recipientList-entry.js-user.is-active')[0].click
sleep 0.3 sleep 0.2
click(browser: instance, css: '.modal .js-submit') click(browser: instance, css: '.modal .js-submit')