Add an extra move to FF Node#hover to workarkound Issue #2156
This commit is contained in:
parent
8930306e2f
commit
7ae8b07499
|
@ -58,6 +58,12 @@ class Capybara::Selenium::FirefoxNode < Capybara::Selenium::Node
|
|||
html5_drag_to(element)
|
||||
end
|
||||
|
||||
def hover
|
||||
return super unless (browser_version >= 65.0)
|
||||
# work around issue 2156 - https://github.com/teamcapybara/capybara/issues/2156
|
||||
scroll_if_needed { browser_action.move_to(native, 0, 0).move_to(native).perform }
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def click_with_options(click_options)
|
||||
|
|
|
@ -344,6 +344,15 @@ Capybara::SpecHelper.spec 'node' do
|
|||
@session.find(:css, '.wrapper.scroll_needed').hover
|
||||
expect(@session.find(:css, '.wrapper.scroll_needed .hidden_until_hover', visible: false)).to be_visible
|
||||
end
|
||||
|
||||
it 'should hover again after following a link and back' do
|
||||
@session.visit('/with_hover')
|
||||
@session.find(:css, '.wrapper:not(.scroll_needed)').hover
|
||||
@session.click_link('Other hover page')
|
||||
@session.click_link('Go back')
|
||||
@session.find(:css, '.wrapper:not(.scroll_needed)').hover
|
||||
expect(@session.find(:css, '.wrapper:not(.scroll_needed) .hidden_until_hover', visible: false)).to be_visible
|
||||
end
|
||||
end
|
||||
|
||||
describe '#click' do
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
.hidden_until_hover {display: none;}
|
||||
.wrapper:hover .hidden_until_hover { display: block }
|
||||
</style>
|
||||
<a href='with_hover1'>Other hover page</a>
|
||||
<div class="wrapper">
|
||||
Some text here so the wrapper has size
|
||||
<div class="hidden_until_hover">Here I am</div>
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<a href="with_hover">Go back</a>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue