module Dill::DSL
Attributes
widget_lookup_scope[W]
Public Instance Methods
click(name, *args)
click to toggle source
Clicks the widget defined by name
and optional args
.
Makes no distinction between links or buttons.
class MyWidget < Dill::Widget root { |text| ['.my-widget', text: text] } end # <a href="#one" class="my-widget">One</li> # <a href="#two" class="my-widget">Two</li> <!-- clicks this node --> click :my_widget, 'Two'
# File lib/dill/dsl.rb, line 16 def click(name, *args) widget(name, *args).click end
document()
click to toggle source
@return [Document] the current document with the class of the
current object set as the widget lookup scope.
# File lib/dill/dsl.rb, line 37 def document Document.new(widget_lookup_scope) end
double_click(name, *args)
click to toggle source
Double clicks the widget defined by name
and optional args
.
# File lib/dill/dsl.rb, line 26 def double_click(name, *args) widget(name, *args).double_click end
eventually(wait_time = Capybara.default_max_wait_time, &block)
click to toggle source
re-run one or more assertions until either they all pass, or Dill
times out, which will result in a test failure.
# File lib/dill/dsl.rb, line 97 def eventually(wait_time = Capybara.default_max_wait_time, &block) Checkpoint.wait_for wait_time, &block end
has_widget?(name, *args)
click to toggle source
@return [Boolean] Whether one or more widgets exist in the current
document.
# File lib/dill/dsl.rb, line 43 def has_widget?(name, *args) document.has_widget?(name, *args) end
Also aliased as: widget?
hover(name, *args)
click to toggle source
Hovers the widget defined by name
and optional args
.
# File lib/dill/dsl.rb, line 21 def hover(name, *args) widget(name, *args).hover end
not_visible?(name, *args)
click to toggle source
# File lib/dill/dsl.rb, line 53 def not_visible?(name, *args) document.not_visible?(name, *args) end
right_click(name, *args)
click to toggle source
Right clicks the widget defined by name
and optional args
.
# File lib/dill/dsl.rb, line 31 def right_click(name, *args) widget(name, *args).right_click end
set(name, fields)
click to toggle source
# File lib/dill/dsl.rb, line 57 def set(name, fields) widget(name).set fields end
submit(name, fields = {})
click to toggle source
# File lib/dill/dsl.rb, line 61 def submit(name, fields = {}) widget(name).submit_with fields end
value(name, *args)
click to toggle source
# File lib/dill/dsl.rb, line 65 def value(name, *args) widget(name, *args).value end
values(name, *args)
click to toggle source
# File lib/dill/dsl.rb, line 69 def values(name, *args) widgets(name, *args).map(&:value) end
visible?(name, *args)
click to toggle source
# File lib/dill/dsl.rb, line 49 def visible?(name, *args) document.visible?(name, *args) end
visit(path)
click to toggle source
# File lib/dill/dsl.rb, line 73 def visit(path) Capybara.current_session.visit path end
widget(name, *args)
click to toggle source
Returns a widget instance for the given name.
@param name [String, Symbol]
# File lib/dill/dsl.rb, line 80 def widget(name, *args) eventually { document.widget(name, *args) } end
widget_lookup_scope()
click to toggle source
# File lib/dill/dsl.rb, line 91 def widget_lookup_scope @widget_lookup_scope ||= default_widget_lookup_scope end
widgets(name, *args)
click to toggle source
Returns a list of widget instances for the given name.
@param name [String, Symbol]
# File lib/dill/dsl.rb, line 87 def widgets(name, *args) document.widgets(name, *args) end
Private Instance Methods
default_widget_lookup_scope()
click to toggle source
# File lib/dill/dsl.rb, line 103 def default_widget_lookup_scope Module === self ? self : self.class end