sapphire 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. data/lib/sapphire.rb +38 -37
  2. data/lib/sapphire/Adapters.rb +1 -0
  3. data/lib/sapphire/Adapters/Selenium/RubySeleniumWebDriver.rb +190 -0
  4. data/lib/sapphire/DSL.rb +6 -6
  5. data/lib/sapphire/DSL/Browser/Accept.rb +9 -9
  6. data/lib/sapphire/DSL/Browser/AlertBox.rb +14 -19
  7. data/lib/sapphire/DSL/Browser/Browser.rb +17 -17
  8. data/lib/sapphire/DSL/Browser/By.rb +10 -10
  9. data/lib/sapphire/DSL/Browser/Check.rb +12 -12
  10. data/lib/sapphire/DSL/Browser/Clear.rb +12 -12
  11. data/lib/sapphire/DSL/Browser/Click.rb +12 -12
  12. data/lib/sapphire/DSL/Browser/Close.rb +12 -12
  13. data/lib/sapphire/DSL/Browser/Compare.rb +18 -18
  14. data/lib/sapphire/DSL/Browser/Complete.rb +15 -15
  15. data/lib/sapphire/DSL/Browser/CurrentUrl.rb +11 -11
  16. data/lib/sapphire/DSL/Browser/Day.rb +24 -24
  17. data/lib/sapphire/DSL/Browser/Differ.rb +18 -18
  18. data/lib/sapphire/DSL/Browser/Error.rb +26 -26
  19. data/lib/sapphire/DSL/Browser/ExecuteAgainstControl.rb +45 -45
  20. data/lib/sapphire/DSL/Browser/Exists.rb +22 -22
  21. data/lib/sapphire/DSL/Browser/For.rb +10 -10
  22. data/lib/sapphire/DSL/Browser/Hide.rb +26 -26
  23. data/lib/sapphire/DSL/Browser/IsHidden.rb +10 -10
  24. data/lib/sapphire/DSL/Browser/IsVisible.rb +33 -33
  25. data/lib/sapphire/DSL/Browser/Keys/Enter.rb +10 -10
  26. data/lib/sapphire/DSL/Browser/Month.rb +24 -24
  27. data/lib/sapphire/DSL/Browser/MouseOver.rb +12 -12
  28. data/lib/sapphire/DSL/Browser/Navigate.rb +11 -11
  29. data/lib/sapphire/DSL/Browser/Popup.rb +2 -4
  30. data/lib/sapphire/DSL/Browser/Press.rb +10 -10
  31. data/lib/sapphire/DSL/Browser/Reload.rb +11 -11
  32. data/lib/sapphire/DSL/Browser/Set.rb +18 -18
  33. data/lib/sapphire/DSL/Browser/Should.rb +42 -42
  34. data/lib/sapphire/DSL/Browser/Show.rb +26 -26
  35. data/lib/sapphire/DSL/Browser/Start.rb +16 -16
  36. data/lib/sapphire/DSL/Browser/To.rb +10 -10
  37. data/lib/sapphire/DSL/Browser/Tracker.rb +15 -15
  38. data/lib/sapphire/DSL/Browser/Transition.rb +26 -26
  39. data/lib/sapphire/DSL/Browser/Uncheck.rb +12 -12
  40. data/lib/sapphire/DSL/Browser/With.rb +10 -10
  41. data/lib/sapphire/DSL/Configuration/ConfiguredBrowser.rb +12 -12
  42. data/lib/sapphire/DSL/Configuration/ConfiguredUser.rb +10 -10
  43. data/lib/sapphire/DSL/Configuration/Use.rb +15 -15
  44. data/lib/sapphire/DSL/Data/Exist.rb +27 -27
  45. data/lib/sapphire/DSL/Data/Find.rb +10 -10
  46. data/lib/sapphire/DSL/Data/GetPageField.rb +17 -17
  47. data/lib/sapphire/DSL/Data/Underscore.rb +8 -8
  48. data/lib/sapphire/DSL/Data/Validate.rb +26 -26
  49. data/lib/sapphire/DSL/Data/Verify.rb +10 -10
  50. data/lib/sapphire/DSL/Scenarios/Is.rb +9 -9
  51. data/lib/sapphire/DSL/Scenarios/Pending.rb +28 -28
  52. data/lib/sapphire/DSL/Scenarios/and.rb +25 -25
  53. data/lib/sapphire/DSL/Scenarios/background.rb +33 -33
  54. data/lib/sapphire/DSL/Scenarios/dsl.rb +59 -59
  55. data/lib/sapphire/DSL/Scenarios/finally.rb +33 -33
  56. data/lib/sapphire/DSL/Scenarios/given.rb +57 -57
  57. data/lib/sapphire/DSL/Scenarios/runner.rb +40 -40
  58. data/lib/sapphire/DSL/Scenarios/scenario.rb +53 -53
  59. data/lib/sapphire/DSL/Scenarios/then.rb +34 -34
  60. data/lib/sapphire/DSL/Scenarios/when.rb +47 -47
  61. data/lib/sapphire/Data.rb +1 -1
  62. data/lib/sapphire/DataAbstractions/Database.rb +57 -57
  63. data/lib/sapphire/DataAbstractions/Query.rb +19 -19
  64. data/lib/sapphire/JobAbstractions/Job.rb +32 -32
  65. data/lib/sapphire/Strategies.rb +1 -1
  66. data/lib/sapphire/TeamCity.rb +8 -8
  67. data/lib/sapphire/Testing.rb +2 -2
  68. data/lib/sapphire/Testing/Executable.rb +30 -30
  69. data/lib/sapphire/Testing/RakeTask.rb +108 -108
  70. data/lib/sapphire/Testing/ResultList.rb +18 -18
  71. data/lib/sapphire/Testing/ResultTree.rb +44 -44
  72. data/lib/sapphire/Testing/ScenarioResult.rb +36 -36
  73. data/lib/sapphire/Testing/TestResult.rb +21 -21
  74. data/lib/sapphire/Testing/TestRunnerAdapter.rb +69 -69
  75. data/lib/sapphire/Virtualization.rb +7 -7
  76. data/lib/sapphire/Web.rb +3 -6
  77. data/lib/sapphire/WebAbstractions/{Controls/Browsers → Browsers}/Chrome.rb +21 -21
  78. data/lib/sapphire/WebAbstractions/{Controls/Browsers → Browsers}/FireFox.rb +22 -22
  79. data/lib/sapphire/WebAbstractions/{Controls/Browsers → Browsers}/InternetExplorer.rb +21 -21
  80. data/lib/sapphire/WebAbstractions/Controls/Base/Control.rb +59 -99
  81. data/lib/sapphire/WebAbstractions/Controls/Base/Page.rb +62 -62
  82. data/lib/sapphire/WebAbstractions/Controls/Button.rb +9 -9
  83. data/lib/sapphire/WebAbstractions/Controls/CheckBox.rb +28 -28
  84. data/lib/sapphire/WebAbstractions/Controls/Date.rb +11 -11
  85. data/lib/sapphire/WebAbstractions/Controls/DropDown.rb +26 -26
  86. data/lib/sapphire/WebAbstractions/Controls/Hyperlink.rb +8 -8
  87. data/lib/sapphire/WebAbstractions/Controls/Image.rb +9 -9
  88. data/lib/sapphire/WebAbstractions/Controls/Label.rb +8 -8
  89. data/lib/sapphire/WebAbstractions/Controls/RadioButton.rb +18 -18
  90. data/lib/sapphire/WebAbstractions/Controls/TextBox.rb +31 -31
  91. data/lib/sapphire/WebAbstractions/Controls/Title.rb +12 -12
  92. data/lib/sapphire/version.rb +3 -3
  93. metadata +14 -13
  94. data/lib/sapphire/WebAbstractions/Controls/Base/WebBrowser.rb +0 -91
@@ -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,26 +1,26 @@
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
- result.item = self
22
- @results << result
23
- self.parent.results.last.AddChild(result)
24
- end
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
+ result.item = self
22
+ @results << result
23
+ self.parent.results.last.AddChild(result)
24
+ end
25
+
26
26
  end
@@ -1,34 +1,34 @@
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
- attr_reader :and
10
-
11
- def initialize(parent, pre, text, &block)
12
- @block = block
13
- @value = text
14
- @text = pre + text.to_s
15
- @parent = parent
16
- @results = []
17
- @and = []
18
- end
19
-
20
- def AddResult(result)
21
- result.item = self
22
- @results << result
23
- self.parent.result.AddChild(result)
24
- end
25
-
26
- def add_and(pre, text, &block)
27
- if(self.value.is_a? Pending)
28
- self.and << And.new(self, Pending.new(pre + text), &block)
29
- else
30
- self.and << And.new(self, pre + text, &block)
31
- end
32
- end
33
-
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
+ attr_reader :and
10
+
11
+ def initialize(parent, pre, text, &block)
12
+ @block = block
13
+ @value = text
14
+ @text = pre + text.to_s
15
+ @parent = parent
16
+ @results = []
17
+ @and = []
18
+ end
19
+
20
+ def AddResult(result)
21
+ result.item = self
22
+ @results << result
23
+ self.parent.result.AddChild(result)
24
+ end
25
+
26
+ def add_and(pre, text, &block)
27
+ if(self.value.is_a? Pending)
28
+ self.and << And.new(self, Pending.new(pre + text), &block)
29
+ else
30
+ self.and << And.new(self, pre + text, &block)
31
+ end
32
+ end
33
+
34
34
  end
@@ -1,59 +1,59 @@
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.last_background.add_and("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
- end
55
- end
56
- end
57
- end
58
-
59
-
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.last_background.add_and("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
+ end
55
+ end
56
+ end
57
+ end
58
+
59
+
@@ -1,34 +1,34 @@
1
- class Finally
2
- include Sapphire::Testing::Executable
3
-
4
- attr_reader :value
5
- attr_reader :block
6
- attr_reader :text
7
- attr_reader :and
8
- attr_reader :parent
9
- attr_reader :results
10
-
11
- def initialize(parent, text, &block)
12
- @value = text
13
- @text = text.to_s
14
- @block = block
15
- @and = []
16
- @parent = parent
17
- @results = []
18
- end
19
-
20
- def add_and(pre, text, &block)
21
- if(self.value.is_a? Pending)
22
- self.and << And.new(self, Pending.new(pre + text), &block)
23
- else
24
- self.and << And.new(self, pre + text, &block)
25
- end
26
- end
27
-
28
- def AddResult(result)
29
- result.item = self
30
- @results << result
31
- self.parent.AddResult(result)
32
- end
33
-
1
+ class Finally
2
+ include Sapphire::Testing::Executable
3
+
4
+ attr_reader :value
5
+ attr_reader :block
6
+ attr_reader :text
7
+ attr_reader :and
8
+ attr_reader :parent
9
+ attr_reader :results
10
+
11
+ def initialize(parent, text, &block)
12
+ @value = text
13
+ @text = text.to_s
14
+ @block = block
15
+ @and = []
16
+ @parent = parent
17
+ @results = []
18
+ end
19
+
20
+ def add_and(pre, text, &block)
21
+ if(self.value.is_a? Pending)
22
+ self.and << And.new(self, Pending.new(pre + text), &block)
23
+ else
24
+ self.and << And.new(self, pre + text, &block)
25
+ end
26
+ end
27
+
28
+ def AddResult(result)
29
+ result.item = self
30
+ @results << result
31
+ self.parent.AddResult(result)
32
+ end
33
+
34
34
  end
@@ -1,58 +1,58 @@
1
- class Given
2
- include Sapphire::Testing::Executable
3
-
4
- attr_reader :value
5
- attr_reader :text
6
- attr_reader :block
7
- attr_reader :finally
8
- attr_reader :when
9
- attr_reader :and
10
- attr_reader :parent
11
- attr_reader :results
12
-
13
- def initialize(parent, pre, text, &block)
14
- @value = text
15
- @text = pre + text.to_s
16
- @block = block
17
- @when = []
18
- @and = []
19
- @parent = parent
20
- @results = []
21
- end
22
-
23
- def add_when(pre, text, &block)
24
- if(self.value.is_a? Pending)
25
- @when << When.new(self, pre, Pending.new(text), &block)
26
- else
27
- x = When.new(self, pre, text, &block)
28
- @when << x
29
- end
30
- end
31
-
32
- def last_when()
33
- @when.last
34
- end
35
-
36
- def add_finally(finally)
37
- if(self.value.is_a? Pending)
38
- @finally = Finally.new(self, Pending.new(finally.text), &block)
39
- else
40
- @finally = finally
41
- end
42
- end
43
-
44
- def add_and(pre, text, &block)
45
- if(self.value.is_a? Pending)
46
- self.and << And.new(self, Pending.new(pre + text), &block)
47
- else
48
- self.and << And.new(self, pre + text, &block)
49
- end
50
- end
51
-
52
- def AddResult(result)
53
- result.item = self
54
- @results << result
55
- self.parent.result.AddChild(result)
56
- end
57
-
1
+ class Given
2
+ include Sapphire::Testing::Executable
3
+
4
+ attr_reader :value
5
+ attr_reader :text
6
+ attr_reader :block
7
+ attr_reader :finally
8
+ attr_reader :when
9
+ attr_reader :and
10
+ attr_reader :parent
11
+ attr_reader :results
12
+
13
+ def initialize(parent, pre, text, &block)
14
+ @value = text
15
+ @text = pre + text.to_s
16
+ @block = block
17
+ @when = []
18
+ @and = []
19
+ @parent = parent
20
+ @results = []
21
+ end
22
+
23
+ def add_when(pre, text, &block)
24
+ if(self.value.is_a? Pending)
25
+ @when << When.new(self, pre, Pending.new(text), &block)
26
+ else
27
+ x = When.new(self, pre, text, &block)
28
+ @when << x
29
+ end
30
+ end
31
+
32
+ def last_when()
33
+ @when.last
34
+ end
35
+
36
+ def add_finally(finally)
37
+ if(self.value.is_a? Pending)
38
+ @finally = Finally.new(self, Pending.new(finally.text), &block)
39
+ else
40
+ @finally = finally
41
+ end
42
+ end
43
+
44
+ def add_and(pre, text, &block)
45
+ if(self.value.is_a? Pending)
46
+ self.and << And.new(self, Pending.new(pre + text), &block)
47
+ else
48
+ self.and << And.new(self, pre + text, &block)
49
+ end
50
+ end
51
+
52
+ def AddResult(result)
53
+ result.item = self
54
+ @results << result
55
+ self.parent.result.AddChild(result)
56
+ end
57
+
58
58
  end