Improved speed of tests.

This commit is contained in:
Martin Edenhofer 2015-02-22 23:51:44 +01:00
parent f52c1b9862
commit 7f3dcc5fa8
2 changed files with 97 additions and 16 deletions

View file

@ -77,7 +77,80 @@ class AgentTicketOverviewLevel1Test < TestCase
) )
# use overview navigation to got to #2 & #3 # use overview navigation to got to #2 & #3
match(
:browser => browser2,
:css => '.active .ticketZoom .overview-navigator .pagination-counter',
:value => '1/3',
)
match(
:browser => browser2,
:css => '.active .page-header .ticket-number',
:value => ticket1[:number],
)
click(
:browser => browser2,
:css => '.ticketZoom .overview-navigator .next',
)
match(
:browser => browser2,
:css => '.active .ticketZoom .overview-navigator .pagination-counter',
:value => '2/3',
)
match(
:browser => browser2,
:css => '.active .page-header .ticket-number',
:value => ticket2[:number],
)
click(
:browser => browser2,
:css => '.ticketZoom .overview-navigator .next',
)
match(
:browser => browser2,
:css => '.active .ticketZoom .overview-navigator .pagination-counter',
:value => '3/3',
)
match(
:browser => browser2,
:css => '.active .page-header .ticket-number',
:value => ticket3[:number],
)
# close ticket
ticket_update(
:browser => browser2,
:data => {
:state => 'closed',
}
)
sleep 8
match(
:browser => browser2,
:css => '.active .ticketZoom .overview-navigator .pagination-counter',
:value => '3/3',
)
match(
:browser => browser2,
:css => '.active .page-header .ticket-number',
:value => ticket3[:number],
)
click(
:browser => browser2,
:css => '.ticketZoom .overview-navigator .previous',
)
match(
:browser => browser2,
:css => '.active .ticketZoom .overview-navigator .pagination-counter',
:value => '2/2',
)
match(
:browser => browser2,
:css => '.active .page-header .ticket-number',
:value => ticket2[:number],
)
end end
end end

View file

@ -495,23 +495,27 @@ class TestCase < Test::Unit::TestCase
for i in 1..100 for i in 1..100
sleep 1 sleep 1
if instance.find_elements( { :css => '.navigation .tasks .task:first-child' } )[0] begin
instance.mouse.move_to( instance.find_elements( { :css => '.navigation .tasks .task:first-child' } )[0] ) if instance.find_elements( { :css => '.navigation .tasks .task:first-child' } )[0]
sleep 0.2 instance.mouse.move_to( instance.find_elements( { :css => '.navigation .tasks .task:first-child' } )[0] )
sleep 0.2
click_element = instance.find_elements( { :css => '.navigation .tasks .task:first-child .js-close' } )[0] click_element = instance.find_elements( { :css => '.navigation .tasks .task:first-child .js-close' } )[0]
if click_element if click_element
sleep 0.1 sleep 0.1
click_element.click click_element.click
# accept task close warning # accept task close warning
if params[:discard_changes] if params[:discard_changes]
sleep 1 sleep 1
instance.find_elements( { :css => '.modal button.js-submit' } )[0].click instance.find_elements( { :css => '.modal button.js-submit' } )[0].click
end
end end
else
break
end end
else rescue
break # just try again
end end
end end
assert( true, "all tasks closed" ) assert( true, "all tasks closed" )
@ -712,9 +716,13 @@ class TestCase < Test::Unit::TestCase
found = nil found = nil
(1..5).each {|loop| (1..5).each {|loop|
if !found if !found
text = instance.find_elements( { :css => '.content.active .js-reset' } )[0].text begin
if text =~ /(Discard your unsaved changes.|Verwerfen der)/ text = instance.find_elements( { :css => '.content.active .js-reset' } )[0].text
found = true if text =~ /(Discard your unsaved changes.|Verwerfen der)/
found = true
end
rescue
# just try again
end end
sleep 1 sleep 1
end end