From 31613b09d2f3bd3dc961530d0617f2a246072e5c Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Thu, 5 Nov 2015 13:34:22 +0100 Subject: [PATCH] Fixed browser tests. --- .../agent_ticket_overview_level0_test.rb | 6 ++++ .../agent_ticket_overview_level1_test.rb | 3 +- test/browser_test_helper.rb | 31 +++++++++++++++++++ 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/test/browser/agent_ticket_overview_level0_test.rb b/test/browser/agent_ticket_overview_level0_test.rb index 60000660d..d9c333148 100644 --- a/test/browser/agent_ticket_overview_level0_test.rb +++ b/test/browser/agent_ticket_overview_level0_test.rb @@ -32,6 +32,12 @@ class AgentTicketOverviewLevel0Test < TestCase ) sleep 6 # till overview is updated click( text: 'Overviews' ) + + # enable full overviews + execute( + js: '$(".content.active .sidebar").css("display", "block")', + ) + click( text: 'Unassigned & Open Tickets' ) sleep 4 # till overview is rendered diff --git a/test/browser/agent_ticket_overview_level1_test.rb b/test/browser/agent_ticket_overview_level1_test.rb index e6c31d4bb..82560cda9 100644 --- a/test/browser/agent_ticket_overview_level1_test.rb +++ b/test/browser/agent_ticket_overview_level1_test.rb @@ -193,10 +193,9 @@ class AgentTicketOverviewLevel1Test < TestCase ) sleep 8 - match( + exists_not( browser: browser2, css: '.active .ticketZoom .ticketZoom-controls .overview-navigator .pagination-counter .pagination-item-current', - value: '2', ) match( browser: browser2, diff --git a/test/browser_test_helper.rb b/test/browser_test_helper.rb index 31768a43f..4debb6542 100644 --- a/test/browser_test_helper.rb +++ b/test/browser_test_helper.rb @@ -266,6 +266,26 @@ class TestCase < Test::Unit::TestCase sleep 0.4 if !params[:fast] 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 exists( @@ -1372,6 +1392,10 @@ wait untill text in selector disabppears instance.find_elements( { css: '.js-overviewsMenuItem' } )[0].click 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 sleep 1 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 sleep 2 + + execute( + browser: instance, + js: '$(".content.active .sidebar").css("display", "block")', + ) + overviews = {} instance.find_elements( { css: '.content.active .sidebar a[href]' } ).each {|element| 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 overviews[url] = count.to_i } + log('overview_counter', overviews) overviews end