rautomation 0.17.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -49,7 +49,7 @@ describe RAutomation::TextField do
49
49
 
50
50
  it "#hwnd" do
51
51
  field = main_form.text_field(:class => /Edit/i, :index => 1)
52
- field.hwnd.should be_a(Fixnum)
52
+ field.hwnd.should be_a(Integer)
53
53
 
54
54
  RAutomation::Window.wait_timeout = 0.1
55
55
  expect { main_form.text_field(:class => "non-existing-window").hwnd }.
@@ -58,7 +58,7 @@ describe RAutomation::TextField do
58
58
 
59
59
  it "#hwnd locator" do
60
60
  field = main_form.text_field(:class => /Edit/i, :index => 1)
61
- field.hwnd.should be_a(Fixnum)
61
+ field.hwnd.should be_a(Integer)
62
62
  field2 = main_form.text_field(:hwnd => field.hwnd).should exist
63
63
  end
64
64
  end
@@ -1,149 +1,149 @@
1
- require 'spec_helper'
2
-
3
- describe RAutomation::Window do
4
- it ".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 "#new by full title" do
9
- RAutomation::Window.new(:title => SpecHelper::DATA[:window1_full_title]).should exist
10
- end
11
-
12
- it "#new by regexp title" do
13
- RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title]).should exist
14
- end
15
-
16
- it "#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 "#class_names" do
55
- window = RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title])
56
-
57
- fail "Expected class name not found." unless window.class_names.any? {|clazz| clazz.match(/WindowsForms10\.Window\.8\.app\.0\.2bf8098_r\d{2}_ad1/)}
58
-
59
- RAutomation::Window.wait_timeout = 0.1
60
- expect {RAutomation::Window.new(:title => "non-existing-window").class_names}.
61
- to raise_exception(RAutomation::UnknownWindowException)
62
- end
63
-
64
- it "#activate & #active?" do
65
- window = RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title])
66
- window.activate
67
- window.should be_active
68
- non_existing_window = RAutomation::Window.new(:title => "non-existing-window")
69
- non_existing_window.activate
70
- non_existing_window.should_not be_active
71
- end
72
-
73
- it "#text" do
74
- RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title]).text.should include(SpecHelper::DATA[:window1_text])
75
- RAutomation::Window.wait_timeout = 0.1
76
- expect {RAutomation::Window.new(:title => "non-existing-window").text}.
77
- to raise_exception(RAutomation::UnknownWindowException)
78
- end
79
-
80
- it "#maximize" do
81
- RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title]).maximize
82
- RAutomation::Window.wait_timeout = 0.1
83
- expect {RAutomation::Window.new(:title => "non-existing-window").maximize}.
84
- to raise_exception(RAutomation::UnknownWindowException)
85
- end
86
-
87
- it "#minimize & #minimized?" do
88
- window = RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title])
89
- window.should_not be_minimized
90
- window.minimize
91
- window.should be_minimized
92
-
93
- RAutomation::Window.wait_timeout = 0.1
94
- expect {RAutomation::Window.new(:title => "non-existing-window").minimize}.
95
- to raise_exception(RAutomation::UnknownWindowException)
96
- expect {RAutomation::Window.new(:title => "non-existing-window").minimized?}.
97
- to raise_exception(RAutomation::UnknownWindowException)
98
- end
99
-
100
- it "#restore" do
101
- RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title]).restore
102
- RAutomation::Window.wait_timeout = 0.1
103
- expect {RAutomation::Window.new(:title => "non-existing-window").restore}.
104
- to raise_exception(RAutomation::UnknownWindowException)
105
- end
106
-
107
- it "#method_missing" do
108
- win = RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title])
109
- SpecHelper::DATA[:title_proc].call(win).should == SpecHelper::DATA[:window1_full_title]
110
- end
111
-
112
- it "#send_keys"do
113
- window = RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title])
114
- window.minimize # send_keys should work even if window is minimized
115
- window.send_keys(SpecHelper::DATA[:window1_send_keys])
116
- SpecHelper::DATA[:proc_after_send_keys].call
117
-
118
- RAutomation::Window.wait_timeout = 0.1
119
- expect {RAutomation::Window.new(:title => "non-existing-window").send_keys("123")}.
120
- to raise_exception(RAutomation::UnknownWindowException)
121
- end
122
-
123
- it "#close" do
124
- window = RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title])
125
- window.should exist
126
- window.close
127
- window.should_not exist
128
-
129
- expect {RAutomation::Window.new(:title => "non-existing-window").close}.
130
- to_not raise_exception
131
- end
132
-
133
- context '#child', :if => [:win_32, :ms_uia].include?(SpecHelper.adapter) do
134
- let(:window) { RAutomation::Window.new(:title => SpecHelper::DATA[:window1_full_title]) }
135
-
136
- it 'immediate children' do
137
- # buttons are windows too. so let's find the button for now
138
- child = window.child(:title => '&About')
139
- child.should exist
140
- child.title.should == "&About"
141
- child.adapter.should == SpecHelper.adapter
142
- end
143
-
144
- it 'popups' do
145
- window.button(:title => '&About').click { true }
146
- window.child(:title => 'About').should be_visible
147
- end
148
- end
149
- end
1
+ require 'spec_helper'
2
+
3
+ describe RAutomation::Window do
4
+ it ".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 "#new by full title" do
9
+ RAutomation::Window.new(:title => SpecHelper::DATA[:window1_full_title]).should exist
10
+ end
11
+
12
+ it "#new by regexp title" do
13
+ RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title]).should exist
14
+ end
15
+
16
+ it "#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(Integer)
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 "#class_names" do
55
+ window = RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title])
56
+
57
+ fail "Expected class name not found." unless window.class_names.any? {|clazz| clazz.match(/WindowsForms10\.Window\.8\.app\.0\.\S+_r\d+_ad1/)}
58
+
59
+ RAutomation::Window.wait_timeout = 0.1
60
+ expect {RAutomation::Window.new(:title => "non-existing-window").class_names}.
61
+ to raise_exception(RAutomation::UnknownWindowException)
62
+ end
63
+
64
+ it "#activate & #active?" do
65
+ window = RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title])
66
+ window.activate
67
+ window.should be_active
68
+ non_existing_window = RAutomation::Window.new(:title => "non-existing-window")
69
+ non_existing_window.activate
70
+ non_existing_window.should_not be_active
71
+ end
72
+
73
+ it "#text" do
74
+ RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title]).text.should include(SpecHelper::DATA[:window1_text])
75
+ RAutomation::Window.wait_timeout = 0.1
76
+ expect {RAutomation::Window.new(:title => "non-existing-window").text}.
77
+ to raise_exception(RAutomation::UnknownWindowException)
78
+ end
79
+
80
+ it "#maximize" do
81
+ RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title]).maximize
82
+ RAutomation::Window.wait_timeout = 0.1
83
+ expect {RAutomation::Window.new(:title => "non-existing-window").maximize}.
84
+ to raise_exception(RAutomation::UnknownWindowException)
85
+ end
86
+
87
+ it "#minimize & #minimized?" do
88
+ window = RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title])
89
+ window.should_not be_minimized
90
+ window.minimize
91
+ window.should be_minimized
92
+
93
+ RAutomation::Window.wait_timeout = 0.1
94
+ expect {RAutomation::Window.new(:title => "non-existing-window").minimize}.
95
+ to raise_exception(RAutomation::UnknownWindowException)
96
+ expect {RAutomation::Window.new(:title => "non-existing-window").minimized?}.
97
+ to raise_exception(RAutomation::UnknownWindowException)
98
+ end
99
+
100
+ it "#restore" do
101
+ RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title]).restore
102
+ RAutomation::Window.wait_timeout = 0.1
103
+ expect {RAutomation::Window.new(:title => "non-existing-window").restore}.
104
+ to raise_exception(RAutomation::UnknownWindowException)
105
+ end
106
+
107
+ it "#method_missing" do
108
+ win = RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title])
109
+ SpecHelper::DATA[:title_proc].call(win).should == SpecHelper::DATA[:window1_full_title]
110
+ end
111
+
112
+ it "#send_keys"do
113
+ window = RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title])
114
+ window.minimize # send_keys should work even if window is minimized
115
+ window.send_keys(SpecHelper::DATA[:window1_send_keys])
116
+ SpecHelper::DATA[:proc_after_send_keys].call
117
+
118
+ RAutomation::Window.wait_timeout = 0.1
119
+ expect {RAutomation::Window.new(:title => "non-existing-window").send_keys("123")}.
120
+ to raise_exception(RAutomation::UnknownWindowException)
121
+ end
122
+
123
+ it "#close" do
124
+ window = RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title])
125
+ window.should exist
126
+ window.close
127
+ window.should_not exist
128
+
129
+ expect {RAutomation::Window.new(:title => "non-existing-window").close}.
130
+ to_not raise_exception
131
+ end
132
+
133
+ context '#child', :if => [:win_32, :ms_uia].include?(SpecHelper.adapter) do
134
+ let(:window) { RAutomation::Window.new(:title => SpecHelper::DATA[:window1_full_title]) }
135
+
136
+ it 'immediate children' do
137
+ # buttons are windows too. so let's find the button for now
138
+ child = window.child(:title => '&About')
139
+ child.should exist
140
+ child.title.should == "&About"
141
+ child.adapter.should == SpecHelper.adapter
142
+ end
143
+
144
+ it 'popups' do
145
+ window.button(:title => '&About').click { true }
146
+ window.child(:title => 'About').should be_visible
147
+ end
148
+ end
149
+ end
metadata CHANGED
@@ -1,69 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rautomation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jarmo Pertman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-11 00:00:00.000000000 Z
11
+ date: 2019-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.9.0
19
+ version: 1.11.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.9.0
26
+ version: 1.11.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '2.14'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '2.14'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: yard
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: redcarpet
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
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: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
67
95
  - !ruby/object:Gem::Version
68
96
  version: '0'
69
97
  description: |-
@@ -80,15 +108,15 @@ executables: []
80
108
  extensions: []
81
109
  extra_rdoc_files: []
82
110
  files:
83
- - .document
84
- - .gitignore
85
- - .rspec
86
- - .yardopts
111
+ - ".document"
112
+ - ".gitignore"
113
+ - ".rspec"
114
+ - ".yardopts"
115
+ - CHANGES.md
87
116
  - Gemfile
88
117
  - Gemfile.lock
89
- - History.rdoc
90
118
  - LICENSE
91
- - README.rdoc
119
+ - README.md
92
120
  - Rakefile
93
121
  - VERSION
94
122
  - ext/AutoItX/AutoItX.chm
@@ -105,6 +133,7 @@ files:
105
133
  - ext/IAccessibleDLL/IAccessibleDLL/stdafx.h
106
134
  - ext/IAccessibleDLL/IAccessibleDLL/table_support.cpp
107
135
  - ext/IAccessibleDLL/IAccessibleDLL/targetver.h
136
+ - ext/IAccessibleDLL/Release/IAccessibleDLL.dll
108
137
  - ext/UiaDll/RAutomation.UIA/Controls/Clicker.cs
109
138
  - ext/UiaDll/RAutomation.UIA/Controls/SelectList.cs
110
139
  - ext/UiaDll/RAutomation.UIA/Controls/Spinner.cs
@@ -118,6 +147,8 @@ files:
118
147
  - ext/UiaDll/RAutomation.UIA/Properties/AssemblyInfo.cs
119
148
  - ext/UiaDll/RAutomation.UIA/Properties/AutomationProperties.cs
120
149
  - ext/UiaDll/RAutomation.UIA/RAutomation.UIA.csproj
150
+ - ext/UiaDll/Release/RAutomation.UIA.dll
151
+ - ext/UiaDll/Release/UiaDll.dll
121
152
  - ext/UiaDll/UiaDll.sln
122
153
  - ext/UiaDll/UiaDll/ArrayHelper.cpp
123
154
  - ext/UiaDll/UiaDll/ArrayHelper.h
@@ -154,6 +185,7 @@ files:
154
185
  - ext/WindowsForms/.nuget/NuGet.Config
155
186
  - ext/WindowsForms/.nuget/NuGet.exe
156
187
  - ext/WindowsForms/.nuget/NuGet.targets
188
+ - ext/WindowsForms/Release/WindowsForms.exe
157
189
  - ext/WindowsForms/WindowsForms.sln
158
190
  - ext/WindowsForms/WindowsForms/AboutBox.Designer.cs
159
191
  - ext/WindowsForms/WindowsForms/AboutBox.cs
@@ -274,10 +306,6 @@ files:
274
306
  - spec/text_fields_spec.rb
275
307
  - spec/window_spec.rb
276
308
  - spec/windows_spec.rb
277
- - ext/IAccessibleDLL/Release/IAccessibleDLL.dll
278
- - ext/UiaDll/Release/UiaDll.dll
279
- - ext/UiaDll/Release/RAutomation.UIA.dll
280
- - ext/WindowsForms/Release/WindowsForms.exe
281
309
  homepage: http://github.com/jarmo/RAutomation
282
310
  licenses:
283
311
  - MIT
@@ -288,17 +316,16 @@ require_paths:
288
316
  - lib
289
317
  required_ruby_version: !ruby/object:Gem::Requirement
290
318
  requirements:
291
- - - '>='
319
+ - - ">="
292
320
  - !ruby/object:Gem::Version
293
321
  version: '0'
294
322
  required_rubygems_version: !ruby/object:Gem::Requirement
295
323
  requirements:
296
- - - '>='
324
+ - - ">="
297
325
  - !ruby/object:Gem::Version
298
326
  version: '0'
299
327
  requirements: []
300
- rubyforge_project:
301
- rubygems_version: 2.0.7
328
+ rubygems_version: 3.0.3
302
329
  signing_key:
303
330
  specification_version: 4
304
331
  summary: Automate windows and their controls through user-friendly API with Ruby
@@ -338,4 +365,3 @@ test_files:
338
365
  - spec/text_fields_spec.rb
339
366
  - spec/window_spec.rb
340
367
  - spec/windows_spec.rb
341
- has_rdoc: