spec/spec_helper.rb in rautomation-0.6.3 vs spec/spec_helper.rb in rautomation-0.7.0

- old
+ new

@@ -1,9 +1,12 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) require 'rautomation' require 'rspec' +#require 'simplecov' +#SimpleCov.start + module SpecHelper # @private def adapter ENV["RAUTOMATION_ADAPTER"] && ENV["RAUTOMATION_ADAPTER"].to_sym || RAutomation::Adapter::Helper.default_adapter end @@ -48,11 +51,11 @@ # Window 1 should have a text field with the specified class name. :window1_text_field_class => "Edit", # Adapter internal method invocation for getting title of window2 :title_proc => lambda {|win| win.WinGetTitle("[TITLE:MainFormWindow]")} }, - :win_ffi => { + :win_32 => { # Path to some binary, which opens up a window, what can be # minimized, maximized, activated, closed and etc. :window1 => "ext\\WindowsForms\\bin\\WindowsForms.exe", :window2 => "calc", :window2_title => /calc/i, @@ -73,19 +76,42 @@ # Window 1 should have a text field with the specified class name. :window1_text_field_class => "Edit", # Adapter internal method invocation for getting title of window2 :title_proc => lambda {|win| win.window_title(win.hwnd)} }, - :ms_ui_automation => { - :window1 => "ext\\WindowsForms\\bin\\WindowsForms.exe" + #Just copying :win_ffi data for now + :ms_uia => { + # Path to some binary, which opens up a window, what can be + # minimized, maximized, activated, closed and etc. + :window1 => "ext\\WindowsForms\\bin\\WindowsForms.exe", + :window2 => "calc", + :window2_title => /calc/i, + # Window 1 title, has to be a Regexp. + :window1_title => /FormWindow/i, + :window1_full_title => 'MainFormWindow', + # Window 1 should have this text on it. + :window1_text => "This is a sample text", + # When sending ENTER on Window 2, then the window OK button should be pressed and Window 2 should be closed. + # "A" key + :window1_send_keys => "A", + :proc_after_send_keys => lambda do + about_box = RAutomation::Window.new(:title => /About/i) + RAutomation::WaitHelper.wait_until {about_box.present?} + end, + # Window 1 should have a button with the following text. + :window1_button_text => "&About", + # Window 1 should have a text field with the specified class name. + :window1_text_field_class => "Edit", + # Adapter internal method invocation for getting title of window2 + :title_proc => lambda {|win| win.window_title(win.hwnd)} } }[adapter] end RSpec.configure do |config| config.before(:each) do - RAutomation::Window.wait_timeout = 60 + RAutomation::Window.wait_timeout = 15 @pid1 = IO.popen(SpecHelper::DATA[:window1]).pid RAutomation::WaitHelper.wait_until {RAutomation::Window.new(:pid => @pid1).present?} end