sapphire 0.0.2 → 0.0.3

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.
Files changed (69) hide show
  1. data/lib/sapphire/DSL/Browser/Browser.rb +13 -13
  2. data/lib/sapphire/DSL/Browser/Check.rb +12 -12
  3. data/lib/sapphire/DSL/Browser/Clear.rb +15 -15
  4. data/lib/sapphire/DSL/Browser/Click.rb +12 -12
  5. data/lib/sapphire/DSL/Browser/Close.rb +12 -12
  6. data/lib/sapphire/DSL/Browser/Complete.rb +15 -15
  7. data/lib/sapphire/DSL/Browser/CurrentUrl.rb +11 -11
  8. data/lib/sapphire/DSL/Browser/Error.rb +12 -12
  9. data/lib/sapphire/DSL/Browser/ExecuteAgainstControl.rb +45 -45
  10. data/lib/sapphire/DSL/Browser/Exists.rb +22 -22
  11. data/lib/sapphire/DSL/Browser/For.rb +10 -10
  12. data/lib/sapphire/DSL/Browser/Hide.rb +10 -10
  13. data/lib/sapphire/DSL/Browser/IsHidden.rb +28 -28
  14. data/lib/sapphire/DSL/Browser/IsVisible.rb +25 -25
  15. data/lib/sapphire/DSL/Browser/MouseOver.rb +12 -12
  16. data/lib/sapphire/DSL/Browser/Navigate.rb +11 -11
  17. data/lib/sapphire/DSL/Browser/Not.rb +9 -0
  18. data/lib/sapphire/DSL/Browser/Reload.rb +11 -11
  19. data/lib/sapphire/DSL/Browser/Set.rb +12 -12
  20. data/lib/sapphire/DSL/Browser/Should.rb +10 -10
  21. data/lib/sapphire/DSL/Browser/Show.rb +27 -26
  22. data/lib/sapphire/DSL/Browser/Start.rb +16 -16
  23. data/lib/sapphire/DSL/Browser/To.rb +10 -10
  24. data/lib/sapphire/DSL/Browser/Tracker.rb +15 -15
  25. data/lib/sapphire/DSL/Browser/Transition.rb +10 -10
  26. data/lib/sapphire/DSL/Browser/Uncheck.rb +12 -12
  27. data/lib/sapphire/DSL/Browser/With.rb +10 -10
  28. data/lib/sapphire/DSL/Configuration/ConfiguredBrowser.rb +12 -12
  29. data/lib/sapphire/DSL/Configuration/ConfiguredUser.rb +10 -10
  30. data/lib/sapphire/DSL/Configuration/Use.rb +15 -15
  31. data/lib/sapphire/DSL/Data/Exist.rb +11 -11
  32. data/lib/sapphire/DSL/Data/Find.rb +10 -10
  33. data/lib/sapphire/DSL/Data/GetPageField.rb +17 -17
  34. data/lib/sapphire/DSL/Data/Underscore.rb +8 -8
  35. data/lib/sapphire/DSL/Data/Validate.rb +16 -16
  36. data/lib/sapphire/DSL/Data/Verify.rb +10 -10
  37. data/lib/sapphire/DSL/Scenarios/Is.rb +9 -9
  38. data/lib/sapphire/DSL/Scenarios/Pending.rb +28 -28
  39. data/lib/sapphire/DSL/Scenarios/and.rb +24 -24
  40. data/lib/sapphire/DSL/Scenarios/background.rb +22 -22
  41. data/lib/sapphire/DSL/Scenarios/dsl.rb +60 -60
  42. data/lib/sapphire/DSL/Scenarios/finally.rb +31 -31
  43. data/lib/sapphire/DSL/Scenarios/given.rb +56 -56
  44. data/lib/sapphire/DSL/Scenarios/runner.rb +30 -30
  45. data/lib/sapphire/DSL/Scenarios/scenario.rb +51 -51
  46. data/lib/sapphire/DSL/Scenarios/then.rb +33 -33
  47. data/lib/sapphire/DSL/Scenarios/when.rb +46 -46
  48. data/lib/sapphire/DataAbstractions/Database.rb +57 -57
  49. data/lib/sapphire/DataAbstractions/Query.rb +19 -19
  50. data/lib/sapphire/Testing/ResultList.rb +18 -18
  51. data/lib/sapphire/Testing/ResultTree.rb +37 -37
  52. data/lib/sapphire/WebAbstractions/Controls/Base/Control.rb +74 -74
  53. data/lib/sapphire/WebAbstractions/Controls/Base/Page.rb +47 -47
  54. data/lib/sapphire/WebAbstractions/Controls/Base/WebBrowser.rb +74 -74
  55. data/lib/sapphire/WebAbstractions/Controls/Button.rb +9 -9
  56. data/lib/sapphire/WebAbstractions/Controls/CheckBox.rb +28 -28
  57. data/lib/sapphire/WebAbstractions/Controls/Chrome.rb +21 -21
  58. data/lib/sapphire/WebAbstractions/Controls/DropDown.rb +25 -25
  59. data/lib/sapphire/WebAbstractions/Controls/FireFox.rb +22 -22
  60. data/lib/sapphire/WebAbstractions/Controls/Hyperlink.rb +8 -8
  61. data/lib/sapphire/WebAbstractions/Controls/Image.rb +9 -9
  62. data/lib/sapphire/WebAbstractions/Controls/InternetExplorer.rb +21 -21
  63. data/lib/sapphire/WebAbstractions/Controls/Label.rb +8 -8
  64. data/lib/sapphire/WebAbstractions/Controls/RadioButton.rb +18 -18
  65. data/lib/sapphire/WebAbstractions/Controls/TableCell.rb +10 -0
  66. data/lib/sapphire/WebAbstractions/Controls/TextBox.rb +31 -31
  67. data/lib/sapphire/WebAbstractions/Controls/Title.rb +12 -12
  68. data/lib/sapphire/version.rb +1 -1
  69. metadata +13 -9
@@ -1,11 +1,11 @@
1
- module Sapphire
2
- module DSL
3
- module Data
4
- def Exist(value)
5
- value.should_not == nil
6
- end
7
- end
8
- end
9
- end
10
-
11
-
1
+ module Sapphire
2
+ module DSL
3
+ module Data
4
+ def Exist(value)
5
+ value != nil
6
+ end
7
+ end
8
+ end
9
+ end
10
+
11
+
@@ -1,10 +1,10 @@
1
- module Sapphire
2
- module DSL
3
- module Data
4
- def Find(query, &block)
5
- query.Execute block
6
- end
7
- end
8
- end
9
- end
10
-
1
+ module Sapphire
2
+ module DSL
3
+ module Data
4
+ def Find(query, &block)
5
+ query.Execute block
6
+ end
7
+ end
8
+ end
9
+ end
10
+
@@ -1,17 +1,17 @@
1
- module Sapphire
2
- module DSL
3
- module Data
4
- def GetPageField(key)
5
- @page.fields.each do |field|
6
- field.keys.each do |field_key|
7
- if(field_key == key)
8
- return field[key]
9
- end
10
- end
11
- end
12
- raise "Could not find control for: " + key + " for page " + @page.to_s
13
- end
14
- end
15
- end
16
- end
17
-
1
+ module Sapphire
2
+ module DSL
3
+ module Data
4
+ def GetPageField(key)
5
+ @page.fields.each do |field|
6
+ field.keys.each do |field_key|
7
+ if(field_key == key)
8
+ return field[key]
9
+ end
10
+ end
11
+ end
12
+ raise "Could not find control for: " + key + " for page " + @page.to_s
13
+ end
14
+ end
15
+ end
16
+ end
17
+
@@ -1,9 +1,9 @@
1
- class String
2
- def underscore
3
- self.gsub(/::/, '/').
4
- gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
5
- gsub(/([a-z\d])([A-Z])/,'\1_\2').
6
- tr("-", "_").
7
- downcase
8
- end
1
+ class String
2
+ def underscore
3
+ self.gsub(/::/, '/').
4
+ gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
5
+ gsub(/([a-z\d])([A-Z])/,'\1_\2').
6
+ tr("-", "_").
7
+ downcase
8
+ end
9
9
  end
@@ -1,16 +1,16 @@
1
- module Sapphire
2
- module DSL
3
- module Data
4
- def Validate(hash)
5
- hash.keys.each do |key|
6
- if(hash[key].is_a? Symbol)
7
- key.to_s.should == GetPageField(hash[key]).Text
8
- else
9
- key.to_s.should == hash[key].to_s
10
- end
11
- end
12
- end
13
- end
14
- end
15
- end
16
-
1
+ module Sapphire
2
+ module DSL
3
+ module Data
4
+ def Validate(hash)
5
+ hash.keys.each do |key|
6
+ if(hash[key].is_a? Symbol)
7
+ key.to_s == GetPageField(hash[key]).Text
8
+ else
9
+ key.to_s == hash[key].to_s
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
16
+
@@ -1,10 +1,10 @@
1
- module Sapphire
2
- module DSL
3
- module Data
4
- def Verify(instance)
5
- instance.Verify
6
- end
7
- end
8
- end
9
- end
10
-
1
+ module Sapphire
2
+ module DSL
3
+ module Data
4
+ def Verify(instance)
5
+ instance.Verify
6
+ end
7
+ end
8
+ end
9
+ end
10
+
@@ -1,9 +1,9 @@
1
- module Sapphire
2
- module DSL
3
- module Scenarios
4
- def Is(item)
5
- item
6
- end
7
- end
8
- end
9
- end
1
+ module Sapphire
2
+ module DSL
3
+ module Scenarios
4
+ def Is(item)
5
+ item
6
+ end
7
+ end
8
+ end
9
+ end
@@ -1,29 +1,29 @@
1
- module Sapphire
2
- module DSL
3
- module Scenarios
4
- def Pending(text)
5
- Pending.new text
6
- end
7
-
8
- class Pending
9
-
10
- attr_reader :text
11
- attr_reader :and
12
-
13
- def initialize(text)
14
- @text = text
15
- @and = []
16
- end
17
-
18
- def add_and(text, &block)
19
- self.and << Then.new(text, &block)
20
- end
21
-
22
- def to_s
23
- self.text
24
- end
25
-
26
- end
27
- end
28
- end
1
+ module Sapphire
2
+ module DSL
3
+ module Scenarios
4
+ def Pending(text)
5
+ Pending.new text
6
+ end
7
+
8
+ class Pending
9
+
10
+ attr_reader :text
11
+ attr_reader :and
12
+
13
+ def initialize(text)
14
+ @text = text
15
+ @and = []
16
+ end
17
+
18
+ def add_and(text, &block)
19
+ self.and << Then.new(text, &block)
20
+ end
21
+
22
+ def to_s
23
+ self.text
24
+ end
25
+
26
+ end
27
+ end
28
+ end
29
29
  end
@@ -1,25 +1,25 @@
1
- require File.expand_path('../../Testing/Executable', File.dirname(__FILE__))
2
-
3
- class And
4
- include Sapphire::Testing::Executable
5
-
6
- attr_reader :text
7
- attr_reader :block
8
- attr_reader :value
9
- attr_reader :parent
10
- attr_reader :results
11
-
12
- def initialize(parent, text, &block)
13
- @block = block
14
- @text = text.to_s
15
- @value = text
16
- @parent = parent
17
- @results = []
18
- end
19
-
20
- def AddResult(result)
21
- @results << result
22
- self.parent.results.last.AddChild(result)
23
- end
24
-
1
+ require File.expand_path('../../Testing/Executable', File.dirname(__FILE__))
2
+
3
+ class And
4
+ include Sapphire::Testing::Executable
5
+
6
+ attr_reader :text
7
+ attr_reader :block
8
+ attr_reader :value
9
+ attr_reader :parent
10
+ attr_reader :results
11
+
12
+ def initialize(parent, text, &block)
13
+ @block = block
14
+ @text = text.to_s
15
+ @value = text
16
+ @parent = parent
17
+ @results = []
18
+ end
19
+
20
+ def AddResult(result)
21
+ @results << result
22
+ self.parent.results.last.AddChild(result)
23
+ end
24
+
25
25
  end
@@ -1,23 +1,23 @@
1
- class Background
2
- include Sapphire::Testing::Executable
3
-
4
- attr_reader :value
5
- attr_reader :text
6
- attr_reader :block
7
- attr_reader :parent
8
- attr_reader :results
9
-
10
- def initialize(parent, pre, text, &block)
11
- @block = block
12
- @value = text
13
- @text = pre + text.to_s
14
- @parent = parent
15
- @results = []
16
- end
17
-
18
- def AddResult(result)
19
- @results << result
20
- self.parent.result.AddChild(result)
21
- end
22
-
1
+ class Background
2
+ include Sapphire::Testing::Executable
3
+
4
+ attr_reader :value
5
+ attr_reader :text
6
+ attr_reader :block
7
+ attr_reader :parent
8
+ attr_reader :results
9
+
10
+ def initialize(parent, pre, text, &block)
11
+ @block = block
12
+ @value = text
13
+ @text = pre + text.to_s
14
+ @parent = parent
15
+ @results = []
16
+ end
17
+
18
+ def AddResult(result)
19
+ @results << result
20
+ self.parent.result.AddChild(result)
21
+ end
22
+
23
23
  end
@@ -1,60 +1,60 @@
1
- module Sapphire
2
- module DSL
3
- module Scenarios
4
- def Background(text, &block)
5
- Runner.instance.last_scenario.add_background(Background.new(Runner.instance.last_scenario, "Assuming that ", text, &block))
6
- end
7
-
8
- def Given(text, &block)
9
- Runner.instance.last_scenario.add_given(Given.new(Runner.instance.last_scenario, "Given ", text, &block))
10
- end
11
-
12
- def When(text, &block)
13
- Runner.instance.last_scenario.last_given.add_when("When ", text, &block)
14
- end
15
-
16
- def Then(text, &block)
17
- Runner.instance.last_scenario.last_given.last_when.add_then("Then ", text, &block)
18
- end
19
-
20
- def And(text, &block)
21
-
22
- if(Runner.instance.last_scenario.last_given == nil && Runner.instance.last_scenario.last_background != nil)
23
- Runner.instance.last_scenario.add_background(Background.new(Runner.instance.last_scenario, "And ", text, &block))
24
- return
25
- end
26
-
27
- if(Runner.instance.last_scenario.last_given.finally != nil)
28
- Runner.instance.last_scenario.last_given.finally.add_and("And ", text, &block)
29
- return
30
- end
31
-
32
- if(Runner.instance.last_scenario.last_given.last_when == nil)
33
- Runner.instance.last_scenario.last_given.add_and("And ", text, &block)
34
- return
35
- end
36
-
37
- if(Runner.instance.last_scenario.last_given.last_when.last_then == nil)
38
- Runner.instance.last_scenario.last_given.last_when.add_and("And ", text, &block)
39
- return
40
- end
41
-
42
- if (Runner.instance.last_scenario.last_given.last_when.last_then != nil)
43
- Runner.instance.last_scenario.last_given.last_when.last_then.add_and("And ", text, &block)
44
- end
45
- end
46
-
47
- def Finally(text, &block)
48
- Runner.instance.last_scenario.last_given.add_finally(Finally.new(Runner.instance.last_scenario.last_given, text, &block))
49
- end
50
-
51
- def Scenario(text, &block)
52
- Runner.instance.add_scenario(Scenario.new(text, &block))
53
- #Runner.instance.last_scenario.block.call
54
- Runner.instance.last_scenario.execute 1
55
- end
56
- end
57
- end
58
- end
59
-
60
-
1
+ module Sapphire
2
+ module DSL
3
+ module Scenarios
4
+ def Background(text, &block)
5
+ Runner.instance.last_scenario.add_background(Background.new(Runner.instance.last_scenario, "Assuming that ", text, &block))
6
+ end
7
+
8
+ def Given(text, &block)
9
+ Runner.instance.last_scenario.add_given(Given.new(Runner.instance.last_scenario, "Given ", text, &block))
10
+ end
11
+
12
+ def When(text, &block)
13
+ Runner.instance.last_scenario.last_given.add_when("When ", text, &block)
14
+ end
15
+
16
+ def Then(text, &block)
17
+ Runner.instance.last_scenario.last_given.last_when.add_then("Then ", text, &block)
18
+ end
19
+
20
+ def And(text, &block)
21
+
22
+ if(Runner.instance.last_scenario.last_given == nil && Runner.instance.last_scenario.last_background != nil)
23
+ Runner.instance.last_scenario.add_background(Background.new(Runner.instance.last_scenario, "And ", text, &block))
24
+ return
25
+ end
26
+
27
+ if(Runner.instance.last_scenario.last_given.finally != nil)
28
+ Runner.instance.last_scenario.last_given.finally.add_and("And ", text, &block)
29
+ return
30
+ end
31
+
32
+ if(Runner.instance.last_scenario.last_given.last_when == nil)
33
+ Runner.instance.last_scenario.last_given.add_and("And ", text, &block)
34
+ return
35
+ end
36
+
37
+ if(Runner.instance.last_scenario.last_given.last_when.last_then == nil)
38
+ Runner.instance.last_scenario.last_given.last_when.add_and("And ", text, &block)
39
+ return
40
+ end
41
+
42
+ if (Runner.instance.last_scenario.last_given.last_when.last_then != nil)
43
+ Runner.instance.last_scenario.last_given.last_when.last_then.add_and("And ", text, &block)
44
+ end
45
+ end
46
+
47
+ def Finally(text, &block)
48
+ Runner.instance.last_scenario.last_given.add_finally(Finally.new(Runner.instance.last_scenario.last_given, text, &block))
49
+ end
50
+
51
+ def Scenario(text, &block)
52
+ Runner.instance.add_scenario(Scenario.new(text, &block))
53
+ #Runner.instance.last_scenario.block.call
54
+ Runner.instance.last_scenario.execute 1
55
+ end
56
+ end
57
+ end
58
+ end
59
+
60
+