rautomation 2.0.1-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (202) hide show
  1. checksums.yaml +7 -0
  2. data/.document +5 -0
  3. data/.gitignore +41 -0
  4. data/.rspec +2 -0
  5. data/.yardopts +8 -0
  6. data/CHANGES.md +276 -0
  7. data/Gemfile +3 -0
  8. data/LICENSE +20 -0
  9. data/README.md +142 -0
  10. data/Rakefile +73 -0
  11. data/ext/AutoItX/AutoItX.chm +0 -0
  12. data/ext/AutoItX/AutoItX3.dll +0 -0
  13. data/ext/IAccessibleDLL/IAccessibleDLL/IAccessibleDLL.cpp +30 -0
  14. data/ext/IAccessibleDLL/IAccessibleDLL/IAccessibleDLL.vcxproj +179 -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/IAccessibleDLL.sln +31 -0
  24. data/ext/IAccessibleDLL/IAccessibleDLL.suo +0 -0
  25. data/ext/IAccessibleDLL/Release/IAccessibleDLL.dll +0 -0
  26. data/ext/UiaDll/RAutomation.UIA/Controls/Clicker.cs +63 -0
  27. data/ext/UiaDll/RAutomation.UIA/Controls/SelectList.cs +116 -0
  28. data/ext/UiaDll/RAutomation.UIA/Controls/Spinner.cs +46 -0
  29. data/ext/UiaDll/RAutomation.UIA/Controls/TabControl.cs +54 -0
  30. data/ext/UiaDll/RAutomation.UIA/Controls/TableControl.cs +132 -0
  31. data/ext/UiaDll/RAutomation.UIA/Controls/TextControl.cs +50 -0
  32. data/ext/UiaDll/RAutomation.UIA/Expander.cs +59 -0
  33. data/ext/UiaDll/RAutomation.UIA/Extensions/Element.cs +166 -0
  34. data/ext/UiaDll/RAutomation.UIA/Extensions/Enumerable.cs +76 -0
  35. data/ext/UiaDll/RAutomation.UIA/Extensions/Property.cs +27 -0
  36. data/ext/UiaDll/RAutomation.UIA/Properties/AssemblyInfo.cs +36 -0
  37. data/ext/UiaDll/RAutomation.UIA/Properties/AutomationProperties.cs +18 -0
  38. data/ext/UiaDll/RAutomation.UIA/RAutomation.UIA.csproj +77 -0
  39. data/ext/UiaDll/Release/RAutomation.UIA.dll +0 -0
  40. data/ext/UiaDll/Release/UiaDll.dll +0 -0
  41. data/ext/UiaDll/UiaDll/ArrayHelper.cpp +14 -0
  42. data/ext/UiaDll/UiaDll/ArrayHelper.h +7 -0
  43. data/ext/UiaDll/UiaDll/AssemblyInfo.cpp +40 -0
  44. data/ext/UiaDll/UiaDll/ControlMethods.cpp +16 -0
  45. data/ext/UiaDll/UiaDll/DynamicAssemblyResolver.cpp +24 -0
  46. data/ext/UiaDll/UiaDll/DynamicAssemblyResolver.h +16 -0
  47. data/ext/UiaDll/UiaDll/Locator.cpp +93 -0
  48. data/ext/UiaDll/UiaDll/Locator.h +55 -0
  49. data/ext/UiaDll/UiaDll/MenuItemSelector.cpp +75 -0
  50. data/ext/UiaDll/UiaDll/MenuItemSelector.h +24 -0
  51. data/ext/UiaDll/UiaDll/MenuMethods.cpp +62 -0
  52. data/ext/UiaDll/UiaDll/ReadMe.txt +38 -0
  53. data/ext/UiaDll/UiaDll/SelectListMethods.cpp +84 -0
  54. data/ext/UiaDll/UiaDll/SpinnerMethods.cpp +61 -0
  55. data/ext/UiaDll/UiaDll/StringHelper.cpp +57 -0
  56. data/ext/UiaDll/UiaDll/StringHelper.h +15 -0
  57. data/ext/UiaDll/UiaDll/StringMethods.cpp +8 -0
  58. data/ext/UiaDll/UiaDll/TabControlMethods.cpp +40 -0
  59. data/ext/UiaDll/UiaDll/TableMethods.cpp +108 -0
  60. data/ext/UiaDll/UiaDll/TextMethods.cpp +25 -0
  61. data/ext/UiaDll/UiaDll/ToggleStateHelper.h +10 -0
  62. data/ext/UiaDll/UiaDll/UiaDll.cpp +216 -0
  63. data/ext/UiaDll/UiaDll/UiaDll.h +13 -0
  64. data/ext/UiaDll/UiaDll/UiaDll.vcxproj +167 -0
  65. data/ext/UiaDll/UiaDll/UiaDll.vcxproj.filters +110 -0
  66. data/ext/UiaDll/UiaDll/app.ico +0 -0
  67. data/ext/UiaDll/UiaDll/app.rc +0 -0
  68. data/ext/UiaDll/UiaDll/dllmain.cpp +1 -0
  69. data/ext/UiaDll/UiaDll/resource.h +3 -0
  70. data/ext/UiaDll/UiaDll/stdafx.cpp +5 -0
  71. data/ext/UiaDll/UiaDll/stdafx.h +41 -0
  72. data/ext/UiaDll/UiaDll/targetver.h +8 -0
  73. data/ext/UiaDll/UiaDll.sln +57 -0
  74. data/ext/WindowsForms/.nuget/NuGet.Config +6 -0
  75. data/ext/WindowsForms/.nuget/NuGet.exe +0 -0
  76. data/ext/WindowsForms/.nuget/NuGet.targets +136 -0
  77. data/ext/WindowsForms/Release/FizzWare.NBuilder.dll +0 -0
  78. data/ext/WindowsForms/Release/UIA.Extensions.dll +0 -0
  79. data/ext/WindowsForms/Release/WindowsForms.exe +0 -0
  80. data/ext/WindowsForms/WindowsForms/AboutBox.Designer.cs +168 -0
  81. data/ext/WindowsForms/WindowsForms/AboutBox.cs +103 -0
  82. data/ext/WindowsForms/WindowsForms/AboutBox.resx +123 -0
  83. data/ext/WindowsForms/WindowsForms/DataEntryForm.Designer.cs +218 -0
  84. data/ext/WindowsForms/WindowsForms/DataEntryForm.cs +52 -0
  85. data/ext/WindowsForms/WindowsForms/DataEntryForm.resx +120 -0
  86. data/ext/WindowsForms/WindowsForms/DataGridView.Designer.cs +77 -0
  87. data/ext/WindowsForms/WindowsForms/DataGridView.cs +43 -0
  88. data/ext/WindowsForms/WindowsForms/DataGridView.resx +120 -0
  89. data/ext/WindowsForms/WindowsForms/FizzWare.NBuilder.dll +0 -0
  90. data/ext/WindowsForms/WindowsForms/MainFormWindow.Designer.cs +527 -0
  91. data/ext/WindowsForms/WindowsForms/MainFormWindow.cs +109 -0
  92. data/ext/WindowsForms/WindowsForms/MainFormWindow.resx +126 -0
  93. data/ext/WindowsForms/WindowsForms/PersonForm.Designer.cs +119 -0
  94. data/ext/WindowsForms/WindowsForms/PersonForm.cs +34 -0
  95. data/ext/WindowsForms/WindowsForms/PersonForm.resx +120 -0
  96. data/ext/WindowsForms/WindowsForms/Program.cs +21 -0
  97. data/ext/WindowsForms/WindowsForms/Properties/AssemblyInfo.cs +36 -0
  98. data/ext/WindowsForms/WindowsForms/Properties/Resources.Designer.cs +71 -0
  99. data/ext/WindowsForms/WindowsForms/Properties/Resources.resx +117 -0
  100. data/ext/WindowsForms/WindowsForms/Properties/Settings.Designer.cs +30 -0
  101. data/ext/WindowsForms/WindowsForms/Properties/Settings.settings +7 -0
  102. data/ext/WindowsForms/WindowsForms/SimpleElementsForm.Designer.cs +93 -0
  103. data/ext/WindowsForms/WindowsForms/SimpleElementsForm.cs +19 -0
  104. data/ext/WindowsForms/WindowsForms/SimpleElementsForm.resx +120 -0
  105. data/ext/WindowsForms/WindowsForms/UIA.Extensions.dll +0 -0
  106. data/ext/WindowsForms/WindowsForms/ValueMonthCalendar.cs +28 -0
  107. data/ext/WindowsForms/WindowsForms/WindowsForms.csproj +166 -0
  108. data/ext/WindowsForms/WindowsForms/packages.config +4 -0
  109. data/ext/WindowsForms/WindowsForms.sln +46 -0
  110. data/lib/rautomation/adapter/autoit/button.rb +59 -0
  111. data/lib/rautomation/adapter/autoit/locators.rb +22 -0
  112. data/lib/rautomation/adapter/autoit/mouse.rb +38 -0
  113. data/lib/rautomation/adapter/autoit/text_field.rb +70 -0
  114. data/lib/rautomation/adapter/autoit/window.rb +197 -0
  115. data/lib/rautomation/adapter/autoit.rb +8 -0
  116. data/lib/rautomation/adapter/helper.rb +64 -0
  117. data/lib/rautomation/adapter/ms_uia/button.rb +21 -0
  118. data/lib/rautomation/adapter/ms_uia/button_helper.rb +19 -0
  119. data/lib/rautomation/adapter/ms_uia/checkbox.rb +23 -0
  120. data/lib/rautomation/adapter/ms_uia/constants.rb +111 -0
  121. data/lib/rautomation/adapter/ms_uia/control.rb +134 -0
  122. data/lib/rautomation/adapter/ms_uia/functions.rb +279 -0
  123. data/lib/rautomation/adapter/ms_uia/keys.rb +121 -0
  124. data/lib/rautomation/adapter/ms_uia/keystroke_converter.rb +122 -0
  125. data/lib/rautomation/adapter/ms_uia/label.rb +18 -0
  126. data/lib/rautomation/adapter/ms_uia/list_box.rb +46 -0
  127. data/lib/rautomation/adapter/ms_uia/list_item.rb +22 -0
  128. data/lib/rautomation/adapter/ms_uia/locators.rb +23 -0
  129. data/lib/rautomation/adapter/ms_uia/menu.rb +36 -0
  130. data/lib/rautomation/adapter/ms_uia/radio.rb +23 -0
  131. data/lib/rautomation/adapter/ms_uia/select_list.rb +85 -0
  132. data/lib/rautomation/adapter/ms_uia/spinner.rb +31 -0
  133. data/lib/rautomation/adapter/ms_uia/tab_control.rb +46 -0
  134. data/lib/rautomation/adapter/ms_uia/table.rb +140 -0
  135. data/lib/rautomation/adapter/ms_uia/text_field.rb +39 -0
  136. data/lib/rautomation/adapter/ms_uia/uia_dll.rb +428 -0
  137. data/lib/rautomation/adapter/ms_uia/value_control.rb +21 -0
  138. data/lib/rautomation/adapter/ms_uia/window.rb +289 -0
  139. data/lib/rautomation/adapter/ms_uia.rb +27 -0
  140. data/lib/rautomation/adapter/win_32/button.rb +14 -0
  141. data/lib/rautomation/adapter/win_32/button_helper.rb +24 -0
  142. data/lib/rautomation/adapter/win_32/checkbox.rb +14 -0
  143. data/lib/rautomation/adapter/win_32/constants.rb +73 -0
  144. data/lib/rautomation/adapter/win_32/control.rb +86 -0
  145. data/lib/rautomation/adapter/win_32/functions.rb +336 -0
  146. data/lib/rautomation/adapter/win_32/keys.rb +146 -0
  147. data/lib/rautomation/adapter/win_32/label.rb +10 -0
  148. data/lib/rautomation/adapter/win_32/list_box.rb +40 -0
  149. data/lib/rautomation/adapter/win_32/locators.rb +22 -0
  150. data/lib/rautomation/adapter/win_32/mouse.rb +59 -0
  151. data/lib/rautomation/adapter/win_32/password_field.rb +15 -0
  152. data/lib/rautomation/adapter/win_32/radio.rb +11 -0
  153. data/lib/rautomation/adapter/win_32/select_list.rb +97 -0
  154. data/lib/rautomation/adapter/win_32/table.rb +25 -0
  155. data/lib/rautomation/adapter/win_32/text_field.rb +52 -0
  156. data/lib/rautomation/adapter/win_32/window.rb +277 -0
  157. data/lib/rautomation/adapter/win_32.rb +23 -0
  158. data/lib/rautomation/button.rb +55 -0
  159. data/lib/rautomation/element_collections.rb +55 -0
  160. data/lib/rautomation/platform.rb +15 -0
  161. data/lib/rautomation/text_field.rb +60 -0
  162. data/lib/rautomation/version.rb +3 -0
  163. data/lib/rautomation/wait_helper.rb +23 -0
  164. data/lib/rautomation/window.rb +248 -0
  165. data/lib/rautomation.rb +8 -0
  166. data/rautomation.gemspec +52 -0
  167. data/spec/adapter/autoit/mouse_spec.rb +53 -0
  168. data/spec/adapter/autoit/window_spec.rb +17 -0
  169. data/spec/adapter/ms_uia/button_spec.rb +39 -0
  170. data/spec/adapter/ms_uia/checkbox_spec.rb +55 -0
  171. data/spec/adapter/ms_uia/control_spec.rb +88 -0
  172. data/spec/adapter/ms_uia/functions_spec.rb +39 -0
  173. data/spec/adapter/ms_uia/keystroke_converter_spec.rb +48 -0
  174. data/spec/adapter/ms_uia/label_spec.rb +18 -0
  175. data/spec/adapter/ms_uia/list_item_spec.rb +14 -0
  176. data/spec/adapter/ms_uia/listbox_spec.rb +73 -0
  177. data/spec/adapter/ms_uia/radio_spec.rb +39 -0
  178. data/spec/adapter/ms_uia/select_list_spec.rb +118 -0
  179. data/spec/adapter/ms_uia/spinner_spec.rb +44 -0
  180. data/spec/adapter/ms_uia/tab_control_spec.rb +53 -0
  181. data/spec/adapter/ms_uia/table_spec.rb +197 -0
  182. data/spec/adapter/ms_uia/text_field_spec.rb +43 -0
  183. data/spec/adapter/ms_uia/value_control_spec.rb +11 -0
  184. data/spec/adapter/ms_uia/window_spec.rb +81 -0
  185. data/spec/adapter/win_32/button_spec.rb +31 -0
  186. data/spec/adapter/win_32/checkbox_spec.rb +46 -0
  187. data/spec/adapter/win_32/label_spec.rb +13 -0
  188. data/spec/adapter/win_32/listbox_spec.rb +41 -0
  189. data/spec/adapter/win_32/mouse_spec.rb +49 -0
  190. data/spec/adapter/win_32/radio_spec.rb +33 -0
  191. data/spec/adapter/win_32/select_list_spec.rb +65 -0
  192. data/spec/adapter/win_32/table_spec.rb +27 -0
  193. data/spec/adapter/win_32/text_field_spec.rb +24 -0
  194. data/spec/adapter/win_32/window_spec.rb +61 -0
  195. data/spec/button_spec.rb +67 -0
  196. data/spec/buttons_spec.rb +21 -0
  197. data/spec/spec_helper.rb +128 -0
  198. data/spec/text_field_spec.rb +64 -0
  199. data/spec/text_fields_spec.rb +22 -0
  200. data/spec/window_spec.rb +150 -0
  201. data/spec/windows_spec.rb +76 -0
  202. metadata +369 -0
@@ -0,0 +1,150 @@
1
+ require 'spec_helper'
2
+
3
+ describe RAutomation::Window do
4
+ it ".adapter" do
5
+ expect(RAutomation::Window.new(title: "random").adapter)
6
+ .to be == (ENV["RAUTOMATION_ADAPTER"] && ENV["RAUTOMATION_ADAPTER"].to_sym || RAutomation::Adapter::Helper.default_adapter)
7
+ end
8
+
9
+ it "#new by full title" do
10
+ expect(RAutomation::Window.new(title: SpecHelper::DATA[:window1_full_title]).exist?).to be true
11
+ end
12
+
13
+ it "#new by regexp title" do
14
+ expect(RAutomation::Window.new(title: SpecHelper::DATA[:window1_title]).exist?).to be true
15
+ end
16
+
17
+ it "#new by hwnd" do
18
+ hwnd = RAutomation::Window.new(title: SpecHelper::DATA[:window1_full_title]).hwnd
19
+ window = RAutomation::Window.new(hwnd: hwnd)
20
+ expect(window.exist?).to be true
21
+ expect(window.title).to be == SpecHelper::DATA[:window1_full_title]
22
+ end
23
+
24
+ it "#exists?" do
25
+ expect(RAutomation::Window.new(title: SpecHelper::DATA[:window1_title]).exist?).to be true
26
+ expect(RAutomation::Window.new(title: "non-existing-window").exist?).to_not be true
27
+ end
28
+
29
+ it "#visible?"do
30
+ expect(RAutomation::Window.new(title: SpecHelper::DATA[:window1_title]).visible?).to be true
31
+ RAutomation::Window.wait_timeout = 0.1
32
+ expect {RAutomation::Window.new(title: "non-existing-window").visible?}.
33
+ to raise_exception(RAutomation::UnknownWindowException)
34
+ end
35
+
36
+ it "#present?"do
37
+ expect(RAutomation::Window.new(title: SpecHelper::DATA[:window1_title]).present?).to be true
38
+ expect(RAutomation::Window.new(title: "non-existing-window").present?).to_not be true
39
+ end
40
+
41
+ it "#hwnd" do
42
+ expect(RAutomation::Window.new(title: SpecHelper::DATA[:window1_title]).hwnd).to be_a(Integer)
43
+ RAutomation::Window.wait_timeout = 0.1
44
+ expect {RAutomation::Window.new(title: "non-existing-window").hwnd}.
45
+ to raise_exception(RAutomation::UnknownWindowException)
46
+ end
47
+
48
+ it "#title" do
49
+ expect(RAutomation::Window.new(title: SpecHelper::DATA[:window1_title]).title).to be == SpecHelper::DATA[:window1_full_title]
50
+ RAutomation::Window.wait_timeout = 0.1
51
+ expect {RAutomation::Window.new(title: "non-existing-window").title}.
52
+ to raise_exception(RAutomation::UnknownWindowException)
53
+ end
54
+
55
+ it "#class_names" do
56
+ window = RAutomation::Window.new(title: SpecHelper::DATA[:window1_title])
57
+
58
+ fail "Expected class name not found." unless window.class_names.any? {|clazz| clazz.match(/WindowsForms10\.Window\.8\.app\.0\.\S+_r\d+_ad1/)}
59
+
60
+ RAutomation::Window.wait_timeout = 0.1
61
+ expect {RAutomation::Window.new(title: "non-existing-window").class_names}.
62
+ to raise_exception(RAutomation::UnknownWindowException)
63
+ end
64
+
65
+ it "#activate & #active?" do
66
+ window = RAutomation::Window.new(title: SpecHelper::DATA[:window1_title])
67
+ window.activate
68
+ expect(window.active?).to be true
69
+ non_existing_window = RAutomation::Window.new(title: "non-existing-window")
70
+ non_existing_window.activate
71
+ expect(non_existing_window.active?).to_not be true
72
+ end
73
+
74
+ it "#text" do
75
+ expect(RAutomation::Window.new(title: SpecHelper::DATA[:window1_title]).text).to include(SpecHelper::DATA[:window1_text])
76
+ RAutomation::Window.wait_timeout = 0.1
77
+ expect {RAutomation::Window.new(title: "non-existing-window").text}.
78
+ to raise_exception(RAutomation::UnknownWindowException)
79
+ end
80
+
81
+ it "#maximize" do
82
+ RAutomation::Window.new(title: SpecHelper::DATA[:window1_title]).maximize
83
+ RAutomation::Window.wait_timeout = 0.1
84
+ expect {RAutomation::Window.new(title: "non-existing-window").maximize}.
85
+ to raise_exception(RAutomation::UnknownWindowException)
86
+ end
87
+
88
+ it "#minimize & #minimized?" do
89
+ window = RAutomation::Window.new(title: SpecHelper::DATA[:window1_title])
90
+ expect(window.minimized?).to_not be true
91
+ window.minimize
92
+ expect(window.minimized?).to be true
93
+
94
+ RAutomation::Window.wait_timeout = 0.1
95
+ expect {RAutomation::Window.new(title: "non-existing-window").minimize}.
96
+ to raise_exception(RAutomation::UnknownWindowException)
97
+ expect {RAutomation::Window.new(title: "non-existing-window").minimized?}.
98
+ to raise_exception(RAutomation::UnknownWindowException)
99
+ end
100
+
101
+ it "#restore" do
102
+ RAutomation::Window.new(title: SpecHelper::DATA[:window1_title]).restore
103
+ RAutomation::Window.wait_timeout = 0.1
104
+ expect {RAutomation::Window.new(title: "non-existing-window").restore}.
105
+ to raise_exception(RAutomation::UnknownWindowException)
106
+ end
107
+
108
+ it "#method_missing" do
109
+ win = RAutomation::Window.new(title: SpecHelper::DATA[:window1_title])
110
+ expect(SpecHelper::DATA[:title_proc].call(win)).to be == SpecHelper::DATA[:window1_full_title]
111
+ end
112
+
113
+ it "#send_keys"do
114
+ window = RAutomation::Window.new(title: SpecHelper::DATA[:window1_title])
115
+ window.minimize # send_keys should work even if window is minimized
116
+ window.send_keys(SpecHelper::DATA[:window1_send_keys])
117
+ SpecHelper::DATA[:proc_after_send_keys].call
118
+
119
+ RAutomation::Window.wait_timeout = 0.1
120
+ expect {RAutomation::Window.new(title: "non-existing-window").send_keys("123")}.
121
+ to raise_exception(RAutomation::UnknownWindowException)
122
+ end
123
+
124
+ it "#close" do
125
+ window = RAutomation::Window.new(title: SpecHelper::DATA[:window1_title])
126
+ expect(window.exist?).to be true
127
+ window.close
128
+ expect(window.exist?).to_not be true
129
+
130
+ expect {RAutomation::Window.new(title: "non-existing-window").close}.
131
+ to_not raise_exception
132
+ end
133
+
134
+ context '#child', if: [:win_32, :ms_uia].include?(SpecHelper.adapter) do
135
+ let(:window) { RAutomation::Window.new(title: SpecHelper::DATA[:window1_full_title]) }
136
+
137
+ it 'immediate children' do
138
+ # buttons are windows too. so let's find the button for now
139
+ child = window.child(title: '&About')
140
+ expect(child.exist?).to be true
141
+ expect(child.title).to be == "&About"
142
+ expect(child.adapter).to be == SpecHelper.adapter
143
+ end
144
+
145
+ it 'popups' do
146
+ window.button(title: '&About').click { true }
147
+ expect(window.child(title: 'About').visible?).to be true
148
+ end
149
+ end
150
+ end
@@ -0,0 +1,76 @@
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
+ expect(windows).to be_a(RAutomation::Windows)
15
+ expect(windows.size).to be >= 2
16
+ expected_windows = [
17
+ RAutomation::Window.new(pid: @pid1),
18
+ RAutomation::Window.new(pid: @pid2)
19
+ ]
20
+ expect(has_all_windows?(expected_windows, windows)).to be true
21
+ end
22
+
23
+ it "Window.windows accepts locators too" do
24
+ windows = RAutomation::Window.windows(title: SpecHelper::DATA[:window1_title])
25
+ expect(windows).to be_a(RAutomation::Windows)
26
+ expect(windows.size) == 1
27
+ expected_windows = [
28
+ RAutomation::Window.new(pid: @pid1),
29
+ ]
30
+ expect(has_all_windows?(expected_windows, windows)).to be true
31
+ end
32
+
33
+ it "Windows#windows returns all similar windows" do
34
+ windows = RAutomation::Window.new(title: SpecHelper::DATA[:window1_title]).windows
35
+ expect(windows).to be_a(RAutomation::Windows)
36
+ expect(windows.size).to be == 1
37
+ expected_windows = [
38
+ RAutomation::Window.new(pid: @pid1),
39
+ ]
40
+ expect(has_all_windows?(expected_windows, windows)).to be true
41
+ end
42
+
43
+ it "Windows#windows with parameters returns all matching windows" do
44
+ windows = RAutomation::Window.new(title: SpecHelper::DATA[:window1_title])
45
+ .windows(title: SpecHelper::DATA[:window2_title])
46
+ expect(windows).to be_a(RAutomation::Windows)
47
+
48
+ expect(windows.size).to eq(1), "expected to have 1 window, but got #{windows.size} with the following titles:#{$/}#{windows.map(&:title).join($/)}"
49
+ expected_windows = [
50
+ RAutomation::Window.new(pid: @pid2),
51
+ ]
52
+
53
+ expect(has_all_windows?(expected_windows, windows)).to be true
54
+ end
55
+
56
+ it "Window.windows doesn't allow :hwnd or :pid as it's locators" do
57
+ RAutomation::Window.wait_timeout = 0.1
58
+ expect { RAutomation::Window.windows(hwnd: 123) }.
59
+ to raise_exception(RAutomation::ElementCollections::UnsupportedLocatorException)
60
+
61
+ expect { RAutomation::Window.windows(pid: 123) }.
62
+ to raise_exception(RAutomation::ElementCollections::UnsupportedLocatorException)
63
+ end
64
+
65
+ after :each do
66
+ Process.kill(9, @pid2) rescue nil
67
+ end
68
+
69
+ def has_all_windows?(expected_windows, windows)
70
+ expected_windows.all? do |expected_window|
71
+ matched_windows = windows.find_all {|win| win.hwnd == expected_window.hwnd}
72
+ matched_windows.size == 1
73
+ end
74
+ end
75
+
76
+ end
metadata ADDED
@@ -0,0 +1,369 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rautomation
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.1
5
+ platform: x64-mingw32
6
+ authors:
7
+ - Jarmo Pertman
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-03-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ffi
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.15.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 1.15.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.9'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.9'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.5'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.5'
55
+ - !ruby/object:Gem::Dependency
56
+ name: yard
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.9'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.9'
69
+ - !ruby/object:Gem::Dependency
70
+ name: redcarpet
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.5'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.5'
83
+ - !ruby/object:Gem::Dependency
84
+ name: github-markup
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.0'
97
+ description: |-
98
+ RAutomation is a small and easy to use library for helping out to automate windows and their controls
99
+ for automated testing.
100
+
101
+ RAutomation provides:
102
+ * Easy to use and user-friendly API (inspired by Watir http://www.watir.com)
103
+ * Cross-platform compatibility
104
+ * Easy extensibility - with small scripting effort it's possible to add support for not yet
105
+ supported platforms or technologies
106
+ email: jarmo.p@gmail.com
107
+ executables: []
108
+ extensions: []
109
+ extra_rdoc_files: []
110
+ files:
111
+ - ".document"
112
+ - ".gitignore"
113
+ - ".rspec"
114
+ - ".yardopts"
115
+ - CHANGES.md
116
+ - Gemfile
117
+ - LICENSE
118
+ - README.md
119
+ - Rakefile
120
+ - ext/AutoItX/AutoItX.chm
121
+ - ext/AutoItX/AutoItX3.dll
122
+ - ext/IAccessibleDLL/IAccessibleDLL.sln
123
+ - ext/IAccessibleDLL/IAccessibleDLL.suo
124
+ - ext/IAccessibleDLL/IAccessibleDLL/IAccessibleDLL.cpp
125
+ - ext/IAccessibleDLL/IAccessibleDLL/IAccessibleDLL.vcxproj
126
+ - ext/IAccessibleDLL/IAccessibleDLL/IAccessibleDLL.vcxproj.filters
127
+ - ext/IAccessibleDLL/IAccessibleDLL/IAccessibleDLL.vcxproj.user
128
+ - ext/IAccessibleDLL/IAccessibleDLL/ReadMe.txt
129
+ - ext/IAccessibleDLL/IAccessibleDLL/dllmain.cpp
130
+ - ext/IAccessibleDLL/IAccessibleDLL/stdafx.cpp
131
+ - ext/IAccessibleDLL/IAccessibleDLL/stdafx.h
132
+ - ext/IAccessibleDLL/IAccessibleDLL/table_support.cpp
133
+ - ext/IAccessibleDLL/IAccessibleDLL/targetver.h
134
+ - ext/IAccessibleDLL/Release/IAccessibleDLL.dll
135
+ - ext/UiaDll/RAutomation.UIA/Controls/Clicker.cs
136
+ - ext/UiaDll/RAutomation.UIA/Controls/SelectList.cs
137
+ - ext/UiaDll/RAutomation.UIA/Controls/Spinner.cs
138
+ - ext/UiaDll/RAutomation.UIA/Controls/TabControl.cs
139
+ - ext/UiaDll/RAutomation.UIA/Controls/TableControl.cs
140
+ - ext/UiaDll/RAutomation.UIA/Controls/TextControl.cs
141
+ - ext/UiaDll/RAutomation.UIA/Expander.cs
142
+ - ext/UiaDll/RAutomation.UIA/Extensions/Element.cs
143
+ - ext/UiaDll/RAutomation.UIA/Extensions/Enumerable.cs
144
+ - ext/UiaDll/RAutomation.UIA/Extensions/Property.cs
145
+ - ext/UiaDll/RAutomation.UIA/Properties/AssemblyInfo.cs
146
+ - ext/UiaDll/RAutomation.UIA/Properties/AutomationProperties.cs
147
+ - ext/UiaDll/RAutomation.UIA/RAutomation.UIA.csproj
148
+ - ext/UiaDll/Release/RAutomation.UIA.dll
149
+ - ext/UiaDll/Release/UiaDll.dll
150
+ - ext/UiaDll/UiaDll.sln
151
+ - ext/UiaDll/UiaDll/ArrayHelper.cpp
152
+ - ext/UiaDll/UiaDll/ArrayHelper.h
153
+ - ext/UiaDll/UiaDll/AssemblyInfo.cpp
154
+ - ext/UiaDll/UiaDll/ControlMethods.cpp
155
+ - ext/UiaDll/UiaDll/DynamicAssemblyResolver.cpp
156
+ - ext/UiaDll/UiaDll/DynamicAssemblyResolver.h
157
+ - ext/UiaDll/UiaDll/Locator.cpp
158
+ - ext/UiaDll/UiaDll/Locator.h
159
+ - ext/UiaDll/UiaDll/MenuItemSelector.cpp
160
+ - ext/UiaDll/UiaDll/MenuItemSelector.h
161
+ - ext/UiaDll/UiaDll/MenuMethods.cpp
162
+ - ext/UiaDll/UiaDll/ReadMe.txt
163
+ - ext/UiaDll/UiaDll/SelectListMethods.cpp
164
+ - ext/UiaDll/UiaDll/SpinnerMethods.cpp
165
+ - ext/UiaDll/UiaDll/StringHelper.cpp
166
+ - ext/UiaDll/UiaDll/StringHelper.h
167
+ - ext/UiaDll/UiaDll/StringMethods.cpp
168
+ - ext/UiaDll/UiaDll/TabControlMethods.cpp
169
+ - ext/UiaDll/UiaDll/TableMethods.cpp
170
+ - ext/UiaDll/UiaDll/TextMethods.cpp
171
+ - ext/UiaDll/UiaDll/ToggleStateHelper.h
172
+ - ext/UiaDll/UiaDll/UiaDll.cpp
173
+ - ext/UiaDll/UiaDll/UiaDll.h
174
+ - ext/UiaDll/UiaDll/UiaDll.vcxproj
175
+ - ext/UiaDll/UiaDll/UiaDll.vcxproj.filters
176
+ - ext/UiaDll/UiaDll/app.ico
177
+ - ext/UiaDll/UiaDll/app.rc
178
+ - ext/UiaDll/UiaDll/dllmain.cpp
179
+ - ext/UiaDll/UiaDll/resource.h
180
+ - ext/UiaDll/UiaDll/stdafx.cpp
181
+ - ext/UiaDll/UiaDll/stdafx.h
182
+ - ext/UiaDll/UiaDll/targetver.h
183
+ - ext/WindowsForms/.nuget/NuGet.Config
184
+ - ext/WindowsForms/.nuget/NuGet.exe
185
+ - ext/WindowsForms/.nuget/NuGet.targets
186
+ - ext/WindowsForms/Release/FizzWare.NBuilder.dll
187
+ - ext/WindowsForms/Release/UIA.Extensions.dll
188
+ - ext/WindowsForms/Release/WindowsForms.exe
189
+ - ext/WindowsForms/WindowsForms.sln
190
+ - ext/WindowsForms/WindowsForms/AboutBox.Designer.cs
191
+ - ext/WindowsForms/WindowsForms/AboutBox.cs
192
+ - ext/WindowsForms/WindowsForms/AboutBox.resx
193
+ - ext/WindowsForms/WindowsForms/DataEntryForm.Designer.cs
194
+ - ext/WindowsForms/WindowsForms/DataEntryForm.cs
195
+ - ext/WindowsForms/WindowsForms/DataEntryForm.resx
196
+ - ext/WindowsForms/WindowsForms/DataGridView.Designer.cs
197
+ - ext/WindowsForms/WindowsForms/DataGridView.cs
198
+ - ext/WindowsForms/WindowsForms/DataGridView.resx
199
+ - ext/WindowsForms/WindowsForms/FizzWare.NBuilder.dll
200
+ - ext/WindowsForms/WindowsForms/MainFormWindow.Designer.cs
201
+ - ext/WindowsForms/WindowsForms/MainFormWindow.cs
202
+ - ext/WindowsForms/WindowsForms/MainFormWindow.resx
203
+ - ext/WindowsForms/WindowsForms/PersonForm.Designer.cs
204
+ - ext/WindowsForms/WindowsForms/PersonForm.cs
205
+ - ext/WindowsForms/WindowsForms/PersonForm.resx
206
+ - ext/WindowsForms/WindowsForms/Program.cs
207
+ - ext/WindowsForms/WindowsForms/Properties/AssemblyInfo.cs
208
+ - ext/WindowsForms/WindowsForms/Properties/Resources.Designer.cs
209
+ - ext/WindowsForms/WindowsForms/Properties/Resources.resx
210
+ - ext/WindowsForms/WindowsForms/Properties/Settings.Designer.cs
211
+ - ext/WindowsForms/WindowsForms/Properties/Settings.settings
212
+ - ext/WindowsForms/WindowsForms/SimpleElementsForm.Designer.cs
213
+ - ext/WindowsForms/WindowsForms/SimpleElementsForm.cs
214
+ - ext/WindowsForms/WindowsForms/SimpleElementsForm.resx
215
+ - ext/WindowsForms/WindowsForms/UIA.Extensions.dll
216
+ - ext/WindowsForms/WindowsForms/ValueMonthCalendar.cs
217
+ - ext/WindowsForms/WindowsForms/WindowsForms.csproj
218
+ - ext/WindowsForms/WindowsForms/packages.config
219
+ - lib/rautomation.rb
220
+ - lib/rautomation/adapter/autoit.rb
221
+ - lib/rautomation/adapter/autoit/button.rb
222
+ - lib/rautomation/adapter/autoit/locators.rb
223
+ - lib/rautomation/adapter/autoit/mouse.rb
224
+ - lib/rautomation/adapter/autoit/text_field.rb
225
+ - lib/rautomation/adapter/autoit/window.rb
226
+ - lib/rautomation/adapter/helper.rb
227
+ - lib/rautomation/adapter/ms_uia.rb
228
+ - lib/rautomation/adapter/ms_uia/button.rb
229
+ - lib/rautomation/adapter/ms_uia/button_helper.rb
230
+ - lib/rautomation/adapter/ms_uia/checkbox.rb
231
+ - lib/rautomation/adapter/ms_uia/constants.rb
232
+ - lib/rautomation/adapter/ms_uia/control.rb
233
+ - lib/rautomation/adapter/ms_uia/functions.rb
234
+ - lib/rautomation/adapter/ms_uia/keys.rb
235
+ - lib/rautomation/adapter/ms_uia/keystroke_converter.rb
236
+ - lib/rautomation/adapter/ms_uia/label.rb
237
+ - lib/rautomation/adapter/ms_uia/list_box.rb
238
+ - lib/rautomation/adapter/ms_uia/list_item.rb
239
+ - lib/rautomation/adapter/ms_uia/locators.rb
240
+ - lib/rautomation/adapter/ms_uia/menu.rb
241
+ - lib/rautomation/adapter/ms_uia/radio.rb
242
+ - lib/rautomation/adapter/ms_uia/select_list.rb
243
+ - lib/rautomation/adapter/ms_uia/spinner.rb
244
+ - lib/rautomation/adapter/ms_uia/tab_control.rb
245
+ - lib/rautomation/adapter/ms_uia/table.rb
246
+ - lib/rautomation/adapter/ms_uia/text_field.rb
247
+ - lib/rautomation/adapter/ms_uia/uia_dll.rb
248
+ - lib/rautomation/adapter/ms_uia/value_control.rb
249
+ - lib/rautomation/adapter/ms_uia/window.rb
250
+ - lib/rautomation/adapter/win_32.rb
251
+ - lib/rautomation/adapter/win_32/button.rb
252
+ - lib/rautomation/adapter/win_32/button_helper.rb
253
+ - lib/rautomation/adapter/win_32/checkbox.rb
254
+ - lib/rautomation/adapter/win_32/constants.rb
255
+ - lib/rautomation/adapter/win_32/control.rb
256
+ - lib/rautomation/adapter/win_32/functions.rb
257
+ - lib/rautomation/adapter/win_32/keys.rb
258
+ - lib/rautomation/adapter/win_32/label.rb
259
+ - lib/rautomation/adapter/win_32/list_box.rb
260
+ - lib/rautomation/adapter/win_32/locators.rb
261
+ - lib/rautomation/adapter/win_32/mouse.rb
262
+ - lib/rautomation/adapter/win_32/password_field.rb
263
+ - lib/rautomation/adapter/win_32/radio.rb
264
+ - lib/rautomation/adapter/win_32/select_list.rb
265
+ - lib/rautomation/adapter/win_32/table.rb
266
+ - lib/rautomation/adapter/win_32/text_field.rb
267
+ - lib/rautomation/adapter/win_32/window.rb
268
+ - lib/rautomation/button.rb
269
+ - lib/rautomation/element_collections.rb
270
+ - lib/rautomation/platform.rb
271
+ - lib/rautomation/text_field.rb
272
+ - lib/rautomation/version.rb
273
+ - lib/rautomation/wait_helper.rb
274
+ - lib/rautomation/window.rb
275
+ - rautomation.gemspec
276
+ - spec/adapter/autoit/mouse_spec.rb
277
+ - spec/adapter/autoit/window_spec.rb
278
+ - spec/adapter/ms_uia/button_spec.rb
279
+ - spec/adapter/ms_uia/checkbox_spec.rb
280
+ - spec/adapter/ms_uia/control_spec.rb
281
+ - spec/adapter/ms_uia/functions_spec.rb
282
+ - spec/adapter/ms_uia/keystroke_converter_spec.rb
283
+ - spec/adapter/ms_uia/label_spec.rb
284
+ - spec/adapter/ms_uia/list_item_spec.rb
285
+ - spec/adapter/ms_uia/listbox_spec.rb
286
+ - spec/adapter/ms_uia/radio_spec.rb
287
+ - spec/adapter/ms_uia/select_list_spec.rb
288
+ - spec/adapter/ms_uia/spinner_spec.rb
289
+ - spec/adapter/ms_uia/tab_control_spec.rb
290
+ - spec/adapter/ms_uia/table_spec.rb
291
+ - spec/adapter/ms_uia/text_field_spec.rb
292
+ - spec/adapter/ms_uia/value_control_spec.rb
293
+ - spec/adapter/ms_uia/window_spec.rb
294
+ - spec/adapter/win_32/button_spec.rb
295
+ - spec/adapter/win_32/checkbox_spec.rb
296
+ - spec/adapter/win_32/label_spec.rb
297
+ - spec/adapter/win_32/listbox_spec.rb
298
+ - spec/adapter/win_32/mouse_spec.rb
299
+ - spec/adapter/win_32/radio_spec.rb
300
+ - spec/adapter/win_32/select_list_spec.rb
301
+ - spec/adapter/win_32/table_spec.rb
302
+ - spec/adapter/win_32/text_field_spec.rb
303
+ - spec/adapter/win_32/window_spec.rb
304
+ - spec/button_spec.rb
305
+ - spec/buttons_spec.rb
306
+ - spec/spec_helper.rb
307
+ - spec/text_field_spec.rb
308
+ - spec/text_fields_spec.rb
309
+ - spec/window_spec.rb
310
+ - spec/windows_spec.rb
311
+ homepage: http://github.com/jarmo/RAutomation
312
+ licenses:
313
+ - MIT
314
+ metadata: {}
315
+ post_install_message:
316
+ rdoc_options: []
317
+ require_paths:
318
+ - lib
319
+ required_ruby_version: !ruby/object:Gem::Requirement
320
+ requirements:
321
+ - - ">="
322
+ - !ruby/object:Gem::Version
323
+ version: '0'
324
+ required_rubygems_version: !ruby/object:Gem::Requirement
325
+ requirements:
326
+ - - ">="
327
+ - !ruby/object:Gem::Version
328
+ version: '0'
329
+ requirements: []
330
+ rubygems_version: 3.3.24
331
+ signing_key:
332
+ specification_version: 4
333
+ summary: Automate windows and their controls through user-friendly API with Ruby
334
+ test_files:
335
+ - spec/adapter/autoit/mouse_spec.rb
336
+ - spec/adapter/autoit/window_spec.rb
337
+ - spec/adapter/ms_uia/button_spec.rb
338
+ - spec/adapter/ms_uia/checkbox_spec.rb
339
+ - spec/adapter/ms_uia/control_spec.rb
340
+ - spec/adapter/ms_uia/functions_spec.rb
341
+ - spec/adapter/ms_uia/keystroke_converter_spec.rb
342
+ - spec/adapter/ms_uia/label_spec.rb
343
+ - spec/adapter/ms_uia/list_item_spec.rb
344
+ - spec/adapter/ms_uia/listbox_spec.rb
345
+ - spec/adapter/ms_uia/radio_spec.rb
346
+ - spec/adapter/ms_uia/select_list_spec.rb
347
+ - spec/adapter/ms_uia/spinner_spec.rb
348
+ - spec/adapter/ms_uia/tab_control_spec.rb
349
+ - spec/adapter/ms_uia/table_spec.rb
350
+ - spec/adapter/ms_uia/text_field_spec.rb
351
+ - spec/adapter/ms_uia/value_control_spec.rb
352
+ - spec/adapter/ms_uia/window_spec.rb
353
+ - spec/adapter/win_32/button_spec.rb
354
+ - spec/adapter/win_32/checkbox_spec.rb
355
+ - spec/adapter/win_32/label_spec.rb
356
+ - spec/adapter/win_32/listbox_spec.rb
357
+ - spec/adapter/win_32/mouse_spec.rb
358
+ - spec/adapter/win_32/radio_spec.rb
359
+ - spec/adapter/win_32/select_list_spec.rb
360
+ - spec/adapter/win_32/table_spec.rb
361
+ - spec/adapter/win_32/text_field_spec.rb
362
+ - spec/adapter/win_32/window_spec.rb
363
+ - spec/button_spec.rb
364
+ - spec/buttons_spec.rb
365
+ - spec/spec_helper.rb
366
+ - spec/text_field_spec.rb
367
+ - spec/text_fields_spec.rb
368
+ - spec/window_spec.rb
369
+ - spec/windows_spec.rb