sapphire 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -27,7 +27,6 @@ module Sapphire
27
27
  include DSL::Data
28
28
  include DSL::TestPlans
29
29
  include DSL::Events
30
- include Configuration::AttrMethods
31
30
  include Configuration
32
31
  include DataAbstractions
33
32
  include JobAbstractions
@@ -1,4 +1,3 @@
1
- require File.expand_path('attrmethods', File.dirname(__FILE__))
2
1
  require 'ostruct'
3
2
 
4
3
  module Sapphire
@@ -26,7 +26,7 @@ module Sapphire
26
26
  end
27
27
 
28
28
  def Differ(comparator)
29
- return Fix(DifferComparison.new(Evaluation.new(@compare1.sec + @value, @compare2.sec)), comparator)
29
+ return Fix(DifferComparison.new(Evaluation.new(@compare1 + @value, @compare2)), comparator)
30
30
  end
31
31
 
32
32
  def Fix(evaluation, comparator)
@@ -4,15 +4,17 @@ module Sapphire
4
4
 
5
5
  attr_reader :field
6
6
 
7
- def initialize(field, page)
7
+ def initialize(field, page, message)
8
8
  @field = field
9
9
  @page = page
10
+ @message = message
10
11
  end
11
12
 
12
13
  def Output()
13
14
  messages = []
14
15
 
15
16
  messages << "Cannot find control matching " + @field.to_s + " for page " + @page.to_s
17
+ messages << "Reason: " + @message
16
18
 
17
19
  raise ExpectationException.new(messages)
18
20
  end
@@ -16,7 +16,7 @@ class Hash < Object
16
16
  return FieldNotDefinedEvaluation.new(key, $page) if !$page.Contains key
17
17
 
18
18
  begin
19
- return FieldNotFoundEvaluation.new(key, $page) if field == nil
19
+ return FieldNotFoundEvaluation.new(key, $page, "selenium could not find the field") if field == nil
20
20
 
21
21
  begin
22
22
  wait = Selenium::WebDriver::Wait.new(:timeout => 5)
@@ -28,12 +28,12 @@ class Hash < Object
28
28
  }
29
29
 
30
30
  return Fix(result, comparator)
31
- rescue
32
- return FieldNotFoundEvaluation.new(key, $page)
31
+ rescue => e
32
+ return FieldNotFoundEvaluation.new(key, $page, e.to_s)
33
33
  end
34
34
 
35
- rescue
36
- return FieldNotFoundEvaluation.new(key, $page)
35
+ rescue => e
36
+ return FieldNotFoundEvaluation.new(key, $page, e.to_s)
37
37
  end
38
38
  end
39
39
 
@@ -68,7 +68,7 @@ class Symbol
68
68
  return FieldNotDefinedEvaluation.new(key, $page) if !$page.Contains key
69
69
 
70
70
  begin
71
- return FieldNotFoundEvaluation.new(key, $page) if field == nil
71
+ return FieldNotFoundEvaluation.new(key, $page, "selenium could not find the field") if field == nil
72
72
 
73
73
  begin
74
74
  wait = Selenium::WebDriver::Wait.new(:timeout => 5)
@@ -79,12 +79,12 @@ class Symbol
79
79
 
80
80
 
81
81
  return Fix(Evaluation.new(block.call(field), true), comparator)
82
- rescue
83
- return FieldNotFoundEvaluation.new(key, $page)
82
+ rescue => e
83
+ return FieldNotFoundEvaluation.new(key, $page, e.to_s)
84
84
  end
85
85
 
86
- rescue
87
- return FieldNotFoundEvaluation.new(key, $page)
86
+ rescue => e
87
+ return FieldNotFoundEvaluation.new(key, $page, e.to_s)
88
88
  end
89
89
  end
90
90
 
@@ -25,6 +25,10 @@ module Sapphire
25
25
  @fields = @fields.merge! args.first => TextBox.new(args[1..args.length])
26
26
  end
27
27
 
28
+ def TextArea(*args)
29
+ @fields = @fields.merge! args.first => TextArea.new(args[1..args.length])
30
+ end
31
+
28
32
  def RadioButton(*args)
29
33
  @fields = @fields.merge! args.first => RadioButton.new(args[1..args.length])
30
34
  end
@@ -0,0 +1,27 @@
1
+ module Sapphire
2
+ module WebAbstractions
3
+ class TextArea < Control
4
+
5
+ def Text
6
+ textarea = self.Find
7
+ textarea.attribute("value")
8
+ end
9
+
10
+ def Set(value)
11
+ if(value == "")
12
+ self.Clear
13
+ else
14
+ textarea = self.Find
15
+ textarea.send_keys value
16
+ end
17
+ end
18
+
19
+ def Clear
20
+ textarea = self.Find
21
+ textarea .clear
22
+ end
23
+
24
+ end
25
+ end
26
+ end
27
+
@@ -1,3 +1,3 @@
1
1
  module Sapphire
2
- VERSION = "0.7.2"
2
+ VERSION = "0.7.3"
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.7.2
4
+ version: 0.7.3
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-02-27 00:00:00.000000000Z
12
+ date: 2012-02-28 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: selenium-webdriver
16
- requirement: &9963168 !ruby/object:Gem::Requirement
16
+ requirement: &9907608 !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: *9963168
24
+ version_requirements: *9907608
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: colorize
27
- requirement: &9962916 !ruby/object:Gem::Requirement
27
+ requirement: &9907356 !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: *9962916
35
+ version_requirements: *9907356
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: Platform
38
- requirement: &9962664 !ruby/object:Gem::Requirement
38
+ requirement: &9907104 !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: *9962664
46
+ version_requirements: *9907104
47
47
  description: An automated web acceptance test framework for non-technical resources
48
48
  using selenium-wedriver.
49
49
  email:
@@ -57,7 +57,6 @@ files:
57
57
  - lib/sapphire/Adapters.rb
58
58
  - lib/sapphire/CommandLine.rb
59
59
  - lib/sapphire/Configuration/AppConfig.rb
60
- - lib/sapphire/Configuration/AttrMethods.rb
61
60
  - lib/sapphire/Configuration.rb
62
61
  - lib/sapphire/Data.rb
63
62
  - lib/sapphire/DataAbstractions/Database.rb
@@ -202,6 +201,7 @@ files:
202
201
  - lib/sapphire/WebAbstractions/Controls/Label.rb
203
202
  - lib/sapphire/WebAbstractions/Controls/List.rb
204
203
  - lib/sapphire/WebAbstractions/Controls/RadioButton.rb
204
+ - lib/sapphire/WebAbstractions/Controls/TextArea.rb
205
205
  - lib/sapphire/WebAbstractions/Controls/TextBox.rb
206
206
  - lib/sapphire/WebAbstractions/Controls/Title.rb
207
207
  - lib/sapphire.rb
@@ -1,39 +0,0 @@
1
- # Taken this class from Albacore
2
-
3
- module Sapphire
4
- module Configuration
5
- module AttrMethods
6
- def attr_array(*names)
7
- names.each do |n|
8
- self.send :define_method, n do |*value|
9
- if value.nil? || value.empty?
10
- return instance_variable_get("@#{n}")
11
- else
12
- self.send "#{n}=".to_sym, value.to_ary.flatten
13
- end
14
- end
15
- self.send :define_method, "#{n}=" do |value|
16
- instance_variable_set("@#{n}", value)
17
- end
18
- end
19
- end
20
-
21
- def attr_hash(*names)
22
- names.each do |n|
23
- self.class_eval(<<-EOF, __FILE__, __LINE__)
24
- def #{n}(*value)
25
- if value.nil? || value.empty?
26
- instance_variable_get("@#{n}")
27
- else
28
- instance_variable_set("@#{n}", value[0])
29
- end
30
- end
31
- EOF
32
- self.send :define_method, "#{n}=" do |value|
33
- instance_variable_set("@#{n}", value)
34
- end
35
- end
36
- end
37
- end
38
- end
39
- end