sapphire 0.8.6 → 0.8.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -56,7 +56,7 @@ class Symbol
56
56
 
57
57
  def Show(item, comparator)
58
58
  Examine(item, comparator) do |field, value|
59
- field.Visible
59
+ field.Visible true, comparator
60
60
  end
61
61
  end
62
62
 
@@ -70,7 +70,6 @@ class Symbol
70
70
 
71
71
  element = field.Find(comparator)
72
72
  return Evaluation.new(true, true) if element.nil? and comparator.Compare(true, false)
73
-
74
73
  return Fix(field.Evaluate(key, item, comparator, block), comparator)
75
74
  end
76
75
 
@@ -19,11 +19,11 @@ module Sapphire
19
19
 
20
20
  begin
21
21
  if(discriminator == :id)
22
- $driver.ExecuteScript("document.getElementById('#{selector}').style.border = '1px solid #FF0000'; ")
22
+ $driver.ExecuteScript("document.getElementById('#{selector}').style.backgroundColor = '#FF0000'; ")
23
23
  elsif (discriminator == :name )
24
- $driver.ExecuteScript("document.getElementByName('#{selector}').style.border = '1px solid #FF0000'; ")
24
+ $driver.ExecuteScript("document.getElementByName('#{selector}').style.backgroundColor = '#FF0000'; ")
25
25
  elsif (discriminator == :xpath)
26
- $driver.ExecuteScript("document.evaluate( '#{selector}', document, null, XPathResult.ANY_TYPE, null ).iterateNext().style.border = '1px solid #FF0000'; ")
26
+ $driver.ExecuteScript("document.evaluate( '#{selector}', document, null, XPathResult.ANY_TYPE, null ).iterateNext().style.backgroundColor = '#FF0000'; ")
27
27
  end
28
28
 
29
29
  rescue
@@ -20,11 +20,11 @@ module Sapphire
20
20
 
21
21
  begin
22
22
  if(discriminator == :id)
23
- $driver.ExecuteScript("document.getElementById('#{selector}').style.border = '1px solid #00FF00'; ")
23
+ $driver.ExecuteScript("document.getElementById('#{selector}').style.backgroundColor = '#00FF00'; ")
24
24
  elsif (discriminator == :name )
25
- $driver.ExecuteScript("document.getElementByName('#{selector}').style.border = '1px solid #00FF00'; ")
25
+ $driver.ExecuteScript("document.getElementByName('#{selector}').style.backgroundColor = '#00FF00'; ")
26
26
  elsif (discriminator == :xpath)
27
- $driver.ExecuteScript("document.evaluate( '#{selector}', document, null, XPathResult.ANY_TYPE, null ).iterateNext().style.border = '1px solid #00FF00'; ")
27
+ $driver.ExecuteScript("document.evaluate( '#{selector}', document, null, XPathResult.ANY_TYPE, null ).iterateNext().style.backgroundColor = '#00FF00'; ")
28
28
  end
29
29
 
30
30
  rescue
@@ -9,7 +9,8 @@ module Sapphire
9
9
  $driver.SetAlert(text)
10
10
  end
11
11
 
12
- def Visible()
12
+ def Visible(shouldWait = true, comparator = nil)
13
+ return Evaluation.new(comparator.Compare($driver.AlertShown(), true), true) if !comparator.nil?
13
14
  Evaluation.new($driver.AlertShown(), true)
14
15
  end
15
16
 
@@ -61,9 +61,10 @@ module Sapphire
61
61
  sleep(1)
62
62
  end
63
63
 
64
- def Visible(shouldWait = true)
65
- control = self.Find if shouldWait
66
- control = self.FindWithoutWait if !shouldWait
64
+ def Visible(shouldWait = true, comparator = nil)
65
+ control = self.Find comparator if shouldWait
66
+ control = self.FindWithoutWait comparator if !shouldWait
67
+ return ControlEvaluation.new(comparator.Compare(control.displayed?, true), true, self) if !comparator.nil?
67
68
  ControlEvaluation.new(control.displayed?, true, self)
68
69
  end
69
70
 
@@ -99,12 +100,12 @@ module Sapphire
99
100
  evaluation = block.call(self, value)
100
101
 
101
102
  wait = Selenium::WebDriver::Wait.new(:timeout => timeout)
102
- result = wait.until {
103
- evaluation = block.call(self, value)
104
- y = evaluation.Evaluate()
105
- comparator = EqualsComparison.new(evaluation) if evaluation == nil
106
- evaluation if comparator.Compare(y == true, true)
107
- }
103
+ result = wait.until {
104
+ evaluation = block.call(self, value)
105
+ y = evaluation.Evaluate()
106
+ comparator = EqualsComparison.new(evaluation) if evaluation == nil
107
+ evaluation if comparator.Compare(y == true, true)
108
+ }
108
109
 
109
110
  return result
110
111
  rescue
@@ -17,8 +17,8 @@ module Sapphire
17
17
  return ControlEvaluation.new(val != nil, true, self)
18
18
  end
19
19
 
20
- def Visible
21
- radio = self.Find
20
+ def Visible(shouldWait = true, comparator = nil)
21
+ radio = self.Find comparator
22
22
  x = radio.attribute("disabled")
23
23
  ControlEvaluation.new((x == "false" || x.nil?), true, self)
24
24
  end
@@ -1,3 +1,3 @@
1
1
  module Sapphire
2
- VERSION = "0.8.6"
2
+ VERSION = "0.8.7"
3
3
  end
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.6
4
+ version: 0.8.7
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-10-08 00:00:00.000000000Z
12
+ date: 2012-10-11 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: selenium-webdriver
16
- requirement: &27803976 !ruby/object:Gem::Requirement
16
+ requirement: &22494372 !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: *27803976
24
+ version_requirements: *22494372
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: ffi
27
- requirement: &27803676 !ruby/object:Gem::Requirement
27
+ requirement: &23007840 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - =
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.0.9
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *27803676
35
+ version_requirements: *23007840
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: colorize
38
- requirement: &27803424 !ruby/object:Gem::Requirement
38
+ requirement: &23020320 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *27803424
46
+ version_requirements: *23020320
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: Platform
49
- requirement: &27803148 !ruby/object:Gem::Requirement
49
+ requirement: &23032620 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *27803148
57
+ version_requirements: *23032620
58
58
  description: An automated web acceptance test framework for non-technical resources
59
59
  using selenium-wedriver.
60
60
  email: