module Symbiont::DataSetter
Public Instance Methods
use_data_with(key, value)
click to toggle source
# File lib/symbiont/data_setter.rb, line 15 def use_data_with(key, value) element = send("#{key}") set_and_select(element, value) check_and_uncheck(element, value) end
using(data)
click to toggle source
@param data [Hash] the data to use
# File lib/symbiont/data_setter.rb, line 4 def using(data) data.each do |key, value| use_data_with(key, value) if object_enabled_for(key) end end
Private Instance Methods
check_and_uncheck(element, value)
click to toggle source
# File lib/symbiont/data_setter.rb, line 29 def check_and_uncheck(element, value) return call_method_chain("#{key}.check") if element.class == Watir::CheckBox && value return call_method_chain("#{key}.uncheck") if element.class == Watir::CheckBox end
object_enabled_for(key)
click to toggle source
# File lib/symbiont/data_setter.rb, line 34 def object_enabled_for(key) web_element = send("#{key}") web_element.enabled? && web_element.visible? end
set_and_select(element, value)
click to toggle source
# File lib/symbiont/data_setter.rb, line 23 def set_and_select(element, value) call_method_chain("#{key}.set", value) if element.class == Watir::TextField call_method_chain("#{key}.set") if element.class == Watir::Radio call_method_chain("#{key}.select", value) if element.class == Watir::Select end