sapphire 0.8.0 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sapphire.rb +4 -4
- data/lib/sapphire/Adapters/Selenium/RubySeleniumWebDriver.rb +83 -38
- data/lib/sapphire/Extensions/Object.rb +1 -1
- data/lib/sapphire/Extensions/String.rb +9 -5
- data/lib/sapphire/{Observable.rb → Pluggable.rb} +11 -10
- data/lib/sapphire/Plugins.rb +6 -0
- data/lib/sapphire/{Observers → Plugins/Debugging}/VerboseObserver.rb +2 -2
- data/lib/sapphire/Plugins/FireBug/FirebugPlugin.rb +37 -0
- data/lib/sapphire/{Observers → Plugins/Highlighters}/FailedControlHighlighter.rb +2 -2
- data/lib/sapphire/Plugins/Highlighters/FailedControlToolTip.rb +114 -0
- data/lib/sapphire/{Observers → Plugins/Highlighters}/Highlighter.rb +2 -2
- data/lib/sapphire/{Observers → Plugins/Highlighters}/PassedControlHighlighter.rb +2 -2
- data/lib/sapphire/{Observers/Observer.rb → Plugins/Plugin.rb} +2 -4
- data/lib/sapphire/{Observers/ObserverRepository.rb → Plugins/PluginRepository.rb} +3 -3
- data/lib/sapphire/WebAbstractions/Browsers/InternetExplorer.rb +1 -1
- data/lib/sapphire/WebAbstractions/Controls/Base/Control.rb +18 -26
- data/lib/sapphire/WebAbstractions/Controls/DropDown.rb +5 -3
- data/lib/sapphire/version.rb +1 -1
- metadata +18 -16
- data/lib/sapphire/Observers.rb +0 -2
data/lib/sapphire.rb
CHANGED
@@ -7,7 +7,7 @@ require 'selenium-webdriver'
|
|
7
7
|
require 'delegate'
|
8
8
|
require 'Forwardable'
|
9
9
|
|
10
|
-
require 'sapphire/
|
10
|
+
require 'sapphire/Pluggable'
|
11
11
|
require 'sapphire/Adapters'
|
12
12
|
require 'sapphire/Testing'
|
13
13
|
require 'sapphire/Web'
|
@@ -18,7 +18,7 @@ require 'sapphire/Configuration'
|
|
18
18
|
require 'sapphire/Data'
|
19
19
|
require 'sapphire/Virtualization'
|
20
20
|
require 'sapphire/TeamCity'
|
21
|
-
require 'sapphire/
|
21
|
+
require 'sapphire/Plugins'
|
22
22
|
|
23
23
|
module Sapphire
|
24
24
|
module Sapphire
|
@@ -35,7 +35,7 @@ module Sapphire
|
|
35
35
|
include WebAbstractions
|
36
36
|
include Testing
|
37
37
|
include Testing::TeamCity
|
38
|
-
include
|
38
|
+
include Plugins
|
39
39
|
include UI
|
40
40
|
end
|
41
41
|
end
|
@@ -45,7 +45,7 @@ $driver = Sapphire::WebAbstractions::MetaBrowser.new(nil)
|
|
45
45
|
Sapphire.sub_modules.each do |m|
|
46
46
|
m.sub_classes.each do |s|
|
47
47
|
m.const_get(s).observe() if m.const_get(s).respond_to? :observe
|
48
|
-
Sapphire::
|
48
|
+
Sapphire::Plugins::PluginRepository.instance.Add(m.const_get(s).new) if m.const_get(s).respond_to? :IsObserver
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -92,7 +92,7 @@ module Sapphire
|
|
92
92
|
def CurrentUrl
|
93
93
|
wait = Selenium::WebDriver::Wait.new(:timeout => 60)
|
94
94
|
url = wait.until { x = self.Browser().current_url
|
95
|
-
|
95
|
+
x unless x == nil
|
96
96
|
}
|
97
97
|
|
98
98
|
url
|
@@ -175,65 +175,110 @@ module Sapphire
|
|
175
175
|
return temp
|
176
176
|
end
|
177
177
|
|
178
|
-
def FindItem(
|
178
|
+
def FindItem(array, comparator = nil)
|
179
179
|
|
180
180
|
x = nil
|
181
|
+
by = nil
|
182
|
+
value = nil
|
183
|
+
|
184
|
+
array.each do |item|
|
185
|
+
|
186
|
+
if item.is_a? Hash
|
187
|
+
begin
|
188
|
+
x = self.FindElement item.keys.first, item.fetch(item.keys.first)
|
189
|
+
by = item.keys.first
|
190
|
+
value = item.fetch(item.keys.first)
|
191
|
+
rescue
|
192
|
+
#do nothing, let it keep looping
|
193
|
+
end
|
194
|
+
end
|
181
195
|
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
196
|
+
if item.is_a? Array
|
197
|
+
x = self.FindElement item[0], item[1]
|
198
|
+
by = item[0]
|
199
|
+
value = item[1]
|
200
|
+
end
|
187
201
|
|
188
|
-
|
189
|
-
|
202
|
+
return x, by, value if x != nil
|
203
|
+
return x, by, value if comparator.Compare(x != nil, true) if comparator != nil
|
204
|
+
|
205
|
+
end if array.is_a? Array
|
206
|
+
|
207
|
+
if array.is_a? Hash
|
208
|
+
x = self.FindElement array.keys.first, array.fetch(array.keys.first)
|
209
|
+
by = item.keys.first
|
210
|
+
value = item.fetch(item.keys.first)
|
211
|
+
end
|
212
|
+
return x, by, value if x != nil
|
213
|
+
return x, by, value if comparator.Compare(x != nil, true) if comparator != nil
|
190
214
|
|
191
215
|
end
|
192
216
|
|
193
|
-
def FindItemWithWait(
|
217
|
+
def FindItemWithWait(array, comparator=nil)
|
194
218
|
masterWait = Selenium::WebDriver::Wait.new(:timeout => 20)
|
195
219
|
|
196
|
-
element = masterWait.until {
|
197
|
-
x = FindItem(
|
198
|
-
return x if x != nil
|
199
|
-
return x if comparator.Compare(x != nil, true) if comparator != nil
|
220
|
+
element, by, value = masterWait.until {
|
221
|
+
x, by, value = FindItem(array, comparator)
|
222
|
+
return x, by, value if x != nil
|
223
|
+
return x, by, value if comparator.Compare(x != nil, true) if comparator != nil
|
200
224
|
}
|
201
225
|
|
202
|
-
return element if element != nil
|
203
|
-
return element if comparator.Compare(element != nil, true) if comparator != nil
|
204
|
-
|
205
|
-
raise "Could not find control using lookup #{by} and value #{value}."
|
226
|
+
return element, by, value if element != nil
|
227
|
+
return element, by, value if comparator.Compare(element != nil, true) if comparator != nil
|
228
|
+
raise "Could not find control for array: " + array.to_s
|
206
229
|
|
207
230
|
end
|
208
231
|
|
209
|
-
def FindItemWithoutWait(
|
232
|
+
def FindItemWithoutWait(array, comparator=nil)
|
210
233
|
|
211
|
-
element = FindItem(
|
234
|
+
element, by, value = FindItem(array, comparator)
|
212
235
|
|
213
|
-
return element if element != nil
|
214
|
-
return element if comparator.Compare(element != nil, true) if comparator != nil
|
215
|
-
raise "Could not find control
|
236
|
+
return element, by, value if element != nil
|
237
|
+
return element, by, value if comparator.Compare(element != nil, true) if comparator != nil
|
238
|
+
raise "Could not find control for array: " + array.to_s
|
216
239
|
|
217
240
|
end
|
218
241
|
|
219
|
-
def FindAllItems(
|
242
|
+
def FindAllItems(array)
|
220
243
|
masterWait = Selenium::WebDriver::Wait.new(:timeout => 20)
|
221
244
|
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
245
|
+
x = nil
|
246
|
+
by = nil
|
247
|
+
value = nil
|
248
|
+
|
249
|
+
element, by, value = masterWait.until {
|
250
|
+
|
251
|
+
array.each do |item|
|
252
|
+
|
253
|
+
if item.is_a? Hash
|
254
|
+
begin
|
255
|
+
x = self.FindElements item.keys.first, item.fetch(item.keys.first)
|
256
|
+
x = nil if x.is_a? Array and x.empty?
|
257
|
+
|
258
|
+
if !x.nil?
|
259
|
+
by = item.keys.first
|
260
|
+
value = item[item.keys.first]
|
261
|
+
end
|
262
|
+
rescue
|
263
|
+
#do nothing, let it keep looping
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
x, by, value = self.FindElements item[0], item[1] if item.is_a? Array
|
226
268
|
x = nil if x.is_a? Array and x.empty?
|
227
|
-
|
228
|
-
#do nothing, let it keep looping
|
229
|
-
end
|
269
|
+
return x, by, value if x != nil
|
230
270
|
|
231
|
-
|
232
|
-
return x if x != nil
|
271
|
+
end if array.is_a? Array
|
233
272
|
|
273
|
+
x = self.FindElement array.keys.first, array.fetch(array.keys.first) if array.is_a? Hash
|
274
|
+
if !x.nil?
|
275
|
+
by = item.keys.first
|
276
|
+
value = item[item.keys.first]
|
277
|
+
end
|
278
|
+
return x, by, value if x != nil
|
234
279
|
}
|
235
|
-
return element if element != nil
|
236
|
-
raise "Could not find control
|
280
|
+
return element, by, value if element != nil
|
281
|
+
raise "Could not find control for array: " + array.to_s
|
237
282
|
end
|
238
283
|
|
239
284
|
def FindElement(discriminator, selector)
|
@@ -248,11 +293,11 @@ module Sapphire
|
|
248
293
|
self.Browser().execute_script(script)
|
249
294
|
end
|
250
295
|
|
251
|
-
def Create(
|
252
|
-
Selenium::WebDriver.for
|
296
|
+
def Create(*args)
|
297
|
+
Selenium::WebDriver.for *args
|
253
298
|
end
|
254
299
|
|
255
|
-
include Sapphire::
|
300
|
+
include Sapphire::Pluggable
|
256
301
|
end
|
257
302
|
end
|
258
303
|
end
|
@@ -3,15 +3,19 @@ class String
|
|
3
3
|
alias_method :"plus", :"+"
|
4
4
|
|
5
5
|
def underscore
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
self.gsub(/::/, '/').
|
7
|
+
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
8
|
+
gsub(/([a-z\d])([A-Z])/,'\1_\2').
|
9
|
+
tr("-", "_").
|
10
|
+
downcase
|
11
11
|
end
|
12
12
|
|
13
13
|
def +(item)
|
14
|
+
|
15
|
+
return plus("") if item.nil?
|
16
|
+
return plus(item) if item.is_a? String
|
14
17
|
return plus(Parameter(item)) if Sapphire::DSL::TestPlans::Parameters.instance.Contains(item)
|
18
|
+
|
15
19
|
raise "No Parameter defined for: " << item.to_s if item.is_a? Symbol and !item.nil?
|
16
20
|
|
17
21
|
plus(item)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Sapphire
|
2
|
-
module
|
2
|
+
module Pluggable
|
3
3
|
def self.intercept(base, hash, *method_names)
|
4
4
|
do_before = proc { |name, inst, args|
|
5
5
|
begin
|
@@ -36,16 +36,16 @@ module Sapphire
|
|
36
36
|
method_names.each do |method_name|
|
37
37
|
method = base.instance_method(method_name)
|
38
38
|
base.send :define_method, method_name.to_sym do |*args, &method_block|
|
39
|
-
do_before.call(method_name, self, args)
|
39
|
+
do_before.call(method_name, self, args)
|
40
40
|
begin
|
41
|
-
result =
|
42
|
-
do_on_success.call(method_name, self, args)
|
41
|
+
result = method.bind(self).(*args, &method_block)
|
42
|
+
do_on_success.call(method_name, self, args)
|
43
43
|
return result
|
44
44
|
rescue => raised_exception
|
45
|
-
do_on_failure.call(method_name, self, raised_exception, args)
|
45
|
+
do_on_failure.call(method_name, self, raised_exception, args)
|
46
46
|
raise raised_exception
|
47
47
|
ensure
|
48
|
-
do_after.call(method_name, self, args)
|
48
|
+
do_after.call(method_name, self, args)
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
@@ -53,27 +53,28 @@ module Sapphire
|
|
53
53
|
|
54
54
|
def self.included(base)
|
55
55
|
before = proc { |name, inst, args|
|
56
|
-
observers =
|
56
|
+
observers = Plugins::PluginRepository.instance.Find(name.to_sym, inst.class)
|
57
57
|
observers.each do |x| x.Before(inst, name, args) if x.respond_to? :Before end
|
58
58
|
}
|
59
59
|
|
60
60
|
after = proc { |name, inst, args|
|
61
|
-
observers =
|
61
|
+
observers = Plugins::PluginRepository.instance.Find(name.to_sym, inst.class)
|
62
62
|
observers.each do |x| x.After(inst, name, args) if x.respond_to? :After end
|
63
63
|
}
|
64
64
|
|
65
65
|
success = proc { |name, inst, args|
|
66
|
-
observers =
|
66
|
+
observers = Plugins::PluginRepository.instance.Find(name.to_sym, inst.class)
|
67
67
|
observers.each do |x| x.OnSuccess(inst, name, args) if x.respond_to? :OnSuccess end
|
68
68
|
}
|
69
69
|
|
70
70
|
|
71
71
|
failure = proc { |name, inst, exception, args|
|
72
|
-
observers =
|
72
|
+
observers = Plugins::PluginRepository.instance.Find(name.to_sym, inst.class)
|
73
73
|
observers.each do |x| x.OnFailure(inst, name, exception, args) if x.respond_to? :OnFailure end
|
74
74
|
}
|
75
75
|
|
76
76
|
|
77
|
+
|
77
78
|
hash = {}
|
78
79
|
|
79
80
|
hash.merge! :before => before,
|
@@ -0,0 +1,6 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) +'/Plugins/Plugin.rb', __FILE__)
|
2
|
+
Dir[File.dirname(__FILE__) + '/Plugins/*.rb'].each {|file| require file }
|
3
|
+
Dir[File.dirname(__FILE__) + '/Plugins/FireBug/*.rb'].each {|file| require file }
|
4
|
+
Dir[File.dirname(__FILE__) + '/Plugins/Browser/*.rb'].each {|file| require file }
|
5
|
+
Dir[File.dirname(__FILE__) + '/Plugins/Debugging/*.rb'].each {|file| require file }
|
6
|
+
Dir[File.dirname(__FILE__) + '/Plugins/Highlighters/*.rb'].each {|file| require file }
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Sapphire
|
2
|
+
module Plugins
|
3
|
+
|
4
|
+
class FirebugPlugin < Plugin
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
|
8
|
+
observes :class => WebAbstractions::FireFoxBrowser,
|
9
|
+
:method => :Create
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
def Before(instance, method, args)
|
14
|
+
return if ENV["firebug"] != "true"
|
15
|
+
profile = Selenium::WebDriver::Firefox::Profile.new
|
16
|
+
version = '1.9.1'
|
17
|
+
profile.add_extension(File.expand_path("../firebug-#{version}.xpi", __FILE__))
|
18
|
+
|
19
|
+
profile["extensions.firebug.currentVersion"] = "999"
|
20
|
+
profile["extensions.firebug.allPagesActivation"] = "on"
|
21
|
+
['console', 'net', 'script'].each do |feature|
|
22
|
+
profile["extensions.firebug.#{feature}.enableSites"] = true
|
23
|
+
end
|
24
|
+
|
25
|
+
profile["extensions.firebug.previousPlacement"] = 3
|
26
|
+
|
27
|
+
args << { :profile => profile }
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.IsObserver()
|
31
|
+
true
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
module Sapphire
|
2
|
+
module Plugins
|
3
|
+
|
4
|
+
class FailedControlToolTip < Plugin
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
|
8
|
+
observes :class => DSL::ControlEvaluation,
|
9
|
+
:method => :Passed
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
def Before(instance, method, args)
|
14
|
+
return if ENV["highlighter"] != "true"
|
15
|
+
|
16
|
+
control = args[0]
|
17
|
+
discriminator = control.found_by_type
|
18
|
+
selector = control.found_by_value
|
19
|
+
|
20
|
+
begin
|
21
|
+
query = Query(discriminator, selector)
|
22
|
+
|
23
|
+
#js = "var wrapper = document.createElement('div');
|
24
|
+
# var toolTip = document.createElement('div');
|
25
|
+
# toolTip.innerHTML = 'Test!';
|
26
|
+
# wrapper.style.position = 'relative';
|
27
|
+
# toolTip.style.position = 'absolute';
|
28
|
+
# toolTip.style.bottom = '100%';
|
29
|
+
# toolTip.style.left = '50%';
|
30
|
+
# toolTip.style.marginLeft = '-150px';
|
31
|
+
# toolTip.style.width = '100px';
|
32
|
+
# toolTip.style.backgroundColor = '#eee;'
|
33
|
+
# toolTip.style.border = '1px solid #555;'
|
34
|
+
# toolTip.style.borderRadius = '5px';
|
35
|
+
# toolTip.style.padding = '5px';
|
36
|
+
# var myDiv = #{query};
|
37
|
+
# wrapper.appendChild(toolTip);
|
38
|
+
# wrapper.appendChild(myDiv.cloneNode(true));
|
39
|
+
# myDiv.parentNode.replaceChild(wrapper, myDiv);"
|
40
|
+
#
|
41
|
+
#$driver.ExecuteScript(js)
|
42
|
+
|
43
|
+
$driver.ExecuteScript "var tooltip=function(){
|
44
|
+
var id = 'tt';
|
45
|
+
var top = 3;
|
46
|
+
var left = 3;
|
47
|
+
var maxw = 300;
|
48
|
+
var speed = 10;
|
49
|
+
var timer = 20;
|
50
|
+
var endalpha = 95;
|
51
|
+
var alpha = 0;
|
52
|
+
var tt,t,c,b,h;
|
53
|
+
var ie = document.all ? true : false;
|
54
|
+
return{
|
55
|
+
show:function(obj, v,w){
|
56
|
+
if(tt == null){
|
57
|
+
var myDiv = obj;
|
58
|
+
tt = document.createElement('div');
|
59
|
+
tt.setAttribute('id',id);
|
60
|
+
tt.style.top = myDiv.style.top - 50;
|
61
|
+
tt.style.left = myDiv.style.left;
|
62
|
+
t = document.createElement('div');
|
63
|
+
t.setAttribute('id',id + 'top');
|
64
|
+
c = document.createElement('div');
|
65
|
+
c.setAttribute('id',id + 'cont');
|
66
|
+
b = document.createElement('div');
|
67
|
+
b.setAttribute('id',id + 'bot');
|
68
|
+
tt.appendChild(t);
|
69
|
+
tt.appendChild(c);
|
70
|
+
tt.appendChild(b);
|
71
|
+
document.body.appendChild(tt);
|
72
|
+
}
|
73
|
+
tt.style.display = 'block';
|
74
|
+
c.innerHTML = v;
|
75
|
+
tt.style.width = w ? w + 'px' : 'auto';
|
76
|
+
if(!w && ie){
|
77
|
+
t.style.display = 'none';
|
78
|
+
b.style.display = 'none';
|
79
|
+
tt.style.width = tt.offsetWidth;
|
80
|
+
t.style.display = 'block';
|
81
|
+
b.style.display = 'block';
|
82
|
+
}
|
83
|
+
if(tt.offsetWidth > maxw){tt.style.width = maxw + 'px'}
|
84
|
+
h = parseInt(tt.offsetHeight) + top;
|
85
|
+
}
|
86
|
+
};
|
87
|
+
}();" if !$toolTipInserted
|
88
|
+
$toolTipInserted = true
|
89
|
+
|
90
|
+
$driver.executeScript("tooltip.show(#{query})")
|
91
|
+
rescue
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
|
96
|
+
def Query(discriminator, selector)
|
97
|
+
|
98
|
+
if(discriminator == :id)
|
99
|
+
return "document.getElementById('#{selector}')"
|
100
|
+
elsif (discriminator == :name )
|
101
|
+
return "document.getElementByName('#{selector}')"
|
102
|
+
elsif (discriminator == :xpath)
|
103
|
+
return "document.evaluate( '#{selector}', document, null, XPathResult.ANY_TYPE, null ).iterateNext()"
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
#def self.IsObserver()
|
108
|
+
# true
|
109
|
+
#end
|
110
|
+
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
114
|
+
end
|
@@ -1,16 +1,14 @@
|
|
1
1
|
module Sapphire
|
2
|
-
module
|
2
|
+
module Plugins
|
3
3
|
|
4
|
-
class
|
4
|
+
class Plugin
|
5
5
|
|
6
6
|
attr_reader :object
|
7
7
|
attr_reader :method
|
8
|
-
attr_reader :on_match
|
9
8
|
|
10
9
|
def observes(hash)
|
11
10
|
@object = hash[:class]
|
12
11
|
@method = hash[:method]
|
13
|
-
@on_match = hash[:on_match]
|
14
12
|
end
|
15
13
|
|
16
14
|
def self.observe()
|
@@ -2,38 +2,30 @@ module Sapphire
|
|
2
2
|
module WebAbstractions
|
3
3
|
class Control
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
attr_accessor :found_by_type
|
6
|
+
attr_accessor :found_by_value
|
7
7
|
|
8
8
|
def initialize(args)
|
9
9
|
return if args.nil?
|
10
|
+
@array = args
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
end if args.is_a? Array
|
17
|
-
|
18
|
-
@hash = hash
|
19
|
-
@by = hash.keys.first
|
20
|
-
@value = hash[hash.keys.first]
|
21
|
-
@control = hash.fetch :instance if hash.has_key? :instance
|
22
|
-
|
23
|
-
@found_by_type = @by
|
24
|
-
@found_by_value = @value
|
12
|
+
if args.is_a? Hash
|
13
|
+
@control = args.fetch :instance if args.has_key? :instance
|
14
|
+
@found_by_type = @by
|
15
|
+
@found_by_value = @value
|
16
|
+
end
|
25
17
|
end
|
26
18
|
|
27
19
|
def Find(comparator = nil)
|
28
|
-
@control
|
20
|
+
@control, @found_by_type, @found_by_value = $driver.FindItemWithWait(@array, comparator) if @control.nil?
|
29
21
|
@control
|
30
22
|
end
|
31
23
|
|
32
24
|
def FindAll
|
33
|
-
items = $driver.FindAllItems(@
|
25
|
+
items, @found_by_type, @found_by_value = $driver.FindAllItems(@array)
|
34
26
|
list = []
|
35
27
|
items.each do |item|
|
36
|
-
hash = {@
|
28
|
+
hash = {@found_by_type => @found_by_value, :instance => item}
|
37
29
|
list << Control.new(hash)
|
38
30
|
end
|
39
31
|
|
@@ -41,7 +33,7 @@ module Sapphire
|
|
41
33
|
end
|
42
34
|
|
43
35
|
def FindWithoutWait(comparator = nil)
|
44
|
-
$driver.FindItemWithoutWait(@
|
36
|
+
$driver.FindItemWithoutWait(@array, comparator)
|
45
37
|
end
|
46
38
|
|
47
39
|
def Text
|
@@ -55,12 +47,12 @@ module Sapphire
|
|
55
47
|
end
|
56
48
|
|
57
49
|
def MouseOver
|
58
|
-
if(@
|
59
|
-
$driver.ExecuteScript("document.getElementById('"+ @
|
60
|
-
elsif (@
|
61
|
-
$driver.ExecuteScript("document.getElementByName('"+ @
|
62
|
-
elsif (@
|
63
|
-
$driver.ExecuteScript("document.evaluate( '" + @
|
50
|
+
if(@found_by_type == :id)
|
51
|
+
$driver.ExecuteScript("document.getElementById('"+ @found_by_value +"').style.visibility = 'visible'; ")
|
52
|
+
elsif (@found_by_type == :name)
|
53
|
+
$driver.ExecuteScript("document.getElementByName('"+ @found_by_value +"').style.visibility = 'visible'; ")
|
54
|
+
elsif (@found_by_type == :xpath)
|
55
|
+
$driver.ExecuteScript("document.evaluate( '" + @found_by_value + "', document, null, XPathResult.ANY_TYPE, null ).iterateNext().style.visibility = 'visible'; ")
|
64
56
|
end
|
65
57
|
|
66
58
|
sleep(1)
|
@@ -45,9 +45,11 @@ module Sapphire
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def Clear
|
48
|
-
|
49
|
-
|
50
|
-
|
48
|
+
@array.each do |item|
|
49
|
+
if item.has_key? :default
|
50
|
+
self.Set(item[:default])
|
51
|
+
return
|
52
|
+
end
|
51
53
|
end
|
52
54
|
|
53
55
|
raise "no :default set for DropDown"
|
data/lib/sapphire/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sapphire
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
12
|
+
date: 2012-06-23 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: selenium-webdriver
|
16
|
-
requirement: &
|
16
|
+
requirement: &26772360 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *26772360
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: colorize
|
27
|
-
requirement: &
|
27
|
+
requirement: &26772108 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *26772108
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: Platform
|
38
|
-
requirement: &
|
38
|
+
requirement: &26771856 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *26771856
|
47
47
|
description: An automated web acceptance test framework for non-technical resources
|
48
48
|
using selenium-wedriver.
|
49
49
|
email:
|
@@ -179,14 +179,16 @@ files:
|
|
179
179
|
- lib/sapphire/Extensions/Symbol.rb
|
180
180
|
- lib/sapphire/Extensions.rb
|
181
181
|
- lib/sapphire/JobAbstractions/Job.rb
|
182
|
-
- lib/sapphire/
|
183
|
-
- lib/sapphire/
|
184
|
-
- lib/sapphire/
|
185
|
-
- lib/sapphire/
|
186
|
-
- lib/sapphire/
|
187
|
-
- lib/sapphire/
|
188
|
-
- lib/sapphire/
|
189
|
-
- lib/sapphire/
|
182
|
+
- lib/sapphire/Pluggable.rb
|
183
|
+
- lib/sapphire/Plugins/Debugging/VerboseObserver.rb
|
184
|
+
- lib/sapphire/Plugins/FireBug/FirebugPlugin.rb
|
185
|
+
- lib/sapphire/Plugins/Highlighters/FailedControlHighlighter.rb
|
186
|
+
- lib/sapphire/Plugins/Highlighters/FailedControlToolTip.rb
|
187
|
+
- lib/sapphire/Plugins/Highlighters/Highlighter.rb
|
188
|
+
- lib/sapphire/Plugins/Highlighters/PassedControlHighlighter.rb
|
189
|
+
- lib/sapphire/Plugins/Plugin.rb
|
190
|
+
- lib/sapphire/Plugins/PluginRepository.rb
|
191
|
+
- lib/sapphire/Plugins.rb
|
190
192
|
- lib/sapphire/TeamCity/RubyMineReporter.rb
|
191
193
|
- lib/sapphire/TeamCity/TeamCityReporter.rb
|
192
194
|
- lib/sapphire/TeamCity.rb
|
data/lib/sapphire/Observers.rb
DELETED