sapphire 0.7.26 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. data/lib/sapphire.rb +51 -40
  2. data/lib/sapphire/Adapters/Selenium/RubySeleniumWebDriver.rb +24 -68
  3. data/lib/sapphire/DSL.rb +18 -16
  4. data/lib/sapphire/DSL/Browser/Create.rb +10 -10
  5. data/lib/sapphire/DSL/Browser/ExecuteAgainstControl.rb +20 -20
  6. data/lib/sapphire/DSL/Browser/Fluff/By.rb +10 -10
  7. data/lib/sapphire/DSL/Browser/Fluff/To.rb +10 -10
  8. data/lib/sapphire/DSL/Browser/Fluff/With.rb +10 -10
  9. data/lib/sapphire/DSL/Browser/Nouns/Browser.rb +17 -17
  10. data/lib/sapphire/DSL/Browser/Nouns/Enter.rb +10 -10
  11. data/lib/sapphire/DSL/Browser/Tracker.rb +15 -15
  12. data/lib/sapphire/DSL/Browser/Verbs/Accept.rb +8 -8
  13. data/lib/sapphire/DSL/Browser/Verbs/Check.rb +10 -10
  14. data/lib/sapphire/DSL/Browser/Verbs/Clear.rb +8 -8
  15. data/lib/sapphire/DSL/Browser/Verbs/Click.rb +10 -10
  16. data/lib/sapphire/DSL/Browser/Verbs/Compare.rb +18 -18
  17. data/lib/sapphire/DSL/Browser/Verbs/Complete.rb +13 -13
  18. data/lib/sapphire/DSL/Browser/Verbs/Exists.rb +16 -16
  19. data/lib/sapphire/DSL/Browser/Verbs/Exit.rb +11 -11
  20. data/lib/sapphire/DSL/Browser/Verbs/MouseOver.rb +10 -10
  21. data/lib/sapphire/DSL/Browser/Verbs/Navigate.rb +10 -10
  22. data/lib/sapphire/DSL/Browser/Verbs/Press.rb +8 -8
  23. data/lib/sapphire/DSL/Browser/Verbs/Reload.rb +11 -11
  24. data/lib/sapphire/DSL/Browser/Verbs/Set.rb +10 -10
  25. data/lib/sapphire/DSL/Browser/Verbs/Uncheck.rb +10 -10
  26. data/lib/sapphire/DSL/Comparisons/CheckedComparison.rb +17 -17
  27. data/lib/sapphire/DSL/Comparisons/Comparison.rb +50 -50
  28. data/lib/sapphire/DSL/Comparisons/ContainsComparison.rb +17 -17
  29. data/lib/sapphire/DSL/Comparisons/DifferComparison.rb +17 -17
  30. data/lib/sapphire/DSL/Comparisons/EqualsComparison.rb +16 -16
  31. data/lib/sapphire/DSL/Comparisons/NotComparison.rb +20 -20
  32. data/lib/sapphire/DSL/Comparisons/SelectedComparison.rb +17 -17
  33. data/lib/sapphire/DSL/Comparisons/StartsWithComparison.rb +17 -17
  34. data/lib/sapphire/DSL/Comparisons/VisibleComparison.rb +17 -17
  35. data/lib/sapphire/DSL/Configuration/ConfiguredBrowser.rb +12 -12
  36. data/lib/sapphire/DSL/Configuration/ConfiguredUser.rb +10 -10
  37. data/lib/sapphire/DSL/Configuration/Use.rb +18 -18
  38. data/lib/sapphire/DSL/Data/Find.rb +10 -10
  39. data/lib/sapphire/DSL/Data/GetPageField.rb +13 -13
  40. data/lib/sapphire/DSL/Data/Verify.rb +10 -10
  41. data/lib/sapphire/DSL/Evaluations/ControlEvaluation.rb +13 -0
  42. data/lib/sapphire/DSL/Evaluations/Evaluation.rb +55 -45
  43. data/lib/sapphire/DSL/Evaluations/FieldNotDefinedEvaluation.rb +20 -20
  44. data/lib/sapphire/DSL/Evaluations/FieldNotFoundEvaluation.rb +22 -22
  45. data/lib/sapphire/DSL/Evaluators/Contain.rb +10 -10
  46. data/lib/sapphire/DSL/Evaluators/Count.rb +8 -8
  47. data/lib/sapphire/DSL/Evaluators/Differ.rb +10 -10
  48. data/lib/sapphire/DSL/Evaluators/Exist.rb +9 -9
  49. data/lib/sapphire/DSL/Evaluators/In.rb +10 -10
  50. data/lib/sapphire/DSL/Evaluators/Selected.rb +10 -10
  51. data/lib/sapphire/DSL/Evaluators/Show.rb +10 -10
  52. data/lib/sapphire/DSL/Evaluators/Transition.rb +10 -10
  53. data/lib/sapphire/DSL/Evaluators/Validate.rb +8 -8
  54. data/lib/sapphire/DSL/Events/Data.rb +12 -0
  55. data/lib/sapphire/DSL/Events/DataSegment.rb +18 -0
  56. data/lib/sapphire/DSL/Events/Event.rb +11 -3
  57. data/lib/sapphire/DSL/Events/Expect.rb +3 -11
  58. data/lib/sapphire/DSL/Events/Expectation.rb +14 -0
  59. data/lib/sapphire/DSL/Events/For.rb +11 -0
  60. data/lib/sapphire/DSL/Events/From.rb +9 -0
  61. data/lib/sapphire/DSL/Events/Where.rb +11 -0
  62. data/lib/sapphire/DSL/Profiles/Profile.rb +26 -0
  63. data/lib/sapphire/DSL/Profiles/Table.rb +9 -0
  64. data/lib/sapphire/DSL/Scenarios/Is.rb +9 -9
  65. data/lib/sapphire/DSL/Scenarios/Pending.rb +28 -28
  66. data/lib/sapphire/DSL/Scenarios/and.rb +25 -25
  67. data/lib/sapphire/DSL/Scenarios/dsl.rb +59 -59
  68. data/lib/sapphire/DSL/Scenarios/runner.rb +40 -40
  69. data/lib/sapphire/Data.rb +1 -1
  70. data/lib/sapphire/DataAbstractions/Database.rb +57 -57
  71. data/lib/sapphire/DataAbstractions/Query.rb +20 -20
  72. data/lib/sapphire/Extensions/Class.rb +2 -2
  73. data/lib/sapphire/Extensions/Hash.rb +112 -112
  74. data/lib/sapphire/Extensions/Module.rb +11 -0
  75. data/lib/sapphire/Extensions/Numeric.rb +6 -6
  76. data/lib/sapphire/Extensions/Object.rb +4 -0
  77. data/lib/sapphire/Extensions/String.rb +30 -23
  78. data/lib/sapphire/Extensions/Symbol.rb +1 -1
  79. data/lib/sapphire/JobAbstractions/Job.rb +32 -32
  80. data/lib/sapphire/Observable.rb +87 -0
  81. data/lib/sapphire/Observers.rb +2 -0
  82. data/lib/sapphire/Observers/FailedControlHighlighter.rb +41 -0
  83. data/lib/sapphire/Observers/Highlighter.rb +40 -0
  84. data/lib/sapphire/Observers/Observer.rb +23 -0
  85. data/lib/sapphire/Observers/ObserverRepository.rb +37 -0
  86. data/lib/sapphire/Observers/PassedControlHighlighter.rb +42 -0
  87. data/lib/sapphire/Observers/VerboseObserver.rb +36 -0
  88. data/lib/sapphire/TeamCity.rb +10 -10
  89. data/lib/sapphire/Testing.rb +3 -3
  90. data/lib/sapphire/Testing/RakeTask.rb +108 -108
  91. data/lib/sapphire/Testing/ResultList.rb +18 -18
  92. data/lib/sapphire/Testing/ScenarioResult.rb +36 -36
  93. data/lib/sapphire/Testing/TestResult.rb +21 -21
  94. data/lib/sapphire/Testing/TestRunnerAdapter.rb +85 -85
  95. data/lib/sapphire/UI/ProcessBuilder.rb +173 -173
  96. data/lib/sapphire/Virtualization.rb +7 -7
  97. data/lib/sapphire/Web.rb +2 -2
  98. data/lib/sapphire/WebAbstractions/Controls/AlertBox.rb +20 -20
  99. data/lib/sapphire/WebAbstractions/Controls/Base/Control.rb +43 -26
  100. data/lib/sapphire/WebAbstractions/Controls/Button.rb +7 -7
  101. data/lib/sapphire/WebAbstractions/Controls/CheckBox.rb +3 -3
  102. data/lib/sapphire/WebAbstractions/Controls/Date.rb +11 -11
  103. data/lib/sapphire/WebAbstractions/Controls/DropDown.rb +6 -8
  104. data/lib/sapphire/WebAbstractions/Controls/Hyperlink.rb +8 -8
  105. data/lib/sapphire/WebAbstractions/Controls/Image.rb +19 -19
  106. data/lib/sapphire/WebAbstractions/Controls/Label.rb +8 -8
  107. data/lib/sapphire/WebAbstractions/Controls/List.rb +16 -16
  108. data/lib/sapphire/WebAbstractions/Controls/RadioButton.rb +2 -2
  109. data/lib/sapphire/WebAbstractions/Controls/Title.rb +12 -12
  110. data/lib/sapphire/version.rb +1 -1
  111. metadata +26 -8
@@ -1,15 +1,15 @@
1
- module Sapphire
2
- module DSL
3
- module Browser
4
- def Track(hash)
5
- $tracker ||= {}
6
- $tracker.merge! hash
7
- end
8
-
9
- def Tracker(item)
10
- $tracker[item]
11
- end
12
- end
13
- end
14
- end
15
-
1
+ module Sapphire
2
+ module DSL
3
+ module Browser
4
+ def Track(hash)
5
+ $tracker ||= {}
6
+ $tracker.merge! hash
7
+ end
8
+
9
+ def Tracker(item)
10
+ $tracker[item]
11
+ end
12
+ end
13
+ end
14
+ end
15
+
@@ -1,9 +1,9 @@
1
- module Sapphire
2
- module DSL
3
- module Browser
4
- def Accept(item)
5
- item.Accept
6
- end
7
- end
8
- end
1
+ module Sapphire
2
+ module DSL
3
+ module Browser
4
+ def Accept(item)
5
+ item.Accept
6
+ end
7
+ end
8
+ end
9
9
  end
@@ -1,10 +1,10 @@
1
- module Sapphire
2
- module DSL
3
- module Browser
4
- def Check(item)
5
- item.Check
6
- end
7
- end
8
- end
9
- end
10
-
1
+ module Sapphire
2
+ module DSL
3
+ module Browser
4
+ def Check(item)
5
+ item.Check
6
+ end
7
+ end
8
+ end
9
+ end
10
+
@@ -1,9 +1,9 @@
1
- module Sapphire
2
- module DSL
3
- module Browser
4
- def Clear(item)
5
- item.Clear
6
- end
7
- end
8
- end
1
+ module Sapphire
2
+ module DSL
3
+ module Browser
4
+ def Clear(item)
5
+ item.Clear(item)
6
+ end
7
+ end
8
+ end
9
9
  end
@@ -1,10 +1,10 @@
1
- module Sapphire
2
- module DSL
3
- module Browser
4
- def Click(item)
5
- item.Click
6
- end
7
- end
8
- end
9
- end
10
-
1
+ module Sapphire
2
+ module DSL
3
+ module Browser
4
+ def Click(item)
5
+ item.Click
6
+ end
7
+ end
8
+ end
9
+ end
10
+
@@ -1,19 +1,19 @@
1
- module Sapphire
2
- module DSL
3
- module Browser
4
- def Compare(control1, control2, &block)
5
- if(control1.is_a? Symbol)
6
- $compare1 = GetPageField(control1).Text
7
- else
8
- $compare1 = control1
9
- end
10
- if(control2.is_a? Symbol)
11
- $compare2 = GetPageField(control2).Text
12
- else
13
- $compare2 = control2
14
- end
15
- block.call()
16
- end
17
- end
18
- end
1
+ module Sapphire
2
+ module DSL
3
+ module Browser
4
+ def Compare(control1, control2, &block)
5
+ if(control1.is_a? Symbol)
6
+ $compare1 = GetPageField(control1).Text
7
+ else
8
+ $compare1 = control1
9
+ end
10
+ if(control2.is_a? Symbol)
11
+ $compare2 = GetPageField(control2).Text
12
+ else
13
+ $compare2 = control2
14
+ end
15
+ block.call()
16
+ end
17
+ end
18
+ end
19
19
  end
@@ -1,14 +1,14 @@
1
- module Sapphire
2
- module DSL
3
- module Browser
4
- def Complete(page)
5
- if(page.is_a? Class)
6
- temp = page.new
7
- temp.Complete
8
- else
9
- page.Complete
10
- end
11
- end
12
- end
13
- end
1
+ module Sapphire
2
+ module DSL
3
+ module Browser
4
+ def Complete(page)
5
+ if(page.is_a? Class)
6
+ temp = page.new
7
+ temp.Complete
8
+ else
9
+ page.Complete
10
+ end
11
+ end
12
+ end
13
+ end
14
14
  end
@@ -1,16 +1,16 @@
1
- module Sapphire
2
- module DSL
3
- module Browser
4
- def Exists(symbol)
5
- if($page.Contains symbol)
6
- begin
7
- return $page.Get(symbol).Visible(false).Evaluate()
8
- rescue
9
- return false
10
- end
11
- end
12
- end
13
- end
14
- end
15
- end
16
-
1
+ module Sapphire
2
+ module DSL
3
+ module Browser
4
+ def Exists(symbol)
5
+ if($page.Contains symbol)
6
+ begin
7
+ return $page.Get(symbol).Visible(false).Evaluate()
8
+ rescue
9
+ return false
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
16
+
@@ -1,11 +1,11 @@
1
- module Sapphire
2
- module DSL
3
- module Browser
4
- def Exit(item)
5
- item.Close
6
- end
7
- end
8
- end
9
- end
10
-
11
-
1
+ module Sapphire
2
+ module DSL
3
+ module Browser
4
+ def Exit(item)
5
+ item.Close
6
+ end
7
+ end
8
+ end
9
+ end
10
+
11
+
@@ -1,10 +1,10 @@
1
- module Sapphire
2
- module DSL
3
- module Browser
4
- def MouseOver(item)
5
- item.MouseOver
6
- end
7
- end
8
- end
9
- end
10
-
1
+ module Sapphire
2
+ module DSL
3
+ module Browser
4
+ def MouseOver(item)
5
+ item.MouseOver
6
+ end
7
+ end
8
+ end
9
+ end
10
+
@@ -1,10 +1,10 @@
1
- module Sapphire
2
- module DSL
3
- module Browser
4
- def Navigate(page)
5
- $driver.NavigateTo(page)
6
- end
7
- end
8
- end
9
- end
10
-
1
+ module Sapphire
2
+ module DSL
3
+ module Browser
4
+ def Navigate(page)
5
+ $driver.NavigateTo(page)
6
+ end
7
+ end
8
+ end
9
+ end
10
+
@@ -1,9 +1,9 @@
1
- module Sapphire
2
- module DSL
3
- module Browser
4
- def Press(item)
5
- item.Press(item)
6
- end
7
- end
8
- end
1
+ module Sapphire
2
+ module DSL
3
+ module Browser
4
+ def Press(item)
5
+ item.Press(item)
6
+ end
7
+ end
8
+ end
9
9
  end
@@ -1,11 +1,11 @@
1
- module Sapphire
2
- module DSL
3
- module Browser
4
- def Reload(item)
5
- $driver.Reload
6
- Should Show item
7
- end
8
- end
9
- end
10
- end
11
-
1
+ module Sapphire
2
+ module DSL
3
+ module Browser
4
+ def Reload(item)
5
+ $driver.Reload
6
+ Should Show item
7
+ end
8
+ end
9
+ end
10
+ end
11
+
@@ -1,10 +1,10 @@
1
- module Sapphire
2
- module DSL
3
- module Browser
4
- def Set(hash)
5
- hash.Set hash
6
- end
7
- #alias :Set :Verb
8
- end
9
- end
10
- end
1
+ module Sapphire
2
+ module DSL
3
+ module Browser
4
+ def Set(hash)
5
+ hash.Set hash
6
+ end
7
+ #alias :Set :Verb
8
+ end
9
+ end
10
+ end
@@ -1,10 +1,10 @@
1
- module Sapphire
2
- module DSL
3
- module Browser
4
- def Uncheck(item)
5
- item.Uncheck
6
- end
7
- end
8
- end
9
- end
10
-
1
+ module Sapphire
2
+ module DSL
3
+ module Browser
4
+ def Uncheck(item)
5
+ item.Uncheck
6
+ end
7
+ end
8
+ end
9
+ end
10
+
@@ -1,17 +1,17 @@
1
- module Sapphire
2
- module DSL
3
- class CheckedComparison < Comparison
4
-
5
- def Compare(left, right)
6
- return @comparator.Compare(left.Checked, true) if @comparator != nil
7
- left.Checked
8
- end
9
-
10
- def Text
11
- return @comparator.Text + " to be checked" if @comparator != nil
12
- " to be checked"
13
- end
14
-
15
- end
16
- end
17
- end
1
+ module Sapphire
2
+ module DSL
3
+ class CheckedComparison < Comparison
4
+
5
+ def Compare(left, right)
6
+ return @comparator.Compare(left.Checked, true) if @comparator != nil
7
+ left.Checked
8
+ end
9
+
10
+ def Text
11
+ return @comparator.Text + " to be checked" if @comparator != nil
12
+ " to be checked"
13
+ end
14
+
15
+ end
16
+ end
17
+ end
@@ -1,50 +1,50 @@
1
- module Sapphire
2
- module DSL
3
- class Comparison
4
-
5
- attr_reader :item
6
-
7
- def initialize(item)
8
- @item = item
9
- @item.CompareWith(self) if @item.is_a? Evaluation or @item.is_a? Evaluator or @item.is_a? Comparison
10
- end
11
-
12
- def CompareWith(item)
13
- @comparator = item
14
- end
15
-
16
- def Create(item)
17
- return self.class.new(item) if item.is_a? Comparison or item.is_a? Evaluation
18
- item
19
- end
20
-
21
- def Output()
22
- @item.Output
23
- end
24
-
25
- def Evaluate()
26
- @item.Evaluate
27
- end
28
-
29
- def left=(val)
30
- @item.left=val
31
- end
32
-
33
- def right=(val)
34
- @item.right=val
35
- end
36
-
37
- def left
38
- @item.left
39
- end
40
-
41
- def right
42
- @item.right
43
- end
44
-
45
- def execute
46
- @item.execute
47
- end
48
- end
49
- end
50
- end
1
+ module Sapphire
2
+ module DSL
3
+ class Comparison
4
+
5
+ attr_reader :item
6
+
7
+ def initialize(item)
8
+ @item = item
9
+ @item.CompareWith(self) if @item.is_a? Evaluation or @item.is_a? Evaluator or @item.is_a? Comparison
10
+ end
11
+
12
+ def CompareWith(item)
13
+ @comparator = item
14
+ end
15
+
16
+ def Create(item)
17
+ return self.class.new(item) if item.is_a? Comparison or item.is_a? Evaluation
18
+ item
19
+ end
20
+
21
+ def Output()
22
+ @item.Output
23
+ end
24
+
25
+ def Evaluate()
26
+ @item.Evaluate
27
+ end
28
+
29
+ def left=(val)
30
+ @item.left=val
31
+ end
32
+
33
+ def right=(val)
34
+ @item.right=val
35
+ end
36
+
37
+ def left
38
+ @item.left
39
+ end
40
+
41
+ def right
42
+ @item.right
43
+ end
44
+
45
+ def execute
46
+ @item.execute
47
+ end
48
+ end
49
+ end
50
+ end