sapphire 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sapphire.rb +38 -37
- data/lib/sapphire/Adapters.rb +1 -0
- data/lib/sapphire/Adapters/Selenium/RubySeleniumWebDriver.rb +190 -0
- data/lib/sapphire/DSL.rb +6 -6
- data/lib/sapphire/DSL/Browser/Accept.rb +9 -9
- data/lib/sapphire/DSL/Browser/AlertBox.rb +14 -19
- data/lib/sapphire/DSL/Browser/Browser.rb +17 -17
- data/lib/sapphire/DSL/Browser/By.rb +10 -10
- data/lib/sapphire/DSL/Browser/Check.rb +12 -12
- data/lib/sapphire/DSL/Browser/Clear.rb +12 -12
- data/lib/sapphire/DSL/Browser/Click.rb +12 -12
- data/lib/sapphire/DSL/Browser/Close.rb +12 -12
- data/lib/sapphire/DSL/Browser/Compare.rb +18 -18
- data/lib/sapphire/DSL/Browser/Complete.rb +15 -15
- data/lib/sapphire/DSL/Browser/CurrentUrl.rb +11 -11
- data/lib/sapphire/DSL/Browser/Day.rb +24 -24
- data/lib/sapphire/DSL/Browser/Differ.rb +18 -18
- data/lib/sapphire/DSL/Browser/Error.rb +26 -26
- data/lib/sapphire/DSL/Browser/ExecuteAgainstControl.rb +45 -45
- data/lib/sapphire/DSL/Browser/Exists.rb +22 -22
- data/lib/sapphire/DSL/Browser/For.rb +10 -10
- data/lib/sapphire/DSL/Browser/Hide.rb +26 -26
- data/lib/sapphire/DSL/Browser/IsHidden.rb +10 -10
- data/lib/sapphire/DSL/Browser/IsVisible.rb +33 -33
- data/lib/sapphire/DSL/Browser/Keys/Enter.rb +10 -10
- data/lib/sapphire/DSL/Browser/Month.rb +24 -24
- data/lib/sapphire/DSL/Browser/MouseOver.rb +12 -12
- data/lib/sapphire/DSL/Browser/Navigate.rb +11 -11
- data/lib/sapphire/DSL/Browser/Popup.rb +2 -4
- data/lib/sapphire/DSL/Browser/Press.rb +10 -10
- data/lib/sapphire/DSL/Browser/Reload.rb +11 -11
- data/lib/sapphire/DSL/Browser/Set.rb +18 -18
- data/lib/sapphire/DSL/Browser/Should.rb +42 -42
- data/lib/sapphire/DSL/Browser/Show.rb +26 -26
- data/lib/sapphire/DSL/Browser/Start.rb +16 -16
- data/lib/sapphire/DSL/Browser/To.rb +10 -10
- data/lib/sapphire/DSL/Browser/Tracker.rb +15 -15
- data/lib/sapphire/DSL/Browser/Transition.rb +26 -26
- data/lib/sapphire/DSL/Browser/Uncheck.rb +12 -12
- data/lib/sapphire/DSL/Browser/With.rb +10 -10
- data/lib/sapphire/DSL/Configuration/ConfiguredBrowser.rb +12 -12
- data/lib/sapphire/DSL/Configuration/ConfiguredUser.rb +10 -10
- data/lib/sapphire/DSL/Configuration/Use.rb +15 -15
- data/lib/sapphire/DSL/Data/Exist.rb +27 -27
- data/lib/sapphire/DSL/Data/Find.rb +10 -10
- data/lib/sapphire/DSL/Data/GetPageField.rb +17 -17
- data/lib/sapphire/DSL/Data/Underscore.rb +8 -8
- data/lib/sapphire/DSL/Data/Validate.rb +26 -26
- data/lib/sapphire/DSL/Data/Verify.rb +10 -10
- data/lib/sapphire/DSL/Scenarios/Is.rb +9 -9
- data/lib/sapphire/DSL/Scenarios/Pending.rb +28 -28
- data/lib/sapphire/DSL/Scenarios/and.rb +25 -25
- data/lib/sapphire/DSL/Scenarios/background.rb +33 -33
- data/lib/sapphire/DSL/Scenarios/dsl.rb +59 -59
- data/lib/sapphire/DSL/Scenarios/finally.rb +33 -33
- data/lib/sapphire/DSL/Scenarios/given.rb +57 -57
- data/lib/sapphire/DSL/Scenarios/runner.rb +40 -40
- data/lib/sapphire/DSL/Scenarios/scenario.rb +53 -53
- data/lib/sapphire/DSL/Scenarios/then.rb +34 -34
- data/lib/sapphire/DSL/Scenarios/when.rb +47 -47
- data/lib/sapphire/Data.rb +1 -1
- data/lib/sapphire/DataAbstractions/Database.rb +57 -57
- data/lib/sapphire/DataAbstractions/Query.rb +19 -19
- data/lib/sapphire/JobAbstractions/Job.rb +32 -32
- data/lib/sapphire/Strategies.rb +1 -1
- data/lib/sapphire/TeamCity.rb +8 -8
- data/lib/sapphire/Testing.rb +2 -2
- data/lib/sapphire/Testing/Executable.rb +30 -30
- data/lib/sapphire/Testing/RakeTask.rb +108 -108
- data/lib/sapphire/Testing/ResultList.rb +18 -18
- data/lib/sapphire/Testing/ResultTree.rb +44 -44
- data/lib/sapphire/Testing/ScenarioResult.rb +36 -36
- data/lib/sapphire/Testing/TestResult.rb +21 -21
- data/lib/sapphire/Testing/TestRunnerAdapter.rb +69 -69
- data/lib/sapphire/Virtualization.rb +7 -7
- data/lib/sapphire/Web.rb +3 -6
- data/lib/sapphire/WebAbstractions/{Controls/Browsers → Browsers}/Chrome.rb +21 -21
- data/lib/sapphire/WebAbstractions/{Controls/Browsers → Browsers}/FireFox.rb +22 -22
- data/lib/sapphire/WebAbstractions/{Controls/Browsers → Browsers}/InternetExplorer.rb +21 -21
- data/lib/sapphire/WebAbstractions/Controls/Base/Control.rb +59 -99
- data/lib/sapphire/WebAbstractions/Controls/Base/Page.rb +62 -62
- data/lib/sapphire/WebAbstractions/Controls/Button.rb +9 -9
- data/lib/sapphire/WebAbstractions/Controls/CheckBox.rb +28 -28
- data/lib/sapphire/WebAbstractions/Controls/Date.rb +11 -11
- data/lib/sapphire/WebAbstractions/Controls/DropDown.rb +26 -26
- data/lib/sapphire/WebAbstractions/Controls/Hyperlink.rb +8 -8
- data/lib/sapphire/WebAbstractions/Controls/Image.rb +9 -9
- data/lib/sapphire/WebAbstractions/Controls/Label.rb +8 -8
- data/lib/sapphire/WebAbstractions/Controls/RadioButton.rb +18 -18
- data/lib/sapphire/WebAbstractions/Controls/TextBox.rb +31 -31
- data/lib/sapphire/WebAbstractions/Controls/Title.rb +12 -12
- data/lib/sapphire/version.rb +3 -3
- metadata +14 -13
- data/lib/sapphire/WebAbstractions/Controls/Base/WebBrowser.rb +0 -91
@@ -1,12 +1,12 @@
|
|
1
|
-
module Sapphire
|
2
|
-
module DSL
|
3
|
-
module Browser
|
4
|
-
def Click(*args)
|
5
|
-
ExecuteAgainstControl(args) do |control, arg|
|
6
|
-
control.Click
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
1
|
+
module Sapphire
|
2
|
+
module DSL
|
3
|
+
module Browser
|
4
|
+
def Click(*args)
|
5
|
+
ExecuteAgainstControl(args) do |control, arg|
|
6
|
+
control.Click
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
@@ -1,12 +1,12 @@
|
|
1
|
-
module Sapphire
|
2
|
-
module DSL
|
3
|
-
module Browser
|
4
|
-
def Exit(item)
|
5
|
-
x = item.new
|
6
|
-
x.Close
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
|
1
|
+
module Sapphire
|
2
|
+
module DSL
|
3
|
+
module Browser
|
4
|
+
def Exit(item)
|
5
|
+
x = item.new
|
6
|
+
x.Close
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
|
@@ -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
|
-
control1text = GetPageField(control1).Text
|
7
|
-
else
|
8
|
-
control1text = control1
|
9
|
-
end
|
10
|
-
if(control2.is_a? Symbol)
|
11
|
-
control2text = GetPageField(control2).Text
|
12
|
-
else
|
13
|
-
control2text = control2
|
14
|
-
end
|
15
|
-
block.call(control1text, control2text)
|
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
|
+
control1text = GetPageField(control1).Text
|
7
|
+
else
|
8
|
+
control1text = control1
|
9
|
+
end
|
10
|
+
if(control2.is_a? Symbol)
|
11
|
+
control2text = GetPageField(control2).Text
|
12
|
+
else
|
13
|
+
control2text = control2
|
14
|
+
end
|
15
|
+
block.call(control1text, control2text)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
19
|
end
|
@@ -1,15 +1,15 @@
|
|
1
|
-
module Sapphire
|
2
|
-
module DSL
|
3
|
-
module Browser
|
4
|
-
def Complete(page)
|
5
|
-
if(page.is_a? Class)
|
6
|
-
x = page.new(@browser)
|
7
|
-
else
|
8
|
-
x = page
|
9
|
-
end
|
10
|
-
@page = x.Complete
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
1
|
+
module Sapphire
|
2
|
+
module DSL
|
3
|
+
module Browser
|
4
|
+
def Complete(page)
|
5
|
+
if(page.is_a? Class)
|
6
|
+
x = page.new(@browser)
|
7
|
+
else
|
8
|
+
x = page
|
9
|
+
end
|
10
|
+
@page = x.Complete
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
@@ -1,11 +1,11 @@
|
|
1
|
-
module Sapphire
|
2
|
-
module DSL
|
3
|
-
module Browser
|
4
|
-
def CurrentUrl(value)
|
5
|
-
url = @browser.CurrentUrl
|
6
|
-
url == value
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
1
|
+
module Sapphire
|
2
|
+
module DSL
|
3
|
+
module Browser
|
4
|
+
def CurrentUrl(value)
|
5
|
+
url = @browser.CurrentUrl
|
6
|
+
url == value
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
@@ -1,24 +1,24 @@
|
|
1
|
-
module Sapphire
|
2
|
-
module DSL
|
3
|
-
module Browser
|
4
|
-
def Day(value, compare1, compare2)
|
5
|
-
Day.new(value, compare1, compare2)
|
6
|
-
end
|
7
|
-
|
8
|
-
class Day
|
9
|
-
|
10
|
-
def initialize(value, compare1, compare2)
|
11
|
-
@value = value
|
12
|
-
@compare1 = compare1
|
13
|
-
@compare2 = compare2
|
14
|
-
end
|
15
|
-
|
16
|
-
def Differ()
|
17
|
-
return (@compare1 + @value) == @compare2
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
1
|
+
module Sapphire
|
2
|
+
module DSL
|
3
|
+
module Browser
|
4
|
+
def Day(value, compare1, compare2)
|
5
|
+
Day.new(value, compare1, compare2)
|
6
|
+
end
|
7
|
+
|
8
|
+
class Day
|
9
|
+
|
10
|
+
def initialize(value, compare1, compare2)
|
11
|
+
@value = value
|
12
|
+
@compare1 = compare1
|
13
|
+
@compare2 = compare2
|
14
|
+
end
|
15
|
+
|
16
|
+
def Differ()
|
17
|
+
return (@compare1 + @value) == @compare2
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
@@ -1,19 +1,19 @@
|
|
1
|
-
module Sapphire
|
2
|
-
module DSL
|
3
|
-
module Browser
|
4
|
-
def Differ(arg)
|
5
|
-
return Differ.new(arg)
|
6
|
-
end
|
7
|
-
|
8
|
-
class Differ
|
9
|
-
def initialize(arg)
|
10
|
-
@arg = arg
|
11
|
-
end
|
12
|
-
|
13
|
-
def execute
|
14
|
-
return Evaluation.new(true, @arg.Differ) #args[0] is the value that should be the difference
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
1
|
+
module Sapphire
|
2
|
+
module DSL
|
3
|
+
module Browser
|
4
|
+
def Differ(arg)
|
5
|
+
return Differ.new(arg)
|
6
|
+
end
|
7
|
+
|
8
|
+
class Differ
|
9
|
+
def initialize(arg)
|
10
|
+
@arg = arg
|
11
|
+
end
|
12
|
+
|
13
|
+
def execute
|
14
|
+
return Evaluation.new(true, @arg.Differ) #args[0] is the value that should be the difference
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
19
|
end
|
@@ -1,26 +1,26 @@
|
|
1
|
-
module Sapphire
|
2
|
-
module DSL
|
3
|
-
module Browser
|
4
|
-
def Error(hash)
|
5
|
-
NullModifier.new(Error.new(hash, @page, @browser))
|
6
|
-
end
|
7
|
-
|
8
|
-
class Error
|
9
|
-
def initialize(item, page, browser)
|
10
|
-
@item = item
|
11
|
-
@page = page
|
12
|
-
@browser = browser
|
13
|
-
end
|
14
|
-
|
15
|
-
def ModifyWith(item)
|
16
|
-
@modifier = item
|
17
|
-
end
|
18
|
-
|
19
|
-
def execute
|
20
|
-
return { :value => SapphireConfig.Current.GetBy(@item.class).new(@page, @browser).Error(@item), :modifier => @modifier }
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
1
|
+
module Sapphire
|
2
|
+
module DSL
|
3
|
+
module Browser
|
4
|
+
def Error(hash)
|
5
|
+
NullModifier.new(Error.new(hash, @page, @browser))
|
6
|
+
end
|
7
|
+
|
8
|
+
class Error
|
9
|
+
def initialize(item, page, browser)
|
10
|
+
@item = item
|
11
|
+
@page = page
|
12
|
+
@browser = browser
|
13
|
+
end
|
14
|
+
|
15
|
+
def ModifyWith(item)
|
16
|
+
@modifier = item
|
17
|
+
end
|
18
|
+
|
19
|
+
def execute
|
20
|
+
return { :value => SapphireConfig.Current.GetBy(@item.class).new(@page, @browser).Error(@item), :modifier => @modifier }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
@@ -1,45 +1,45 @@
|
|
1
|
-
module Sapphire
|
2
|
-
module DSL
|
3
|
-
module Browser
|
4
|
-
def ExecuteHashAgainstControl(hash, page, &block)
|
5
|
-
hash.keys.each do |key|
|
6
|
-
page.fields.each do |field|
|
7
|
-
field.keys.each do |field_key|
|
8
|
-
if(field_key == key)
|
9
|
-
block.call(field[field_key], hash[key])
|
10
|
-
return
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
raise "cannot find control matching " + hash.to_s + " for page " + @page.to_s
|
17
|
-
end
|
18
|
-
|
19
|
-
def ExecuteAgainstControl(*args, &block)
|
20
|
-
@page.fields.each do |field|
|
21
|
-
field.keys.each do |field_key|
|
22
|
-
args.each do |arg_array|
|
23
|
-
arg_array.each do |arg|
|
24
|
-
if(field_key == arg)
|
25
|
-
block.call(field[field_key], arg)
|
26
|
-
return
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
arglist = ""
|
34
|
-
args.each do |arg_array|
|
35
|
-
arg_array.each do |arg|
|
36
|
-
arglist += arg.to_s + ", "
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
raise "Cannot find controls matching: " + arglist + "for page " + @page.to_s
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
1
|
+
module Sapphire
|
2
|
+
module DSL
|
3
|
+
module Browser
|
4
|
+
def ExecuteHashAgainstControl(hash, page, &block)
|
5
|
+
hash.keys.each do |key|
|
6
|
+
page.fields.each do |field|
|
7
|
+
field.keys.each do |field_key|
|
8
|
+
if(field_key == key)
|
9
|
+
block.call(field[field_key], hash[key])
|
10
|
+
return
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
raise "cannot find control matching " + hash.to_s + " for page " + @page.to_s
|
17
|
+
end
|
18
|
+
|
19
|
+
def ExecuteAgainstControl(*args, &block)
|
20
|
+
@page.fields.each do |field|
|
21
|
+
field.keys.each do |field_key|
|
22
|
+
args.each do |arg_array|
|
23
|
+
arg_array.each do |arg|
|
24
|
+
if(field_key == arg)
|
25
|
+
block.call(field[field_key], arg)
|
26
|
+
return
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
arglist = ""
|
34
|
+
args.each do |arg_array|
|
35
|
+
arg_array.each do |arg|
|
36
|
+
arglist += arg.to_s + ", "
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
raise "Cannot find controls matching: " + arglist + "for page " + @page.to_s
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
@@ -1,22 +1,22 @@
|
|
1
|
-
module Sapphire
|
2
|
-
module DSL
|
3
|
-
module Browser
|
4
|
-
def Exists(symbol)
|
5
|
-
@page.fields.each do |field|
|
6
|
-
field.keys.each do |field_key|
|
7
|
-
if(field_key == symbol)
|
8
|
-
begin
|
9
|
-
x = field[field_key].FindWithoutWait
|
10
|
-
return x.displayed?
|
11
|
-
rescue
|
12
|
-
return false
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
false
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
1
|
+
module Sapphire
|
2
|
+
module DSL
|
3
|
+
module Browser
|
4
|
+
def Exists(symbol)
|
5
|
+
@page.fields.each do |field|
|
6
|
+
field.keys.each do |field_key|
|
7
|
+
if(field_key == symbol)
|
8
|
+
begin
|
9
|
+
x = field[field_key].FindWithoutWait
|
10
|
+
return x.displayed?
|
11
|
+
rescue
|
12
|
+
return false
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
false
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
@@ -1,10 +1,10 @@
|
|
1
|
-
module Sapphire
|
2
|
-
module DSL
|
3
|
-
module Browser
|
4
|
-
def For(item)
|
5
|
-
{item => GetPageField(item).Text}
|
6
|
-
end
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
1
|
+
module Sapphire
|
2
|
+
module DSL
|
3
|
+
module Browser
|
4
|
+
def For(item)
|
5
|
+
{item => GetPageField(item).Text}
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
@@ -1,26 +1,26 @@
|
|
1
|
-
module Sapphire
|
2
|
-
module DSL
|
3
|
-
module Browser
|
4
|
-
def Hide(args)
|
5
|
-
NullModifier.new(Hide.new(args, @page, @browser))
|
6
|
-
end
|
7
|
-
|
8
|
-
class Hide
|
9
|
-
def initialize(item, page, browser)
|
10
|
-
@item = item
|
11
|
-
@page = page
|
12
|
-
@browser = browser
|
13
|
-
end
|
14
|
-
|
15
|
-
def ModifyWith(item)
|
16
|
-
@modifier = item
|
17
|
-
end
|
18
|
-
|
19
|
-
def execute
|
20
|
-
return { :value => SapphireConfig.Current.GetBy(@item.class).new(@page, @browser).Hide(@item, @modifier), :modifier => @modifier }
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
1
|
+
module Sapphire
|
2
|
+
module DSL
|
3
|
+
module Browser
|
4
|
+
def Hide(args)
|
5
|
+
NullModifier.new(Hide.new(args, @page, @browser))
|
6
|
+
end
|
7
|
+
|
8
|
+
class Hide
|
9
|
+
def initialize(item, page, browser)
|
10
|
+
@item = item
|
11
|
+
@page = page
|
12
|
+
@browser = browser
|
13
|
+
end
|
14
|
+
|
15
|
+
def ModifyWith(item)
|
16
|
+
@modifier = item
|
17
|
+
end
|
18
|
+
|
19
|
+
def execute
|
20
|
+
return { :value => SapphireConfig.Current.GetBy(@item.class).new(@page, @browser).Hide(@item, @modifier), :modifier => @modifier }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|