Skip to content

Commit 156128e

Browse files
Forgot to include new helper function
1 parent 8467700 commit 156128e

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Simulates the user double clicking on an element specified by a css_selector
2+
# by using the API provided by Ferrum to manipulate the browser directly.
3+
#
4+
# @param css_selector [String] The CSS selector for the element to be double clicked.
5+
#
6+
# @example Usage
7+
# # Make sure the element is there
8+
# expect(page.find('a.btn.btn-success.btn-md[href*="/picked_up"]')).to have_content("Distribution Complete")
9+
#
10+
# # Double click it
11+
# ferrum_double_click('a.btn.btn-success.btn-md[href*="/picked_up"]')
12+
#
13+
# # Assert something based on the double click.
14+
def ferrum_double_click(css_selector)
15+
node = Capybara.page.driver.browser.at_css(css_selector)
16+
x, y = node.find_position
17+
mouse = node.page.mouse
18+
mouse.move(x:, y:)
19+
mouse.down
20+
mouse.up
21+
sleep(0.05)
22+
mouse.down
23+
mouse.up
24+
end

0 commit comments

Comments
 (0)