Module: CapybaraTestHelpers::Actions
- Included in:
- TestHelper
- Defined in:
- lib/capybara_test_helpers/actions.rb
Overview
Internal: Wraps Capybara actions to enable locator aliases, and to wrap the result with a test helper so that methods can be chained in a fluent style.
Instance Method Summary collapse
-
#blur ⇒ Object
Public: Useful to natively blur an element.
-
#focus ⇒ Object
Public: Useful to natively give focus to an element.
-
#type_in(*text, typing: text.size > 1 || text.first.is_a?(Symbol) || text.first.is_a?(Array), **options) ⇒ Object
Public: Sets the value for the input, or presses the specified keys, one at a time.
Instance Method Details
#blur ⇒ Object
Public: Useful to natively blur an element.
112 113 114 115 |
# File 'lib/capybara_test_helpers/actions.rb', line 112 def blur .execute_script('this.blur()') self end |
#focus ⇒ Object
Public: Useful to natively give focus to an element.
106 107 108 109 |
# File 'lib/capybara_test_helpers/actions.rb', line 106 def focus .execute_script('this.focus()') self end |
#type_in(*text, typing: text.size > 1 || text.first.is_a?(Symbol) || text.first.is_a?(Array), **options) ⇒ Object
Public: Sets the value for the input, or presses the specified keys, one at a time.
101 102 103 |
# File 'lib/capybara_test_helpers/actions.rb', line 101 def type_in(*text, typing: text.size > 1 || text.first.is_a?(Symbol) || text.first.is_a?(Array), **) typing ? send_keys(*text) : set(text.first, **) end |