Fixed browser tests.

This commit is contained in:
Martin Edenhofer 2015-11-05 13:34:22 +01:00
parent d4dfab1c9a
commit 31613b09d2
3 changed files with 38 additions and 2 deletions

View file

@ -32,6 +32,12 @@ class AgentTicketOverviewLevel0Test < TestCase
) )
sleep 6 # till overview is updated sleep 6 # till overview is updated
click( text: 'Overviews' ) click( text: 'Overviews' )
# enable full overviews
execute(
js: '$(".content.active .sidebar").css("display", "block")',
)
click( text: 'Unassigned & Open Tickets' ) click( text: 'Unassigned & Open Tickets' )
sleep 4 # till overview is rendered sleep 4 # till overview is rendered

View file

@ -193,10 +193,9 @@ class AgentTicketOverviewLevel1Test < TestCase
) )
sleep 8 sleep 8
match( exists_not(
browser: browser2, browser: browser2,
css: '.active .ticketZoom .ticketZoom-controls .overview-navigator .pagination-counter .pagination-item-current', css: '.active .ticketZoom .ticketZoom-controls .overview-navigator .pagination-counter .pagination-item-current',
value: '2',
) )
match( match(
browser: browser2, browser: browser2,

View file

@ -266,6 +266,26 @@ class TestCase < Test::Unit::TestCase
sleep 0.4 if !params[:fast] sleep 0.4 if !params[:fast]
end end
=begin
execute(
:browser => browser1,
:js => '.some_class',
)
=end
def execute(params)
log('js', params)
instance = params[:browser] || @browser
if params[:js]
instance.execute_script(params[:js])
return
end
fail "Invalid execute params #{params.inspect}"
end
=begin =begin
exists( exists(
@ -1372,6 +1392,10 @@ wait untill text in selector disabppears
instance.find_elements( { css: '.js-overviewsMenuItem' } )[0].click instance.find_elements( { css: '.js-overviewsMenuItem' } )[0].click
sleep 1 sleep 1
execute(
browser: instance,
js: '$(".content.active .sidebar").css("display", "block")',
)
instance.find_elements( { css: ".content.active .sidebar a[href=\"#{params[:link]}\"]" } )[0].click instance.find_elements( { css: ".content.active .sidebar a[href=\"#{params[:link]}\"]" } )[0].click
sleep 1 sleep 1
instance.find_elements( { partial_link_text: params[:number] } )[0].click instance.find_elements( { partial_link_text: params[:number] } )[0].click
@ -1454,6 +1478,12 @@ wait untill text in selector disabppears
instance.find_elements( { css: '.js-overviewsMenuItem' } )[0].click instance.find_elements( { css: '.js-overviewsMenuItem' } )[0].click
sleep 2 sleep 2
execute(
browser: instance,
js: '$(".content.active .sidebar").css("display", "block")',
)
overviews = {} overviews = {}
instance.find_elements( { css: '.content.active .sidebar a[href]' } ).each {|element| instance.find_elements( { css: '.content.active .sidebar a[href]' } ).each {|element|
url = element.attribute('href') url = element.attribute('href')
@ -1466,6 +1496,7 @@ wait untill text in selector disabppears
count = instance.find_elements( { css: ".content.active .sidebar a[href=\"#{url}\"] .badge" } )[0].text count = instance.find_elements( { css: ".content.active .sidebar a[href=\"#{url}\"] .badge" } )[0].text
overviews[url] = count.to_i overviews[url] = count.to_i
} }
log('overview_counter', overviews)
overviews overviews
end end