rdp-rautomation 0.6.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. data/.document +5 -0
  2. data/.rspec +2 -0
  3. data/.yardopts +6 -0
  4. data/History.rdoc +103 -0
  5. data/LICENSE +20 -0
  6. data/README.rdoc +114 -0
  7. data/Rakefile +43 -0
  8. data/VERSION +1 -0
  9. data/ext/AutoItX/AutoItX.chm +0 -0
  10. data/ext/AutoItX/AutoItX3.dll +0 -0
  11. data/ext/IAccessibleDLL/IAccessibleDLL.sln +20 -0
  12. data/ext/IAccessibleDLL/IAccessibleDLL.suo +0 -0
  13. data/ext/IAccessibleDLL/IAccessibleDLL/IAccessibleDLL.cpp +30 -0
  14. data/ext/IAccessibleDLL/IAccessibleDLL/IAccessibleDLL.vcxproj +102 -0
  15. data/ext/IAccessibleDLL/IAccessibleDLL/IAccessibleDLL.vcxproj.filters +42 -0
  16. data/ext/IAccessibleDLL/IAccessibleDLL/IAccessibleDLL.vcxproj.user +3 -0
  17. data/ext/IAccessibleDLL/IAccessibleDLL/ReadMe.txt +48 -0
  18. data/ext/IAccessibleDLL/IAccessibleDLL/dllmain.cpp +19 -0
  19. data/ext/IAccessibleDLL/IAccessibleDLL/stdafx.cpp +8 -0
  20. data/ext/IAccessibleDLL/IAccessibleDLL/stdafx.h +22 -0
  21. data/ext/IAccessibleDLL/IAccessibleDLL/table_support.cpp +282 -0
  22. data/ext/IAccessibleDLL/IAccessibleDLL/targetver.h +8 -0
  23. data/ext/IAccessibleDLL/Release/IAccessibleDLL.dll +0 -0
  24. data/ext/ListViewExplorer/ListViewExplorer.sln +20 -0
  25. data/ext/ListViewExplorer/ListViewExplorer.suo +0 -0
  26. data/ext/ListViewExplorer/ListViewExplorer/ListViewExplorer.cpp +174 -0
  27. data/ext/ListViewExplorer/ListViewExplorer/ListViewExplorer.vcxproj +95 -0
  28. data/ext/ListViewExplorer/ListViewExplorer/ListViewExplorer.vcxproj.filters +42 -0
  29. data/ext/ListViewExplorer/ListViewExplorer/ListViewExplorer.vcxproj.user +3 -0
  30. data/ext/ListViewExplorer/ListViewExplorer/ReadMe.txt +40 -0
  31. data/ext/ListViewExplorer/ListViewExplorer/stdafx.cpp +8 -0
  32. data/ext/ListViewExplorer/ListViewExplorer/stdafx.h +17 -0
  33. data/ext/ListViewExplorer/ListViewExplorer/table_support.cpp +250 -0
  34. data/ext/ListViewExplorer/ListViewExplorer/table_support.h +2 -0
  35. data/ext/ListViewExplorer/ListViewExplorer/targetver.h +8 -0
  36. data/ext/UiaDll/Release/UiaDll.dll +0 -0
  37. data/ext/UiaDll/UiaDll.sln +20 -0
  38. data/ext/UiaDll/UiaDll.suo +0 -0
  39. data/ext/UiaDll/UiaDll/ReadMe.txt +48 -0
  40. data/ext/UiaDll/UiaDll/UiaDll.cpp +205 -0
  41. data/ext/UiaDll/UiaDll/UiaDll.vcxproj +104 -0
  42. data/ext/UiaDll/UiaDll/UiaDll.vcxproj.filters +42 -0
  43. data/ext/UiaDll/UiaDll/dllmain.cpp +39 -0
  44. data/ext/UiaDll/UiaDll/globals.h +3 -0
  45. data/ext/UiaDll/UiaDll/stdafx.cpp +8 -0
  46. data/ext/UiaDll/UiaDll/stdafx.h +19 -0
  47. data/ext/UiaDll/UiaDll/targetver.h +8 -0
  48. data/ext/WindowsForms/bin/WindowsForms.exe +0 -0
  49. data/ext/WindowsForms/src/WindowsForms/WindowsForms.sln +20 -0
  50. data/ext/WindowsForms/src/WindowsForms/WindowsForms.suo +0 -0
  51. data/ext/WindowsForms/src/WindowsForms/WindowsForms/AboutBox.Designer.cs +80 -0
  52. data/ext/WindowsForms/src/WindowsForms/WindowsForms/AboutBox.cs +103 -0
  53. data/ext/WindowsForms/src/WindowsForms/WindowsForms/AboutBox.resx +120 -0
  54. data/ext/WindowsForms/src/WindowsForms/WindowsForms/DataEntryForm.Designer.cs +187 -0
  55. data/ext/WindowsForms/src/WindowsForms/WindowsForms/DataEntryForm.cs +46 -0
  56. data/ext/WindowsForms/src/WindowsForms/WindowsForms/DataEntryForm.resx +120 -0
  57. data/ext/WindowsForms/src/WindowsForms/WindowsForms/MainFormWindow.Designer.cs +377 -0
  58. data/ext/WindowsForms/src/WindowsForms/WindowsForms/MainFormWindow.cs +78 -0
  59. data/ext/WindowsForms/src/WindowsForms/WindowsForms/MainFormWindow.resx +120 -0
  60. data/ext/WindowsForms/src/WindowsForms/WindowsForms/PersonForm.Designer.cs +119 -0
  61. data/ext/WindowsForms/src/WindowsForms/WindowsForms/PersonForm.cs +34 -0
  62. data/ext/WindowsForms/src/WindowsForms/WindowsForms/PersonForm.resx +120 -0
  63. data/ext/WindowsForms/src/WindowsForms/WindowsForms/Program.cs +21 -0
  64. data/ext/WindowsForms/src/WindowsForms/WindowsForms/Properties/AssemblyInfo.cs +36 -0
  65. data/ext/WindowsForms/src/WindowsForms/WindowsForms/Properties/Resources.Designer.cs +71 -0
  66. data/ext/WindowsForms/src/WindowsForms/WindowsForms/Properties/Resources.resx +117 -0
  67. data/ext/WindowsForms/src/WindowsForms/WindowsForms/Properties/Settings.Designer.cs +30 -0
  68. data/ext/WindowsForms/src/WindowsForms/WindowsForms/Properties/Settings.settings +7 -0
  69. data/ext/WindowsForms/src/WindowsForms/WindowsForms/SimpleElementsForm.Designer.cs +93 -0
  70. data/ext/WindowsForms/src/WindowsForms/WindowsForms/SimpleElementsForm.cs +19 -0
  71. data/ext/WindowsForms/src/WindowsForms/WindowsForms/SimpleElementsForm.resx +120 -0
  72. data/ext/WindowsForms/src/WindowsForms/WindowsForms/WindowsForms.csproj +123 -0
  73. data/ext/WindowsForms/src/WindowsForms/WindowsForms/bin/Release/WindowsForms.exe +0 -0
  74. data/lib/rautomation.rb +6 -0
  75. data/lib/rautomation/adapter/autoit.rb +5 -0
  76. data/lib/rautomation/adapter/autoit/button.rb +59 -0
  77. data/lib/rautomation/adapter/autoit/locators.rb +22 -0
  78. data/lib/rautomation/adapter/autoit/text_field.rb +61 -0
  79. data/lib/rautomation/adapter/autoit/window.rb +184 -0
  80. data/lib/rautomation/adapter/helper.rb +20 -0
  81. data/lib/rautomation/adapter/win_ffi.rb +21 -0
  82. data/lib/rautomation/adapter/win_ffi/button.rb +25 -0
  83. data/lib/rautomation/adapter/win_ffi/button_helper.rb +24 -0
  84. data/lib/rautomation/adapter/win_ffi/checkbox.rb +19 -0
  85. data/lib/rautomation/adapter/win_ffi/constants.rb +94 -0
  86. data/lib/rautomation/adapter/win_ffi/control.rb +79 -0
  87. data/lib/rautomation/adapter/win_ffi/functions.rb +333 -0
  88. data/lib/rautomation/adapter/win_ffi/keystroke_converter.rb +67 -0
  89. data/lib/rautomation/adapter/win_ffi/label.rb +21 -0
  90. data/lib/rautomation/adapter/win_ffi/list_box.rb +60 -0
  91. data/lib/rautomation/adapter/win_ffi/locators.rb +22 -0
  92. data/lib/rautomation/adapter/win_ffi/ms_uia/uia_dll.rb +36 -0
  93. data/lib/rautomation/adapter/win_ffi/radio.rb +19 -0
  94. data/lib/rautomation/adapter/win_ffi/select_list.rb +87 -0
  95. data/lib/rautomation/adapter/win_ffi/table.rb +57 -0
  96. data/lib/rautomation/adapter/win_ffi/text_field.rb +52 -0
  97. data/lib/rautomation/adapter/win_ffi/window.rb +226 -0
  98. data/lib/rautomation/button.rb +55 -0
  99. data/lib/rautomation/element_collections.rb +47 -0
  100. data/lib/rautomation/text_field.rb +60 -0
  101. data/lib/rautomation/wait_helper.rb +23 -0
  102. data/lib/rautomation/window.rb +234 -0
  103. data/spec/adapter/win_ffi/button_spec.rb +41 -0
  104. data/spec/adapter/win_ffi/checkbox_spec.rb +48 -0
  105. data/spec/adapter/win_ffi/keystroke_converter_spec.rb +47 -0
  106. data/spec/adapter/win_ffi/label_spec.rb +21 -0
  107. data/spec/adapter/win_ffi/listbox_spec.rb +52 -0
  108. data/spec/adapter/win_ffi/radio_spec.rb +37 -0
  109. data/spec/adapter/win_ffi/select_list_spec.rb +66 -0
  110. data/spec/adapter/win_ffi/table_spec.rb +39 -0
  111. data/spec/adapter/win_ffi/text_field_spec.rb +23 -0
  112. data/spec/adapter/win_ffi/window_spec.rb +43 -0
  113. data/spec/button_spec.rb +68 -0
  114. data/spec/buttons_spec.rb +21 -0
  115. data/spec/spec_helper.rb +96 -0
  116. data/spec/text_field_spec.rb +65 -0
  117. data/spec/text_fields_spec.rb +22 -0
  118. data/spec/window_spec.rb +122 -0
  119. data/spec/windows_spec.rb +55 -0
  120. metadata +207 -0
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe RAutomation::Buttons do
4
+
5
+ it "Window#buttons returns all buttons" do
6
+ SpecHelper::navigate_to_simple_elements
7
+
8
+ buttons = RAutomation::Window.new(:title => "SimpleElementsForm").buttons
9
+ buttons.size.should == 2
10
+ buttons.find_all {|b| b.value == 'button1'}.size.should == 1
11
+ end
12
+
13
+ it "Window#buttons with parameters returns all matching buttons" do
14
+ SpecHelper::navigate_to_simple_elements
15
+
16
+ buttons = RAutomation::Window.new(:title => "SimpleElementsForm").buttons(:value => 'button1')
17
+ buttons.size.should == 1
18
+ buttons.first.value.should == 'button1'
19
+ end
20
+
21
+ end
@@ -0,0 +1,96 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ require 'rautomation'
3
+ require 'rspec'
4
+
5
+ module SpecHelper
6
+ # @private
7
+ def adapter
8
+ ENV["RAUTOMATION_ADAPTER"] && ENV["RAUTOMATION_ADAPTER"].to_sym || RAutomation::Adapter::Helper.default_adapter
9
+ end
10
+
11
+ def navigate_to_simple_elements
12
+ main_window = RAutomation::Window.new(:title => "MainFormWindow")
13
+ main_window.button(:value => "Simple Elements").click { RAutomation::Window.new(:title => "SimpleElementsForm").present? }
14
+ end
15
+
16
+ module_function :adapter, :navigate_to_simple_elements
17
+
18
+ # Since adapters are different then the windows to be tested
19
+ # might be different also.
20
+ #
21
+ # This constant allows to create input data for specs which could differ between the adapters.
22
+ #
23
+ # There has to be 2 windows:
24
+ # 1) Some random window, which is maximizable, minimizable, close'able and etc.
25
+ # 2) Browser window, which opens up a test.html where JavaScript prompt with a Button and a TextField objects will be shown.
26
+ DATA = {
27
+ # This adapter needs Windows OS with Internet Explorer installed into 'c:\program files\internet explorer'.
28
+ :autoit => {
29
+ # Path to some binary, which opens up a window, what can be
30
+ # minimized, maximized, activated, closed and etc.
31
+ :window1 => "ext\\WindowsForms\\bin\\WindowsForms.exe",
32
+ :window2 => "calc",
33
+ :window2_title => /calc/i,
34
+ # Window 1 title, has to be a Regexp.
35
+ :window1_title => /FormWindow/i,
36
+ :window1_full_title => 'MainFormWindow',
37
+ # Window 1 should have this text on it.
38
+ :window1_text => "This is a sample text",
39
+ # When sending ENTER on Window 2, then the window OK button should be pressed and Window 2 should be closed.
40
+ # "A" key
41
+ :window1_send_keys => "A",
42
+ :proc_after_send_keys => lambda do
43
+ about_box = RAutomation::Window.new(:title => /About/i)
44
+ RAutomation::WaitHelper.wait_until {about_box.present?}
45
+ end,
46
+ # Window 1 should have a button with the following text.
47
+ :window1_button_text => "&About",
48
+ # Window 1 should have a text field with the specified class name.
49
+ :window1_text_field_class => "Edit",
50
+ # Adapter internal method invocation for getting title of window2
51
+ :title_proc => lambda {|win| win.WinGetTitle("[TITLE:MainFormWindow]")}
52
+ },
53
+ :win_ffi => {
54
+ # Path to some binary, which opens up a window, what can be
55
+ # minimized, maximized, activated, closed and etc.
56
+ :window1 => "ext\\WindowsForms\\bin\\WindowsForms.exe",
57
+ :window2 => "calc",
58
+ :window2_title => /calc/i,
59
+ # Window 1 title, has to be a Regexp.
60
+ :window1_title => /FormWindow/i,
61
+ :window1_full_title => 'MainFormWindow',
62
+ # Window 1 should have this text on it.
63
+ :window1_text => "This is a sample text",
64
+ # When sending ENTER on Window 2, then the window OK button should be pressed and Window 2 should be closed.
65
+ # "A" key
66
+ :window1_send_keys => "A",
67
+ :proc_after_send_keys => lambda do
68
+ about_box = RAutomation::Window.new(:title => /About/i)
69
+ RAutomation::WaitHelper.wait_until {about_box.present?}
70
+ end,
71
+ # Window 1 should have a button with the following text.
72
+ :window1_button_text => "&About",
73
+ # Window 1 should have a text field with the specified class name.
74
+ :window1_text_field_class => "Edit",
75
+ # Adapter internal method invocation for getting title of window2
76
+ :title_proc => lambda {|win| win.window_title(win.hwnd)}
77
+ },
78
+ :ms_ui_automation => {
79
+ :window1 => "ext\\WindowsForms\\bin\\WindowsForms.exe"
80
+ }
81
+ }[adapter]
82
+ end
83
+
84
+
85
+ RSpec.configure do |config|
86
+ config.before(:each) do
87
+ RAutomation::Window.wait_timeout = 60
88
+
89
+ @pid1 = IO.popen(SpecHelper::DATA[:window1]).pid
90
+ RAutomation::WaitHelper.wait_until {RAutomation::Window.new(:pid => @pid1).present?}
91
+ end
92
+
93
+ config.after(:each) do
94
+ Process.kill(9, @pid1) rescue nil
95
+ end
96
+ end
@@ -0,0 +1,65 @@
1
+ require 'spec_helper'
2
+
3
+ describe RAutomation::TextField do
4
+ it "#text_field" do
5
+ RAutomation::Window.new(:title => "MainFormWindow").
6
+ text_field(:id => "textField").should exist
7
+
8
+ RAutomation::Window.wait_timeout = 0.1
9
+ expect { RAutomation::Window.new(:title => "non-existent-window").
10
+ text_field(:class => "Edit") }.
11
+ to raise_exception(RAutomation::UnknownWindowException)
12
+ end
13
+
14
+ it "#set" do
15
+ window = RAutomation::Window.new(:title => "MainFormWindow")
16
+ window.text_field(:id => "textField").set "hello!"
17
+
18
+ RAutomation::Window.wait_timeout = 0.1
19
+ expect { window.text_field(:class => "non-existing-field").set "hello!" }.
20
+ to raise_exception(RAutomation::UnknownTextFieldException)
21
+ end
22
+
23
+ it "#clear" do
24
+ window = RAutomation::Window.new(:title => "MainFormWindow")
25
+ field = window.text_field(:id => "textField")
26
+ field.set "hello!"
27
+ field.value.should == "hello!"
28
+ field.clear
29
+ field.value.should be_empty
30
+
31
+ RAutomation::Window.wait_timeout = 0.1
32
+ expect { window.text_field(:class => "non-existent-field").clear }.
33
+ to raise_exception(RAutomation::UnknownTextFieldException)
34
+ end
35
+
36
+ it "#value" do
37
+ window = RAutomation::Window.new(:title => "MainFormWindow")
38
+ field = window.text_field(:id => "textField")
39
+ field.set "hello!"
40
+ field.value.should == "hello!"
41
+
42
+ RAutomation::Window.wait_timeout = 0.1
43
+ expect { window.text_field(:class => "non-existent-field").value }.
44
+ to raise_exception(RAutomation::UnknownTextFieldException)
45
+ end
46
+
47
+ it "#exists?" do
48
+ window = RAutomation::Window.new(:title => "MainFormWindow")
49
+ field = window.text_field(:id => "textField")
50
+ field.should exist
51
+ window.text_field(:class => "non-existent-field").should_not exist
52
+ end
53
+
54
+
55
+ it "#hwnd" do
56
+ window = RAutomation::Window.new(:title => "MainFormWindow")
57
+ field = window.text_field(:id => "textField")
58
+
59
+ field.hwnd.should be_a(Fixnum)
60
+
61
+ RAutomation::Window.wait_timeout = 0.1
62
+ expect { window.text_field(:class => "non-existing-window").hwnd }.
63
+ to raise_exception(RAutomation::UnknownTextFieldException)
64
+ end
65
+ end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ describe RAutomation::TextFields do
4
+
5
+ it "Window#text_fields returns all text fields" do
6
+ SpecHelper::navigate_to_simple_elements
7
+
8
+ text_fields = RAutomation::Window.new(:title => "SimpleElementsForm").text_fields
9
+ text_fields.size.should == 2
10
+ text_fields.find_all {|t| t.value == "Enter some text"}.size.should == 1
11
+ end
12
+
13
+ it "Window#text_fields with parameters returns all matching text fields" do
14
+ SpecHelper::navigate_to_simple_elements
15
+
16
+ window = RAutomation::Window.new(:title => "SimpleElementsForm")
17
+ text_fields = window.text_fields(:index => 0)
18
+ text_fields.size.should == 2
19
+ text_fields.first.value.should == "Enter some text"
20
+ end
21
+
22
+ end
@@ -0,0 +1,122 @@
1
+ require 'spec_helper'
2
+
3
+ describe RAutomation::Window do
4
+ it "RAutomation::Window.adapter" do
5
+ RAutomation::Window.new(:title => "random").adapter.should == (ENV["RAUTOMATION_ADAPTER"] && ENV["RAUTOMATION_ADAPTER"].to_sym || RAutomation::Adapter::Helper.default_adapter)
6
+ end
7
+
8
+ it "Window#new by full title" do
9
+ RAutomation::Window.new(:title => SpecHelper::DATA[:window1_full_title]).should exist
10
+ end
11
+
12
+ it "Window#new by regexp title" do
13
+ RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title]).should exist
14
+ end
15
+
16
+ it "Window#new by hwnd" do
17
+ hwnd = RAutomation::Window.new(:title => SpecHelper::DATA[:window1_full_title]).hwnd
18
+ window = RAutomation::Window.new(:hwnd => hwnd)
19
+ window.should exist
20
+ window.title.should == SpecHelper::DATA[:window1_full_title]
21
+ end
22
+
23
+ it "#exists?" do
24
+ RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title]).should exist
25
+ RAutomation::Window.new(:title => "non-existing-window").should_not exist
26
+ end
27
+
28
+ it "#visible?"do
29
+ RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title]).should be_visible
30
+ RAutomation::Window.wait_timeout = 0.1
31
+ expect {RAutomation::Window.new(:title => "non-existing-window").visible?}.
32
+ to raise_exception(RAutomation::UnknownWindowException)
33
+ end
34
+
35
+ it "#present?"do
36
+ RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title]).should be_present
37
+ RAutomation::Window.new(:title => "non-existing-window").should_not be_present
38
+ end
39
+
40
+ it "#hwnd" do
41
+ RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title]).hwnd.should be_a(Fixnum)
42
+ RAutomation::Window.wait_timeout = 0.1
43
+ expect {RAutomation::Window.new(:title => "non-existing-window").hwnd}.
44
+ to raise_exception(RAutomation::UnknownWindowException)
45
+ end
46
+
47
+ it "#title" do
48
+ RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title]).title.should == SpecHelper::DATA[:window1_full_title]
49
+ RAutomation::Window.wait_timeout = 0.1
50
+ expect {RAutomation::Window.new(:title => "non-existing-window").title}.
51
+ to raise_exception(RAutomation::UnknownWindowException)
52
+ end
53
+
54
+ it "#activate & #active?" do
55
+ window = RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title])
56
+ window.activate
57
+ window.should be_active
58
+ non_existing_window = RAutomation::Window.new(:title => "non-existing-window")
59
+ non_existing_window.activate
60
+ non_existing_window.should_not be_active
61
+ end
62
+
63
+ it "#text" do
64
+ RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title]).text.should include(SpecHelper::DATA[:window1_text])
65
+ RAutomation::Window.wait_timeout = 0.1
66
+ expect {RAutomation::Window.new(:title => "non-existing-window").text}.
67
+ to raise_exception(RAutomation::UnknownWindowException)
68
+ end
69
+
70
+ it "#maximize" do
71
+ RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title]).maximize
72
+ RAutomation::Window.wait_timeout = 0.1
73
+ expect {RAutomation::Window.new(:title => "non-existing-window").maximize}.
74
+ to raise_exception(RAutomation::UnknownWindowException)
75
+ end
76
+
77
+ it "#minimize & #minimized?" do
78
+ window = RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title])
79
+ window.should_not be_minimized
80
+ window.minimize
81
+ window.should be_minimized
82
+
83
+ RAutomation::Window.wait_timeout = 0.1
84
+ expect {RAutomation::Window.new(:title => "non-existing-window").minimize}.
85
+ to raise_exception(RAutomation::UnknownWindowException)
86
+ expect {RAutomation::Window.new(:title => "non-existing-window").minimized?}.
87
+ to raise_exception(RAutomation::UnknownWindowException)
88
+ end
89
+
90
+ it "#restore" do
91
+ RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title]).restore
92
+ RAutomation::Window.wait_timeout = 0.1
93
+ expect {RAutomation::Window.new(:title => "non-existing-window").restore}.
94
+ to raise_exception(RAutomation::UnknownWindowException)
95
+ end
96
+
97
+ it "#method_missing" do
98
+ win = RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title])
99
+ SpecHelper::DATA[:title_proc].call(win).should == SpecHelper::DATA[:window1_full_title]
100
+ end
101
+
102
+ it "#send_keys"do
103
+ window = RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title])
104
+ window.minimize # send_keys should work even if window is minimized
105
+ window.send_keys(SpecHelper::DATA[:window1_send_keys])
106
+ SpecHelper::DATA[:proc_after_send_keys].call
107
+
108
+ RAutomation::Window.wait_timeout = 0.1
109
+ expect {RAutomation::Window.new(:title => "non-existing-window").send_keys("123")}.
110
+ to raise_exception(RAutomation::UnknownWindowException)
111
+ end
112
+
113
+ it "#close" do
114
+ window = RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title])
115
+ window.should exist
116
+ window.close
117
+ window.should_not exist
118
+
119
+ expect {RAutomation::Window.new(:title => "non-existing-window").close}.
120
+ to_not raise_exception
121
+ end
122
+ end
@@ -0,0 +1,55 @@
1
+ require 'spec_helper'
2
+
3
+ describe RAutomation::Windows do
4
+ subject {self}
5
+
6
+ before :each do
7
+ @pid2 = IO.popen(SpecHelper::DATA[:window2]).pid
8
+ window = RAutomation::Window.new(:pid => @pid2)
9
+ RAutomation::WaitHelper.wait_until {window.present?}
10
+ end
11
+
12
+ it "Window.windows returns all windows" do
13
+ windows = RAutomation::Window.windows
14
+ windows.should be_a(RAutomation::Windows)
15
+ windows.size.should be >= 2
16
+ expected_windows = [
17
+ RAutomation::Window.new(:pid => @pid1),
18
+ RAutomation::Window.new(:pid => @pid2)
19
+ ]
20
+ should have_all_windows(expected_windows, windows)
21
+ end
22
+
23
+ it "Windows#windows returns all similar windows" do
24
+ windows = RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title]).windows
25
+ windows.should be_a(RAutomation::Windows)
26
+ windows.size.should == 1
27
+ expected_windows = [
28
+ RAutomation::Window.new(:pid => @pid1),
29
+ ]
30
+ should have_all_windows(expected_windows, windows)
31
+ end
32
+
33
+ it "Windows#windows with parameters returns all matching windows" do
34
+ windows = RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title]).windows(:title => SpecHelper::DATA[:window2_title])
35
+ windows.should be_a(RAutomation::Windows)
36
+
37
+ windows.size.should == 1
38
+ expected_windows = [
39
+ RAutomation::Window.new(:pid => @pid2),
40
+ ]
41
+ should have_all_windows(expected_windows, windows)
42
+ end
43
+
44
+ after :each do
45
+ Process.kill(9, @pid2) rescue nil
46
+ end
47
+
48
+ def has_all_windows?(expected_windows, windows)
49
+ expected_windows.all? do |expected_window|
50
+ matched_windows = windows.find_all {|win| win.hwnd == expected_window.hwnd}
51
+ matched_windows.size == 1
52
+ end
53
+ end
54
+
55
+ end
metadata ADDED
@@ -0,0 +1,207 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rdp-rautomation
3
+ version: !ruby/object:Gem::Version
4
+ hash: 113
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 6
9
+ - 3
10
+ - 1
11
+ version: 0.6.3.1
12
+ platform: ruby
13
+ authors:
14
+ - Jarmo Pertman
15
+ autorequire:
16
+ bindir: bin
17
+ cert_chain: []
18
+
19
+ date: 2011-08-18 00:00:00 Z
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rspec
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 5
30
+ segments:
31
+ - 2
32
+ - 3
33
+ version: "2.3"
34
+ type: :development
35
+ version_requirements: *id001
36
+ description: |-
37
+ RAutomation is a small and easy to use library for helping out to automate windows and their controls
38
+ for automated testing.
39
+
40
+ RAutomation provides:
41
+ * Easy to use and user-friendly API (inspired by Watir http://www.watir.com)
42
+ * Cross-platform compatibility
43
+ * Easy extensibility - with small scripting effort it's possible to add support for not yet
44
+ supported platforms or technologies
45
+ email: jarmo.p@gmail.com
46
+ executables: []
47
+
48
+ extensions: []
49
+
50
+ extra_rdoc_files:
51
+ - LICENSE
52
+ - README.rdoc
53
+ files:
54
+ - .document
55
+ - .rspec
56
+ - .yardopts
57
+ - History.rdoc
58
+ - LICENSE
59
+ - README.rdoc
60
+ - Rakefile
61
+ - VERSION
62
+ - ext/AutoItX/AutoItX.chm
63
+ - ext/AutoItX/AutoItX3.dll
64
+ - ext/IAccessibleDLL/IAccessibleDLL.sln
65
+ - ext/IAccessibleDLL/IAccessibleDLL.suo
66
+ - ext/IAccessibleDLL/IAccessibleDLL/IAccessibleDLL.cpp
67
+ - ext/IAccessibleDLL/IAccessibleDLL/IAccessibleDLL.vcxproj
68
+ - ext/IAccessibleDLL/IAccessibleDLL/IAccessibleDLL.vcxproj.filters
69
+ - ext/IAccessibleDLL/IAccessibleDLL/IAccessibleDLL.vcxproj.user
70
+ - ext/IAccessibleDLL/IAccessibleDLL/ReadMe.txt
71
+ - ext/IAccessibleDLL/IAccessibleDLL/dllmain.cpp
72
+ - ext/IAccessibleDLL/IAccessibleDLL/stdafx.cpp
73
+ - ext/IAccessibleDLL/IAccessibleDLL/stdafx.h
74
+ - ext/IAccessibleDLL/IAccessibleDLL/table_support.cpp
75
+ - ext/IAccessibleDLL/IAccessibleDLL/targetver.h
76
+ - ext/IAccessibleDLL/Release/IAccessibleDLL.dll
77
+ - ext/ListViewExplorer/ListViewExplorer.sln
78
+ - ext/ListViewExplorer/ListViewExplorer.suo
79
+ - ext/ListViewExplorer/ListViewExplorer/ListViewExplorer.cpp
80
+ - ext/ListViewExplorer/ListViewExplorer/ListViewExplorer.vcxproj
81
+ - ext/ListViewExplorer/ListViewExplorer/ListViewExplorer.vcxproj.filters
82
+ - ext/ListViewExplorer/ListViewExplorer/ListViewExplorer.vcxproj.user
83
+ - ext/ListViewExplorer/ListViewExplorer/ReadMe.txt
84
+ - ext/ListViewExplorer/ListViewExplorer/stdafx.cpp
85
+ - ext/ListViewExplorer/ListViewExplorer/stdafx.h
86
+ - ext/ListViewExplorer/ListViewExplorer/table_support.cpp
87
+ - ext/ListViewExplorer/ListViewExplorer/table_support.h
88
+ - ext/ListViewExplorer/ListViewExplorer/targetver.h
89
+ - ext/UiaDll/Release/UiaDll.dll
90
+ - ext/UiaDll/UiaDll.sln
91
+ - ext/UiaDll/UiaDll.suo
92
+ - ext/UiaDll/UiaDll/ReadMe.txt
93
+ - ext/UiaDll/UiaDll/UiaDll.cpp
94
+ - ext/UiaDll/UiaDll/UiaDll.vcxproj
95
+ - ext/UiaDll/UiaDll/UiaDll.vcxproj.filters
96
+ - ext/UiaDll/UiaDll/dllmain.cpp
97
+ - ext/UiaDll/UiaDll/globals.h
98
+ - ext/UiaDll/UiaDll/stdafx.cpp
99
+ - ext/UiaDll/UiaDll/stdafx.h
100
+ - ext/UiaDll/UiaDll/targetver.h
101
+ - ext/WindowsForms/bin/WindowsForms.exe
102
+ - ext/WindowsForms/src/WindowsForms/WindowsForms.sln
103
+ - ext/WindowsForms/src/WindowsForms/WindowsForms.suo
104
+ - ext/WindowsForms/src/WindowsForms/WindowsForms/AboutBox.Designer.cs
105
+ - ext/WindowsForms/src/WindowsForms/WindowsForms/AboutBox.cs
106
+ - ext/WindowsForms/src/WindowsForms/WindowsForms/AboutBox.resx
107
+ - ext/WindowsForms/src/WindowsForms/WindowsForms/DataEntryForm.Designer.cs
108
+ - ext/WindowsForms/src/WindowsForms/WindowsForms/DataEntryForm.cs
109
+ - ext/WindowsForms/src/WindowsForms/WindowsForms/DataEntryForm.resx
110
+ - ext/WindowsForms/src/WindowsForms/WindowsForms/MainFormWindow.Designer.cs
111
+ - ext/WindowsForms/src/WindowsForms/WindowsForms/MainFormWindow.cs
112
+ - ext/WindowsForms/src/WindowsForms/WindowsForms/MainFormWindow.resx
113
+ - ext/WindowsForms/src/WindowsForms/WindowsForms/PersonForm.Designer.cs
114
+ - ext/WindowsForms/src/WindowsForms/WindowsForms/PersonForm.cs
115
+ - ext/WindowsForms/src/WindowsForms/WindowsForms/PersonForm.resx
116
+ - ext/WindowsForms/src/WindowsForms/WindowsForms/Program.cs
117
+ - ext/WindowsForms/src/WindowsForms/WindowsForms/Properties/AssemblyInfo.cs
118
+ - ext/WindowsForms/src/WindowsForms/WindowsForms/Properties/Resources.Designer.cs
119
+ - ext/WindowsForms/src/WindowsForms/WindowsForms/Properties/Resources.resx
120
+ - ext/WindowsForms/src/WindowsForms/WindowsForms/Properties/Settings.Designer.cs
121
+ - ext/WindowsForms/src/WindowsForms/WindowsForms/Properties/Settings.settings
122
+ - ext/WindowsForms/src/WindowsForms/WindowsForms/SimpleElementsForm.Designer.cs
123
+ - ext/WindowsForms/src/WindowsForms/WindowsForms/SimpleElementsForm.cs
124
+ - ext/WindowsForms/src/WindowsForms/WindowsForms/SimpleElementsForm.resx
125
+ - ext/WindowsForms/src/WindowsForms/WindowsForms/WindowsForms.csproj
126
+ - ext/WindowsForms/src/WindowsForms/WindowsForms/bin/Release/WindowsForms.exe
127
+ - lib/rautomation.rb
128
+ - lib/rautomation/adapter/autoit.rb
129
+ - lib/rautomation/adapter/autoit/button.rb
130
+ - lib/rautomation/adapter/autoit/locators.rb
131
+ - lib/rautomation/adapter/autoit/text_field.rb
132
+ - lib/rautomation/adapter/autoit/window.rb
133
+ - lib/rautomation/adapter/helper.rb
134
+ - lib/rautomation/adapter/win_ffi.rb
135
+ - lib/rautomation/adapter/win_ffi/button.rb
136
+ - lib/rautomation/adapter/win_ffi/button_helper.rb
137
+ - lib/rautomation/adapter/win_ffi/checkbox.rb
138
+ - lib/rautomation/adapter/win_ffi/constants.rb
139
+ - lib/rautomation/adapter/win_ffi/control.rb
140
+ - lib/rautomation/adapter/win_ffi/functions.rb
141
+ - lib/rautomation/adapter/win_ffi/keystroke_converter.rb
142
+ - lib/rautomation/adapter/win_ffi/label.rb
143
+ - lib/rautomation/adapter/win_ffi/list_box.rb
144
+ - lib/rautomation/adapter/win_ffi/locators.rb
145
+ - lib/rautomation/adapter/win_ffi/ms_uia/uia_dll.rb
146
+ - lib/rautomation/adapter/win_ffi/radio.rb
147
+ - lib/rautomation/adapter/win_ffi/select_list.rb
148
+ - lib/rautomation/adapter/win_ffi/table.rb
149
+ - lib/rautomation/adapter/win_ffi/text_field.rb
150
+ - lib/rautomation/adapter/win_ffi/window.rb
151
+ - lib/rautomation/button.rb
152
+ - lib/rautomation/element_collections.rb
153
+ - lib/rautomation/text_field.rb
154
+ - lib/rautomation/wait_helper.rb
155
+ - lib/rautomation/window.rb
156
+ - spec/adapter/win_ffi/button_spec.rb
157
+ - spec/adapter/win_ffi/checkbox_spec.rb
158
+ - spec/adapter/win_ffi/keystroke_converter_spec.rb
159
+ - spec/adapter/win_ffi/label_spec.rb
160
+ - spec/adapter/win_ffi/listbox_spec.rb
161
+ - spec/adapter/win_ffi/radio_spec.rb
162
+ - spec/adapter/win_ffi/select_list_spec.rb
163
+ - spec/adapter/win_ffi/table_spec.rb
164
+ - spec/adapter/win_ffi/text_field_spec.rb
165
+ - spec/adapter/win_ffi/window_spec.rb
166
+ - spec/button_spec.rb
167
+ - spec/buttons_spec.rb
168
+ - spec/spec_helper.rb
169
+ - spec/text_field_spec.rb
170
+ - spec/text_fields_spec.rb
171
+ - spec/window_spec.rb
172
+ - spec/windows_spec.rb
173
+ homepage: http://github.com/jarmo/RAutomation
174
+ licenses: []
175
+
176
+ post_install_message:
177
+ rdoc_options: []
178
+
179
+ require_paths:
180
+ - lib
181
+ required_ruby_version: !ruby/object:Gem::Requirement
182
+ none: false
183
+ requirements:
184
+ - - ">="
185
+ - !ruby/object:Gem::Version
186
+ hash: 3
187
+ segments:
188
+ - 0
189
+ version: "0"
190
+ required_rubygems_version: !ruby/object:Gem::Requirement
191
+ none: false
192
+ requirements:
193
+ - - ">="
194
+ - !ruby/object:Gem::Version
195
+ hash: 3
196
+ segments:
197
+ - 0
198
+ version: "0"
199
+ requirements: []
200
+
201
+ rubyforge_project:
202
+ rubygems_version: 1.7.2
203
+ signing_key:
204
+ specification_version: 3
205
+ summary: Automate windows and their controls through user-friendly API with Ruby
206
+ test_files: []
207
+