uia 0.0.5.1 → 0.0.6
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.
- data/ChangeLog +17 -2
- data/Gemfile +1 -0
- data/Rakefile +13 -0
- data/ext/UiaDll/UIA.Helper/{AutomationProperty.cs → AutomationPropertyCondition.cs} +1 -1
- data/ext/UiaDll/UIA.Helper/Element.cs +46 -6
- data/ext/UiaDll/UIA.Helper/Extensions.cs +13 -0
- data/ext/UiaDll/UIA.Helper/UIA.Helper.csproj +1 -1
- data/ext/UiaDll/UiaDll.Test/ElementInformationTest.cpp +20 -4
- data/ext/UiaDll/UiaDll.Test/ElementStub.h +16 -2
- data/ext/UiaDll/UiaDll.Test/PatternInformationTest.cpp +35 -0
- data/ext/UiaDll/UiaDll.Test/UiaDll.Test.vcxproj +6 -4
- data/ext/UiaDll/UiaDll.Test/UiaDll.Test.vcxproj.filters +3 -0
- data/ext/UiaDll/UiaDll/ElementMethods.cpp +62 -17
- data/ext/UiaDll/UiaDll/ElementStructures.h +19 -9
- data/ext/UiaDll/UiaDll/ExpandCollapseMethods.cpp +33 -0
- data/ext/UiaDll/UiaDll/InvokePatternMethods.cpp +11 -0
- data/ext/UiaDll/UiaDll/PatternInformationStructures.h +90 -0
- data/ext/UiaDll/UiaDll/SelectionItemMethods.cpp +40 -0
- data/ext/UiaDll/UiaDll/SelectionMethods.cpp +16 -0
- data/ext/UiaDll/UiaDll/Stdafx.h +3 -0
- data/ext/UiaDll/UiaDll/ToggleMethods.cpp +25 -0
- data/ext/UiaDll/UiaDll/UiaDll.vcxproj +9 -0
- data/ext/UiaDll/UiaDll/UiaDll.vcxproj.filters +24 -0
- data/ext/UiaDll/UiaDll/ValuePatternMethods.cpp +25 -0
- data/lib/uia.rb +14 -6
- data/lib/uia/element.rb +35 -11
- data/lib/uia/finder.rb +33 -0
- data/lib/uia/library.rb +48 -6
- data/lib/uia/library/element_attributes.rb +11 -0
- data/lib/uia/library/structs.rb +93 -5
- data/lib/uia/patterns/expand_collapse.rb +17 -0
- data/lib/uia/patterns/invoke.rb +9 -0
- data/lib/uia/patterns/selection.rb +17 -0
- data/lib/uia/patterns/selection_item.rb +25 -0
- data/lib/uia/patterns/toggle.rb +17 -0
- data/lib/uia/patterns/value.rb +22 -0
- data/lib/uia/version.rb +1 -1
- data/spec/spec_helper.rb +0 -2
- data/spec/uia/element_spec.rb +35 -8
- data/spec/uia/patterns/expand_collapse_spec.rb +24 -0
- data/spec/uia/patterns/invoke_spec.rb +15 -0
- data/spec/uia/patterns/selection_item_spec.rb +55 -0
- data/spec/uia/patterns/selection_spec.rb +30 -0
- data/spec/uia/patterns/toggle_spec.rb +41 -0
- data/spec/uia/patterns/value_spec.rb +16 -0
- data/spec/uia_spec.rb +26 -7
- metadata +37 -4
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Uia::Patterns::ExpandCollapse do
|
4
|
+
let(:main) { Uia.find_element id: 'MainFormWindow' }
|
5
|
+
|
6
|
+
Given(:parent_one) { main.find(name: 'Parent One').as :expand_collapse }
|
7
|
+
|
8
|
+
context 'properties' do
|
9
|
+
context '#expand_collapse_state' do
|
10
|
+
Then { parent_one.expand_collapse_state == :collapsed }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
context '#expand' do
|
15
|
+
When { parent_one.expand }
|
16
|
+
Then { parent_one.expand_collapse_state == :expanded }
|
17
|
+
end
|
18
|
+
|
19
|
+
context '#collapse' do
|
20
|
+
Given { parent_one.expand }
|
21
|
+
When { parent_one.collapse }
|
22
|
+
Then { parent_one.expand_collapse_state == :collapsed }
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Uia::Patterns::Invoke do
|
4
|
+
let(:main) { Uia.find_element id: 'MainFormWindow' }
|
5
|
+
let(:radio_label) { main.find(id: 'radioButtonLabel') }
|
6
|
+
|
7
|
+
Given(:reset) { main.find(name: 'Reset').as :invoke }
|
8
|
+
|
9
|
+
context '#invoke' do
|
10
|
+
Given { main.find(name: 'Option 2').click }
|
11
|
+
|
12
|
+
When { reset.invoke }
|
13
|
+
Then { radio_label.name == 'No option selected' }
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Uia::Patterns::SelectionItem do
|
4
|
+
let(:main) { Uia.find_element id: 'MainFormWindow' }
|
5
|
+
let(:reset) { main.find(name: 'Reset').as :invoke }
|
6
|
+
let(:radio_label) { main.find id: 'radioButtonLabel' }
|
7
|
+
|
8
|
+
Given { reset.invoke }
|
9
|
+
|
10
|
+
context 'properties' do
|
11
|
+
Given(:radio) { main.find(id: 'radioButton2').as :selection_item }
|
12
|
+
Then { expect(radio).to_not be_selected }
|
13
|
+
|
14
|
+
context '#selected?' do
|
15
|
+
When { radio.select }
|
16
|
+
Then { expect(radio).to be_selected }
|
17
|
+
end
|
18
|
+
|
19
|
+
context '#container' do
|
20
|
+
Given(:parent_two) { main.find(name: 'Parent Two').as :selection_item }
|
21
|
+
Then { parent_two.container.id == 'treeView' }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context '#select' do
|
26
|
+
Given(:radio) { main.find id: 'radioButton2' }
|
27
|
+
When { radio.as(:selection_item).select }
|
28
|
+
Then { radio_label.name == 'Option 2 selected' }
|
29
|
+
end
|
30
|
+
|
31
|
+
context 'multi-select' do
|
32
|
+
let(:toggle) { main.find(name: 'Toggle Multi-Select').as :invoke }
|
33
|
+
|
34
|
+
def select_list
|
35
|
+
main.find(id: 'FruitListBox').as :selection
|
36
|
+
end
|
37
|
+
|
38
|
+
Given(:multi_select) do
|
39
|
+
toggle.invoke unless select_list.multi_select?
|
40
|
+
select_list
|
41
|
+
end
|
42
|
+
Given(:apple) { multi_select.find(name: 'Apple').as :selection_item }
|
43
|
+
|
44
|
+
context '#add_to_selection' do
|
45
|
+
When { apple.add_to_selection }
|
46
|
+
Then { expect(apple).to be_selected }
|
47
|
+
end
|
48
|
+
|
49
|
+
context '#remove_from_selection' do
|
50
|
+
Given { multi_select.selection_items.each(&:add_to_selection) }
|
51
|
+
When { apple.remove_from_selection }
|
52
|
+
Then { expect(apple).to_not be_selected }
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Uia::Patterns::Selection do
|
4
|
+
let(:main) { Uia.find_element id: 'MainFormWindow' }
|
5
|
+
Given(:select_list) { main.find(id: 'FruitListBox').as :selection }
|
6
|
+
|
7
|
+
context 'properties' do
|
8
|
+
context '#multi_select?' do
|
9
|
+
Then { expect(select_list).to_not be_multi_select }
|
10
|
+
end
|
11
|
+
|
12
|
+
context '#selection_required?' do
|
13
|
+
Then { expect(select_list).to_not be_selection_required }
|
14
|
+
end
|
15
|
+
|
16
|
+
context '#selection_items' do
|
17
|
+
let(:respond_to_selections) { lambda { |e| e.respond_to? :add_to_selection } }
|
18
|
+
|
19
|
+
Then { select_list.selection_items.map(&:name) == ['Apple', 'Orange', 'Mango'] }
|
20
|
+
Then { select_list.selection_items.all?(&respond_to_selections) == true }
|
21
|
+
|
22
|
+
context 'multiple levels of #selection_items' do
|
23
|
+
Given(:tree_view) { main.find(id: 'treeView').as :selection }
|
24
|
+
|
25
|
+
When { tree_view.selection_items.first.as(:expand_collapse).expand }
|
26
|
+
Then { tree_view.selection_items.map(&:name) == ['Parent One', 'Child 1', 'Child 2', 'Parent Two'] }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Uia::Patterns::Toggle do
|
4
|
+
let(:main) { Uia.find_element id: 'MainFormWindow' }
|
5
|
+
let(:label) { main.find id: 'checkBoxLabel' }
|
6
|
+
|
7
|
+
Given(:check_box) { main.find(id: 'checkBox').as :toggle }
|
8
|
+
|
9
|
+
context 'properties' do
|
10
|
+
When { check_box.toggle }
|
11
|
+
|
12
|
+
Then { check_box.toggle_state == :on }
|
13
|
+
Then { check_box.toggle_state == :off }
|
14
|
+
end
|
15
|
+
|
16
|
+
context '#toggle' do
|
17
|
+
When { check_box.toggle }
|
18
|
+
Then { label.name == 'checkBox is on' }
|
19
|
+
end
|
20
|
+
|
21
|
+
context '#toggle=' do
|
22
|
+
Given { check_box.toggle unless check_box.toggle_state == :off }
|
23
|
+
|
24
|
+
context ':off to :on' do
|
25
|
+
When { check_box.toggle_state = :on }
|
26
|
+
Then { check_box.toggle_state == :on }
|
27
|
+
end
|
28
|
+
|
29
|
+
context ':on to :off' do
|
30
|
+
Given { check_box.toggle_state = :on }
|
31
|
+
When { check_box.toggle_state = :off }
|
32
|
+
Then { check_box.toggle_state == :off }
|
33
|
+
end
|
34
|
+
|
35
|
+
context '<state> to <same state>' do
|
36
|
+
Given!(:original_state) { check_box.toggle_state }
|
37
|
+
When { check_box.toggle_state = original_state }
|
38
|
+
Then { check_box.toggle_state == original_state }
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Uia::Patterns::Value do
|
4
|
+
Given(:text_field) do
|
5
|
+
Uia.find_element(id: 'MainFormWindow').children.find { |e| e.id == 'textField' }
|
6
|
+
end
|
7
|
+
|
8
|
+
context 'properties' do
|
9
|
+
Given(:value_field) { text_field.as(:value) }
|
10
|
+
|
11
|
+
Then { expect(value_field).to_not be_read_only }
|
12
|
+
|
13
|
+
When { value_field.value = 'Expected value' }
|
14
|
+
Then { value_field.value == 'Expected value' }
|
15
|
+
end
|
16
|
+
end
|
data/spec/uia_spec.rb
CHANGED
@@ -1,28 +1,47 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Uia do
|
4
|
+
context '#children' do
|
5
|
+
Then { Uia.children.find { |e| e.name =~ /MainFormWindow/ } != nil }
|
6
|
+
end
|
7
|
+
|
4
8
|
context '#find_element' do
|
5
|
-
Given(:main_window) { find_element id: 'MainFormWindow' }
|
9
|
+
Given(:main_window) { Uia.find_element id: 'MainFormWindow' }
|
6
10
|
|
7
11
|
context 'by id' do
|
8
|
-
Then { find_element(id: 'MainFormWindow') != nil}
|
12
|
+
Then { Uia.find_element(id: 'MainFormWindow') != nil }
|
13
|
+
Then { Uia.find_element(id: /[Mm]ain/) != nil }
|
14
|
+
Then { Uia.find_element(id: 'not there') == nil }
|
15
|
+
end
|
16
|
+
|
17
|
+
context 'by name' do
|
18
|
+
Then { Uia.find_element(name: 'MainFormWindow') != nil }
|
19
|
+
Then { Uia.find_element(name: /[Mm]ain.*Window/ ) != nil }
|
20
|
+
Then { Uia.find_element(name: 'not there') == nil }
|
9
21
|
end
|
10
22
|
|
11
23
|
context 'by process id' do
|
12
|
-
Then { find_element(pid: @app.pid) != nil }
|
24
|
+
Then { Uia.find_element(pid: @app.pid) != nil }
|
25
|
+
Then { Uia.find_element(pid: -1) == nil }
|
13
26
|
end
|
14
27
|
|
15
28
|
context 'by runtime id' do
|
16
|
-
Then { find_element(runtime_id: main_window.runtime_id) != nil }
|
29
|
+
Then { Uia.find_element(runtime_id: main_window.runtime_id) != nil }
|
30
|
+
|
31
|
+
context 'can search descendants' do
|
32
|
+
Given(:element_with_no_handle) { Uia.find_element(id: 'MainFormWindow').find(name: 'Parent Two') }
|
33
|
+
Then { element_with_no_handle.click.should be_true }
|
34
|
+
end
|
17
35
|
end
|
18
36
|
|
19
37
|
context 'by window handle' do
|
20
|
-
Then { find_element(handle: main_window.handle) != nil }
|
38
|
+
Then { Uia.find_element(handle: main_window.handle) != nil }
|
39
|
+
Then { expect { Uia.find_element(handle: 0x0) }.to raise_error }
|
21
40
|
end
|
22
41
|
|
23
42
|
context 'invalid locators' do
|
24
|
-
When(:bad_input) { find_element(bad: 123) }
|
25
|
-
Then { bad_input.should have_failed(BadLocator, '{:bad=>123} is not a valid locator') }
|
43
|
+
When(:bad_input) { Uia.find_element(bad: 123) }
|
44
|
+
Then { bad_input.should have_failed(Uia::BadLocator, '{:bad=>123} is not a valid locator') }
|
26
45
|
end
|
27
46
|
end
|
28
47
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-10-
|
12
|
+
date: 2013-10-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ffi
|
@@ -122,7 +122,7 @@ files:
|
|
122
122
|
- README.md
|
123
123
|
- Rakefile
|
124
124
|
- ext/.gitignore
|
125
|
-
- ext/UiaDll/UIA.Helper/
|
125
|
+
- ext/UiaDll/UIA.Helper/AutomationPropertyCondition.cs
|
126
126
|
- ext/UiaDll/UIA.Helper/Clicker.cs
|
127
127
|
- ext/UiaDll/UIA.Helper/Element.cs
|
128
128
|
- ext/UiaDll/UIA.Helper/Extensions.cs
|
@@ -133,6 +133,7 @@ files:
|
|
133
133
|
- ext/UiaDll/UiaDll.Test/ElementStub.h
|
134
134
|
- ext/UiaDll/UiaDll.Test/ElementsTest.cpp
|
135
135
|
- ext/UiaDll/UiaDll.Test/MemoryLeakDetector.h
|
136
|
+
- ext/UiaDll/UiaDll.Test/PatternInformationTest.cpp
|
136
137
|
- ext/UiaDll/UiaDll.Test/ReadMe.txt
|
137
138
|
- ext/UiaDll/UiaDll.Test/StringHelperTest.cpp
|
138
139
|
- ext/UiaDll/UiaDll.Test/UiaDll.Test.cpp
|
@@ -150,26 +151,47 @@ files:
|
|
150
151
|
- ext/UiaDll/UiaDll/DynamicAssemblyResolver.h
|
151
152
|
- ext/UiaDll/UiaDll/ElementMethods.cpp
|
152
153
|
- ext/UiaDll/UiaDll/ElementStructures.h
|
154
|
+
- ext/UiaDll/UiaDll/ExpandCollapseMethods.cpp
|
155
|
+
- ext/UiaDll/UiaDll/InvokePatternMethods.cpp
|
156
|
+
- ext/UiaDll/UiaDll/PatternInformationStructures.h
|
153
157
|
- ext/UiaDll/UiaDll/ReadMe.txt
|
158
|
+
- ext/UiaDll/UiaDll/SelectionItemMethods.cpp
|
159
|
+
- ext/UiaDll/UiaDll/SelectionMethods.cpp
|
154
160
|
- ext/UiaDll/UiaDll/Stdafx.cpp
|
155
161
|
- ext/UiaDll/UiaDll/Stdafx.h
|
156
162
|
- ext/UiaDll/UiaDll/StringHelper.h
|
163
|
+
- ext/UiaDll/UiaDll/ToggleMethods.cpp
|
157
164
|
- ext/UiaDll/UiaDll/UiaDll.cpp
|
158
165
|
- ext/UiaDll/UiaDll/UiaDll.h
|
159
166
|
- ext/UiaDll/UiaDll/UiaDll.vcxproj
|
160
167
|
- ext/UiaDll/UiaDll/UiaDll.vcxproj.filters
|
168
|
+
- ext/UiaDll/UiaDll/ValuePatternMethods.cpp
|
161
169
|
- ext/UiaDll/UiaDll/app.rc
|
162
170
|
- lib/uia.rb
|
163
171
|
- lib/uia/element.rb
|
172
|
+
- lib/uia/finder.rb
|
164
173
|
- lib/uia/library.rb
|
165
174
|
- lib/uia/library/constants.rb
|
175
|
+
- lib/uia/library/element_attributes.rb
|
166
176
|
- lib/uia/library/structs.rb
|
177
|
+
- lib/uia/patterns/expand_collapse.rb
|
178
|
+
- lib/uia/patterns/invoke.rb
|
179
|
+
- lib/uia/patterns/selection.rb
|
180
|
+
- lib/uia/patterns/selection_item.rb
|
181
|
+
- lib/uia/patterns/toggle.rb
|
182
|
+
- lib/uia/patterns/value.rb
|
167
183
|
- lib/uia/version.rb
|
168
184
|
- spec/app/FizzWare.NBuilder.dll
|
169
185
|
- spec/app/UIA.Extensions.dll
|
170
186
|
- spec/app/WindowsForms.exe
|
171
187
|
- spec/spec_helper.rb
|
172
188
|
- spec/uia/element_spec.rb
|
189
|
+
- spec/uia/patterns/expand_collapse_spec.rb
|
190
|
+
- spec/uia/patterns/invoke_spec.rb
|
191
|
+
- spec/uia/patterns/selection_item_spec.rb
|
192
|
+
- spec/uia/patterns/selection_spec.rb
|
193
|
+
- spec/uia/patterns/toggle_spec.rb
|
194
|
+
- spec/uia/patterns/value_spec.rb
|
173
195
|
- spec/uia_spec.rb
|
174
196
|
- uia.gemspec
|
175
197
|
- ext/UiaDll/Release/UiaDll.dll
|
@@ -187,12 +209,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
187
209
|
- - ! '>='
|
188
210
|
- !ruby/object:Gem::Version
|
189
211
|
version: '0'
|
212
|
+
segments:
|
213
|
+
- 0
|
214
|
+
hash: 149401647
|
190
215
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
191
216
|
none: false
|
192
217
|
requirements:
|
193
218
|
- - ! '>='
|
194
219
|
- !ruby/object:Gem::Version
|
195
220
|
version: '0'
|
221
|
+
segments:
|
222
|
+
- 0
|
223
|
+
hash: 149401647
|
196
224
|
requirements: []
|
197
225
|
rubyforge_project:
|
198
226
|
rubygems_version: 1.8.24
|
@@ -205,5 +233,10 @@ test_files:
|
|
205
233
|
- spec/app/WindowsForms.exe
|
206
234
|
- spec/spec_helper.rb
|
207
235
|
- spec/uia/element_spec.rb
|
236
|
+
- spec/uia/patterns/expand_collapse_spec.rb
|
237
|
+
- spec/uia/patterns/invoke_spec.rb
|
238
|
+
- spec/uia/patterns/selection_item_spec.rb
|
239
|
+
- spec/uia/patterns/selection_spec.rb
|
240
|
+
- spec/uia/patterns/toggle_spec.rb
|
241
|
+
- spec/uia/patterns/value_spec.rb
|
208
242
|
- spec/uia_spec.rb
|
209
|
-
has_rdoc:
|