Improved browser helper click() - scroll to element before click (needed for chrome behaves).
This commit is contained in:
parent
787553ea42
commit
5c085b128c
2 changed files with 62 additions and 26 deletions
|
@ -30,7 +30,6 @@ class AgentTicketOverviewLevel0Test < TestCase
|
||||||
body: 'overview count test #2',
|
body: 'overview count test #2',
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
sleep 6 # till overview is updated
|
|
||||||
click( text: 'Overviews' )
|
click( text: 'Overviews' )
|
||||||
|
|
||||||
# enable full overviews
|
# enable full overviews
|
||||||
|
@ -39,7 +38,7 @@ class AgentTicketOverviewLevel0Test < TestCase
|
||||||
)
|
)
|
||||||
|
|
||||||
click( text: 'Unassigned & Open' )
|
click( text: 'Unassigned & Open' )
|
||||||
sleep 4 # till overview is rendered
|
sleep 6 # till overview is rendered
|
||||||
|
|
||||||
# select both via bulk action
|
# select both via bulk action
|
||||||
click(
|
click(
|
||||||
|
@ -50,6 +49,7 @@ class AgentTicketOverviewLevel0Test < TestCase
|
||||||
css: '.active table tr td input[value="' + ticket2[:id] + '"] + .icon-checkbox.icon-unchecked',
|
css: '.active table tr td input[value="' + ticket2[:id] + '"] + .icon-checkbox.icon-unchecked',
|
||||||
fast: true,
|
fast: true,
|
||||||
)
|
)
|
||||||
|
|
||||||
exists(
|
exists(
|
||||||
css: '.active table tr td input[value="' + ticket1[:id] + '"][type="checkbox"]:checked',
|
css: '.active table tr td input[value="' + ticket1[:id] + '"][type="checkbox"]:checked',
|
||||||
)
|
)
|
||||||
|
@ -68,7 +68,7 @@ class AgentTicketOverviewLevel0Test < TestCase
|
||||||
click(
|
click(
|
||||||
css: '.active .bulkAction .js-submit',
|
css: '.active .bulkAction .js-submit',
|
||||||
)
|
)
|
||||||
sleep 6
|
sleep 4
|
||||||
|
|
||||||
exists_not(
|
exists_not(
|
||||||
css: '.active table tr td input[value="' + ticket1[:id] + '"]',
|
css: '.active table tr td input[value="' + ticket1[:id] + '"]',
|
||||||
|
@ -154,7 +154,7 @@ class AgentTicketOverviewLevel0Test < TestCase
|
||||||
css: '.modal input[value="article_count"]',
|
css: '.modal input[value="article_count"]',
|
||||||
)
|
)
|
||||||
click( css: '.modal .js-submit' )
|
click( css: '.modal .js-submit' )
|
||||||
sleep 4
|
sleep 2
|
||||||
|
|
||||||
# check if number and article count is gone
|
# check if number and article count is gone
|
||||||
match_not(
|
match_not(
|
||||||
|
@ -178,7 +178,7 @@ class AgentTicketOverviewLevel0Test < TestCase
|
||||||
body: 'overview count test #3',
|
body: 'overview count test #3',
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
sleep 8
|
sleep 6
|
||||||
|
|
||||||
# get new overview count
|
# get new overview count
|
||||||
overview_counter_new = overview_counter()
|
overview_counter_new = overview_counter()
|
||||||
|
@ -196,7 +196,7 @@ class AgentTicketOverviewLevel0Test < TestCase
|
||||||
state: 'closed',
|
state: 'closed',
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
sleep 8
|
sleep 6
|
||||||
|
|
||||||
# get current overview count
|
# get current overview count
|
||||||
overview_counter_after = overview_counter()
|
overview_counter_after = overview_counter()
|
||||||
|
|
|
@ -101,11 +101,11 @@ class TestCase < Test::Unit::TestCase
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
username = login(
|
username = login(
|
||||||
:browser => browser1,
|
browser: browser1,
|
||||||
:username => 'someuser',
|
username: 'someuser',
|
||||||
:password => 'somepassword',
|
password: 'somepassword',
|
||||||
:url => 'some url', # optional
|
url: 'some url', # optional
|
||||||
:remember_me => true, # optional
|
remember_me: true, # optional
|
||||||
)
|
)
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
@ -152,7 +152,7 @@ class TestCase < Test::Unit::TestCase
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
logout(
|
logout(
|
||||||
:browser => browser1
|
browser: browser1
|
||||||
)
|
)
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
@ -181,8 +181,8 @@ class TestCase < Test::Unit::TestCase
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
location(
|
location(
|
||||||
:browser => browser1,
|
browser: browser1,
|
||||||
:url => 'http://someurl',
|
url: 'http://someurl',
|
||||||
)
|
)
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
@ -198,8 +198,8 @@ class TestCase < Test::Unit::TestCase
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
location_check(
|
location_check(
|
||||||
:browser => browser1,
|
browser: browser1,
|
||||||
:url => 'http://someurl',
|
url: 'http://someurl',
|
||||||
)
|
)
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
@ -218,7 +218,7 @@ class TestCase < Test::Unit::TestCase
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
reload(
|
reload(
|
||||||
:browser => browser1,
|
browser: browser1,
|
||||||
)
|
)
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
@ -235,15 +235,15 @@ class TestCase < Test::Unit::TestCase
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
click(
|
click(
|
||||||
:browser => browser1,
|
browser: browser1,
|
||||||
:css => '.some_class',
|
css: '.some_class',
|
||||||
:fast => false, # do not wait
|
fast: false, # do not wait
|
||||||
)
|
)
|
||||||
|
|
||||||
click(
|
click(
|
||||||
:browser => browser1,
|
browser: browser1,
|
||||||
:text => '.partial_link_text',
|
text: '.partial_link_text',
|
||||||
:fast => false, # do not wait
|
fast: false, # do not wait
|
||||||
)
|
)
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
@ -253,7 +253,16 @@ class TestCase < Test::Unit::TestCase
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
if params[:css]
|
if params[:css]
|
||||||
instance.find_elements( { css: params[:css] } )[0].click
|
|
||||||
|
scroll_to(
|
||||||
|
browser: instance,
|
||||||
|
css: params[:css],
|
||||||
|
mute_log: true,
|
||||||
|
)
|
||||||
|
|
||||||
|
element = instance.find_elements( { css: params[:css] } )[0]
|
||||||
|
instance.mouse.move_to(element)
|
||||||
|
element.click
|
||||||
|
|
||||||
# trigger also focus on input/select and textarea fields
|
# trigger also focus on input/select and textarea fields
|
||||||
#if params[:css] =~ /(input|select|textarea)/
|
#if params[:css] =~ /(input|select|textarea)/
|
||||||
|
@ -268,9 +277,31 @@ class TestCase < Test::Unit::TestCase
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
|
scroll_to(
|
||||||
|
browser: browser1,
|
||||||
|
css: '.some_class',
|
||||||
|
)
|
||||||
|
|
||||||
|
=end
|
||||||
|
|
||||||
|
def scroll_to(params)
|
||||||
|
log('scroll_to', params)
|
||||||
|
|
||||||
|
instance = params[:browser] || @browser
|
||||||
|
|
||||||
execute(
|
execute(
|
||||||
:browser => browser1,
|
browser: instance,
|
||||||
:js => '.some_class',
|
js: "\$('#{params[:css]}').get(0).scrollIntoView(true)",
|
||||||
|
mute_log: params[:mute_log]
|
||||||
|
)
|
||||||
|
sleep 0.4
|
||||||
|
end
|
||||||
|
|
||||||
|
=begin
|
||||||
|
|
||||||
|
execute(
|
||||||
|
browser: browser1,
|
||||||
|
js: '.some_class',
|
||||||
)
|
)
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
@ -1521,6 +1552,10 @@ wait untill text in selector disabppears
|
||||||
browser: instance,
|
browser: instance,
|
||||||
js: '$(".content.active .sidebar").css("display", "block")',
|
js: '$(".content.active .sidebar").css("display", "block")',
|
||||||
)
|
)
|
||||||
|
#execute(
|
||||||
|
# browser: instance,
|
||||||
|
# js: '$(".content.active .overview-header").css("display", "none")',
|
||||||
|
#)
|
||||||
|
|
||||||
overviews = {}
|
overviews = {}
|
||||||
instance.find_elements( { css: '.content.active .sidebar a[href]' } ).each {|element|
|
instance.find_elements( { css: '.content.active .sidebar a[href]' } ).each {|element|
|
||||||
|
@ -1892,6 +1927,7 @@ wait untill text in selector disabppears
|
||||||
|
|
||||||
def log(method, params)
|
def log(method, params)
|
||||||
return if !@@debug
|
return if !@@debug
|
||||||
|
return if params[:mute_log]
|
||||||
puts "#{Time.zone.now}/#{method}: #{params.inspect}"
|
puts "#{Time.zone.now}/#{method}: #{params.inspect}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue