# File lib/util/rspec/user.rb, line 31 def cannot_see(args) if args[:window] window_name = args[:window] window = get_window window_name window.should_not be_visible end #sleep 1 end
TODO: Events should execute in a seperate thread, such that blocking calls won’t block the tests. Maybe an option?
# File lib/util/rspec/user.rb, line 17 def clicks(component_name) view = @controller_context.instance_variable_get :@__view on_edt do begin view.send(component_name).do_click rescue => e puts e puts e.backtrace raise end end sleep 1 end
# File lib/util/rspec/user.rb, line 71 def closes(arg) if arg == :window @controller_context.close else get_controller(arg[:window]).close end #sleep 1 end
# File lib/util/rspec/user.rb, line 80 def exits Monkeybars::Controller.active_controllers.each {|name, controller| controller[0].close unless controller[0].nil? } end
# File lib/util/rspec/user.rb, line 40 def sees(args) on_edt do begin view = @controller_context.instance_variable_get :@__view warn "view is nil for user sees!!!!!!!!!!!!!!!!!!!" if view.nil? if !(args[:in].nil? || args[:value].nil?) view.instance_eval(args[:in]).should == args[:value] elsif !args[:window].nil? window_name = args[:window] window = get_window window_name window.should be_visible #unless args[:visibility_override] elsif !args[:panel].nil? panel_name = args[:panel] panel = get_window panel_name panel.should be_visible elsif !args[:table].nil? row = args[:row].to_i column = args[:column].to_i view = @controller_context.instance_variable_get :@__view table_component = view.send args[:table].gsub(' ','_') table_component.getModel.getValueAt(row, column).to_s.should == args[:data] end rescue => e puts e puts e.backtrace raise end end #sleep 1 end
# File lib/util/rspec/user.rb, line 84 def selects(options) if options.key? :table row = options[:row].to_i column = options[:column].to_i view = @controller_context.instance_variable_get :@__view component = view.send options[:table].gsub(' ', '_') component.change_selection(row.to_i, column.to_i, false, false) elsif options.key? :tabbed_pane tab_name = options[:tab_name] view = @controller_context.instance_variable_get :@__view component = view.send options[:tabbed_pane] 0.upto(component.get_tab_count - 1) do |i| if tab_name == component.get_title_at(i) component.set_selected_index(i) end end end sleep 1 end
# File lib/util/rspec/user.rb, line 104 def types(args) text = args[:text] component_name = args[:in] position = args[:at] view = @controller_context.instance_variable_get :@__view #main_component = view.instance_variable_get(:@main_view_component) component = view.instance_eval(component_name) text_index = case position when :beginning 0 when :end # end component.request_focus component.grab_focus component.caret_position = text_index if component.respond_to?(:caret_position=) && !text_index.nil? send_key_events component, text component.transfer_focus #push_robot_key text #sleep 1 end
Generated with the Darkfish Rdoc Generator 2.