bewildr 0.1.13 → 0.1.14
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/bewildr.rb +0 -1
- data/lib/bewildr/bewildr_helpers.rb +1 -1
- data/lib/bewildr/control_patterns/expand_collapse_pattern.rb +1 -1
- data/lib/bewildr/control_patterns/grid_pattern.rb +1 -1
- data/lib/bewildr/control_patterns/range_value_pattern.rb +1 -1
- data/lib/bewildr/control_patterns/scroll_pattern.rb +1 -1
- data/lib/bewildr/control_patterns/selection_item_pattern.rb +1 -1
- data/lib/bewildr/control_patterns/selection_pattern.rb +1 -1
- data/lib/bewildr/control_patterns/table_item_pattern.rb +1 -1
- data/lib/bewildr/control_patterns/table_pattern.rb +1 -1
- data/lib/bewildr/control_patterns/text_pattern.rb +1 -1
- data/lib/bewildr/control_patterns/toggle_pattern.rb +2 -2
- data/lib/bewildr/control_patterns/value_pattern.rb +1 -1
- data/lib/bewildr/control_patterns/window_pattern.rb +1 -1
- data/lib/bewildr/control_type.rb +1 -1
- data/lib/bewildr/control_type_additions/combo_box_additions.rb +1 -1
- data/lib/bewildr/control_type_additions/data_grid_additions.rb +1 -1
- data/lib/bewildr/control_type_additions/document_additions.rb +1 -1
- data/lib/bewildr/control_type_additions/list_additions.rb +1 -1
- data/lib/bewildr/control_type_additions/menu_additions.rb +1 -1
- data/lib/bewildr/control_type_additions/menu_item_additions.rb +1 -1
- data/lib/bewildr/control_type_additions/scroll_additions.rb +2 -2
- data/lib/bewildr/control_type_additions/tab_additions.rb +1 -1
- data/lib/bewildr/control_type_additions/text_additions.rb +1 -1
- data/lib/bewildr/control_type_additions/tree_additions.rb +1 -1
- data/lib/bewildr/control_type_additions/tree_item_additions.rb +1 -1
- data/lib/bewildr/control_type_additions/window_additions.rb +1 -1
- data/lib/bewildr/element.rb +17 -1
- data/lib/bewildr/exceptions.rb +14 -1
- data/lib/bewildr/ext/extensions.rb +14 -1
- data/lib/bewildr/finder.rb +1 -1
- metadata +21 -58
- data/Rakefile +0 -53
data/lib/bewildr.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#Copyright (c) 2010, Nathaniel Ritmeyer. All rights reserved.
|
2
2
|
|
3
3
|
module Bewildr
|
4
|
-
module BewildrHelpers
|
4
|
+
module BewildrHelpers #:nodoc: all
|
5
5
|
def r_array_to_cs_array_of_strings(args)
|
6
6
|
System::Array[System::String].new(args.map {|arg| arg.to_s.to_clr_string})
|
7
7
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#Copyright (c) 2010, Nathaniel Ritmeyer. All rights reserved.
|
2
2
|
|
3
3
|
module Bewildr
|
4
|
-
module ControlPatterns
|
4
|
+
module ControlPatterns #:nodoc:
|
5
5
|
module TogglePatternForButton
|
6
6
|
#Toggle on the element
|
7
7
|
def toggle_on
|
@@ -64,7 +64,7 @@ module Bewildr
|
|
64
64
|
|
65
65
|
#These are not the toggle patterns you are looking for [wave of the hand/]. If you are dealing with a button, look for Bewildr::ControlPatterns::TogglePatternForButton.
|
66
66
|
#If you're dealing with a checkbox, take a look at Bewildr::ControlPatterns::TogglePatternForCheckBox
|
67
|
-
module TogglePattern
|
67
|
+
module TogglePattern #:nodoc:
|
68
68
|
def self.extended(base)
|
69
69
|
base.instance_eval do
|
70
70
|
case @control_type
|
data/lib/bewildr/control_type.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#Copyright (c) 2010, Nathaniel Ritmeyer. All rights reserved.
|
2
2
|
|
3
3
|
module Bewildr
|
4
|
-
class ControlType
|
4
|
+
class ControlType #:nodoc: all
|
5
5
|
class << self
|
6
6
|
def symbol_for_enum(input_control_type_enum)
|
7
7
|
raise "Unknown control type: #{input_control_type_enum}" unless @@control_type_map.value?(input_control_type_enum)
|
@@ -1,8 +1,8 @@
|
|
1
1
|
#Copyright (c) 2010, Nathaniel Ritmeyer. All rights reserved.
|
2
2
|
|
3
3
|
module Bewildr
|
4
|
-
module ControlTypeAdditions
|
5
|
-
module ScrollAdditions
|
4
|
+
module ControlTypeAdditions #:nodoc:
|
5
|
+
module ScrollAdditions #:nodoc: all
|
6
6
|
#required because when a list is displayed, UI Automation only knows
|
7
7
|
#about the visible items. This method stores where the scroll value is,
|
8
8
|
#then moves the scroller to the top of the scroll bar and proceeds to
|
data/lib/bewildr/element.rb
CHANGED
@@ -197,6 +197,22 @@ module Bewildr
|
|
197
197
|
@automation_element.current.bounding_rectangle.width.to_i
|
198
198
|
end
|
199
199
|
|
200
|
+
#Drags this element to a target element; optionally via a different element. Takes a hash with the following:
|
201
|
+
# :to => some_element
|
202
|
+
# :via => another_element (optional)
|
203
|
+
# :wait_at_via_for => seconds (optional)
|
204
|
+
#Eg:
|
205
|
+
# my_element.drag :to => some_element
|
206
|
+
#or...
|
207
|
+
# my_element.drag :via => another_element, :to => some_element
|
208
|
+
#or, if you need to hover over the via_element for 2.5 seconds:
|
209
|
+
# my_element.drag :via => another_element, :to => some_element, :wait_at_via_for => 2.5
|
210
|
+
def drag(target_details)
|
211
|
+
drag_args = target_details
|
212
|
+
drag_args[:from] = self
|
213
|
+
Bewildr::Mouse.drag(drag_args)
|
214
|
+
end
|
215
|
+
|
200
216
|
private
|
201
217
|
|
202
218
|
#Raises an exception if this element no longer exists
|
@@ -227,7 +243,7 @@ module Bewildr
|
|
227
243
|
#list of control types comes from http://msdn.microsoft.com/en-us/library/ms750574.aspx
|
228
244
|
def include_additions
|
229
245
|
#the following looks like could have performance issues, but the tests don't take any longer to execute...
|
230
|
-
potential_addition = Bewildr::ControlTypeAdditions.submodules.select {|mod| mod.name.
|
246
|
+
potential_addition = Bewildr::ControlTypeAdditions.submodules.select {|mod| mod.name.bewildr_demodulize == "#{@control_type.to_s.bewildr_classify}Additions"}.first
|
231
247
|
extend potential_addition unless potential_addition.nil?
|
232
248
|
|
233
249
|
#non-standards - move this to another method in the near future
|
data/lib/bewildr/exceptions.rb
CHANGED
@@ -1,11 +1,24 @@
|
|
1
1
|
#Copyright (c) 2010, Nathaniel Ritmeyer. All rights reserved.
|
2
2
|
|
3
3
|
module Bewildr
|
4
|
+
#Raised by a disabled element when a method is called on it assuming it is enabled
|
4
5
|
class ElementNotEnabled < StandardError; end
|
6
|
+
|
7
|
+
#Raised by an element marked as non existent when a method is called on it assuming it exists
|
5
8
|
class ElementDoesntExist < StandardError; end
|
9
|
+
|
10
|
+
#Raised by a password field element on an attempt to read its text value
|
6
11
|
class PasswordFieldReadAttempt < StandardError; end
|
12
|
+
|
13
|
+
#Raised by a combo box on trying to select an item that does not exist in its list of values
|
7
14
|
class NoSuchItemInComboBox < StandardError; end
|
15
|
+
|
16
|
+
#Raised by a list box on trying to select an item that does not exist in its list of values
|
8
17
|
class NoSuchItemInListBox < StandardError; end
|
18
|
+
|
19
|
+
#Raised by a tab group on trying to use a tab that does not exist
|
9
20
|
class NoSuchTab < StandardError; end
|
10
|
-
|
21
|
+
|
22
|
+
class InternalError < StandardError #:nodoc: all
|
23
|
+
end
|
11
24
|
end
|
@@ -3,8 +3,21 @@
|
|
3
3
|
#the following taken from: http://www.natontesting.com/2010/06/30/how-to-get-the-submodules-of-a-ruby-module/
|
4
4
|
|
5
5
|
#adds the submodules method to modules - returns a list of submodules in the module's namespace
|
6
|
-
class Module
|
6
|
+
class Module #:nodoc: all
|
7
7
|
def submodules
|
8
8
|
constants.collect {|const_name| const_get(const_name)}.select {|const| const.class == Module}
|
9
9
|
end
|
10
10
|
end
|
11
|
+
|
12
|
+
#removes need for active support
|
13
|
+
class String #:nodoc: all
|
14
|
+
#directly stolen from active support - takes the module bit off a class name
|
15
|
+
def bewildr_demodulize
|
16
|
+
gsub(/^.*::/, '')
|
17
|
+
end
|
18
|
+
|
19
|
+
#Kinda like classify from active support, but does only what's needed by bewildr
|
20
|
+
def bewildr_classify
|
21
|
+
self.split("_").collect {|word| "#{word[0].upcase}#{word[1..-1]}"}.join
|
22
|
+
end
|
23
|
+
end
|
data/lib/bewildr/finder.rb
CHANGED
@@ -5,7 +5,7 @@ module Bewildr
|
|
5
5
|
#methods that build up the parts needed for to search for elements. These methods are called by Bewildr::Element#get in
|
6
6
|
#order to get and test for existence of descendent elements in the UI element tree. All of the methods take a condition
|
7
7
|
#hash, this is made up of at least one, but can be several key/value pairs.
|
8
|
-
class Finder
|
8
|
+
class Finder #:nodoc: all
|
9
9
|
extend Bewildr::BewildrHelpers
|
10
10
|
|
11
11
|
class << self
|
metadata
CHANGED
@@ -1,52 +1,26 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: bewildr
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 13
|
10
|
-
version: 0.1.13
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.14
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Nat Ritmeyer
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
default_executable:
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
22
|
-
name: activesupport
|
23
|
-
prerelease: false
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ">="
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
hash: 7
|
30
|
-
segments:
|
31
|
-
- 3
|
32
|
-
- 0
|
33
|
-
- 0
|
34
|
-
version: 3.0.0
|
35
|
-
type: :runtime
|
36
|
-
version_requirements: *id001
|
12
|
+
date: 2011-11-06 00:00:00.000000000Z
|
13
|
+
dependencies: []
|
37
14
|
description: Test WPF UI apps with IronRuby
|
38
15
|
email: nat@natontesting.com
|
39
16
|
executables: []
|
40
|
-
|
41
17
|
extensions: []
|
42
|
-
|
43
|
-
extra_rdoc_files:
|
18
|
+
extra_rdoc_files:
|
44
19
|
- README.rdoc
|
45
20
|
- LICENSE
|
46
|
-
files:
|
21
|
+
files:
|
47
22
|
- LICENSE
|
48
23
|
- README.rdoc
|
49
|
-
- Rakefile
|
50
24
|
- lib/bewildr/application.rb
|
51
25
|
- lib/bewildr/bewildr_helpers.rb
|
52
26
|
- lib/bewildr/control_patterns/expand_collapse_pattern.rb
|
@@ -82,39 +56,28 @@ files:
|
|
82
56
|
- lib/bewildr/mouse.rb
|
83
57
|
- lib/bewildr/windows.rb
|
84
58
|
- lib/bewildr.rb
|
85
|
-
has_rdoc: true
|
86
59
|
homepage: http://www.bewildr.info
|
87
60
|
licenses: []
|
88
|
-
|
89
61
|
post_install_message:
|
90
62
|
rdoc_options: []
|
91
|
-
|
92
|
-
require_paths:
|
63
|
+
require_paths:
|
93
64
|
- lib
|
94
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
95
66
|
none: false
|
96
|
-
requirements:
|
97
|
-
- -
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
-
|
100
|
-
|
101
|
-
- 0
|
102
|
-
version: "0"
|
103
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ! '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
72
|
none: false
|
105
|
-
requirements:
|
106
|
-
- -
|
107
|
-
- !ruby/object:Gem::Version
|
108
|
-
|
109
|
-
segments:
|
110
|
-
- 0
|
111
|
-
version: "0"
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
112
77
|
requirements: []
|
113
|
-
|
114
78
|
rubyforge_project:
|
115
|
-
rubygems_version: 1.
|
79
|
+
rubygems_version: 1.8.11
|
116
80
|
signing_key:
|
117
81
|
specification_version: 3
|
118
82
|
summary: Test WPF UI apps with IronRuby
|
119
83
|
test_files: []
|
120
|
-
|
data/Rakefile
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rake'
|
3
|
-
require 'rake/clean'
|
4
|
-
require 'rake/gempackagetask'
|
5
|
-
require 'rake/rdoctask'
|
6
|
-
require 'rake/testtask'
|
7
|
-
require 'spec/rake/spectask'
|
8
|
-
require 'cucumber'
|
9
|
-
require 'cucumber/rake/task'
|
10
|
-
|
11
|
-
spec = Gem::Specification.new do |s|
|
12
|
-
s.name = 'bewildr'
|
13
|
-
s.version = '0.1.13'
|
14
|
-
s.has_rdoc = true
|
15
|
-
s.extra_rdoc_files = ['README.rdoc', 'LICENSE']
|
16
|
-
s.summary = 'Test WPF UI apps with IronRuby'
|
17
|
-
s.description = s.summary
|
18
|
-
s.author = 'Nat Ritmeyer'
|
19
|
-
s.email = 'nat@natontesting.com'
|
20
|
-
s.homepage = 'http://www.bewildr.info'
|
21
|
-
s.files = %w(LICENSE README.rdoc Rakefile) + Dir.glob("{bin,lib}/**/*")
|
22
|
-
s.require_path = "lib"
|
23
|
-
s.bindir = "bin"
|
24
|
-
s.add_dependency('activesupport', '>= 3.0.0')
|
25
|
-
end
|
26
|
-
|
27
|
-
Rake::GemPackageTask.new(spec) do |p|
|
28
|
-
p.gem_spec = spec
|
29
|
-
p.need_tar = true
|
30
|
-
p.need_zip = true
|
31
|
-
end
|
32
|
-
|
33
|
-
Rake::RDocTask.new do |rdoc|
|
34
|
-
files =['README.rdoc', 'LICENSE', 'lib/**/*.rb']
|
35
|
-
rdoc.rdoc_files.add(files)
|
36
|
-
rdoc.main = "README.rdoc" # page to start on
|
37
|
-
rdoc.title = "bewildr Docs"
|
38
|
-
rdoc.rdoc_dir = 'doc/rdoc' # rdoc output folder
|
39
|
-
rdoc.options << '--line-numbers'
|
40
|
-
end
|
41
|
-
|
42
|
-
Rake::TestTask.new do |t|
|
43
|
-
t.test_files = FileList['test/**/*.rb']
|
44
|
-
end
|
45
|
-
|
46
|
-
Spec::Rake::SpecTask.new do |t|
|
47
|
-
t.spec_files = FileList['spec/**/*.rb']
|
48
|
-
t.libs << Dir["lib"]
|
49
|
-
end
|
50
|
-
|
51
|
-
Cucumber::Rake::Task.new(:features) do |t|
|
52
|
-
t.cucumber_opts = "--format pretty -q"
|
53
|
-
end
|