sapphire 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sapphire/DSL/Browser/Browser.rb +13 -13
- data/lib/sapphire/DSL/Browser/Check.rb +12 -12
- data/lib/sapphire/DSL/Browser/Clear.rb +15 -15
- data/lib/sapphire/DSL/Browser/Click.rb +12 -12
- data/lib/sapphire/DSL/Browser/Close.rb +12 -12
- data/lib/sapphire/DSL/Browser/Complete.rb +15 -15
- data/lib/sapphire/DSL/Browser/CurrentUrl.rb +11 -11
- data/lib/sapphire/DSL/Browser/Error.rb +12 -12
- 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 +10 -10
- data/lib/sapphire/DSL/Browser/IsHidden.rb +28 -28
- data/lib/sapphire/DSL/Browser/IsVisible.rb +25 -25
- data/lib/sapphire/DSL/Browser/MouseOver.rb +12 -12
- data/lib/sapphire/DSL/Browser/Navigate.rb +11 -11
- data/lib/sapphire/DSL/Browser/Not.rb +9 -0
- data/lib/sapphire/DSL/Browser/Reload.rb +11 -11
- data/lib/sapphire/DSL/Browser/Set.rb +12 -12
- data/lib/sapphire/DSL/Browser/Should.rb +10 -10
- data/lib/sapphire/DSL/Browser/Show.rb +27 -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 +10 -10
- 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 +11 -11
- 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 +16 -16
- 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 +24 -24
- data/lib/sapphire/DSL/Scenarios/background.rb +22 -22
- data/lib/sapphire/DSL/Scenarios/dsl.rb +60 -60
- data/lib/sapphire/DSL/Scenarios/finally.rb +31 -31
- data/lib/sapphire/DSL/Scenarios/given.rb +56 -56
- data/lib/sapphire/DSL/Scenarios/runner.rb +30 -30
- data/lib/sapphire/DSL/Scenarios/scenario.rb +51 -51
- data/lib/sapphire/DSL/Scenarios/then.rb +33 -33
- data/lib/sapphire/DSL/Scenarios/when.rb +46 -46
- data/lib/sapphire/DataAbstractions/Database.rb +57 -57
- data/lib/sapphire/DataAbstractions/Query.rb +19 -19
- data/lib/sapphire/Testing/ResultList.rb +18 -18
- data/lib/sapphire/Testing/ResultTree.rb +37 -37
- data/lib/sapphire/WebAbstractions/Controls/Base/Control.rb +74 -74
- data/lib/sapphire/WebAbstractions/Controls/Base/Page.rb +47 -47
- data/lib/sapphire/WebAbstractions/Controls/Base/WebBrowser.rb +74 -74
- data/lib/sapphire/WebAbstractions/Controls/Button.rb +9 -9
- data/lib/sapphire/WebAbstractions/Controls/CheckBox.rb +28 -28
- data/lib/sapphire/WebAbstractions/Controls/Chrome.rb +21 -21
- data/lib/sapphire/WebAbstractions/Controls/DropDown.rb +25 -25
- data/lib/sapphire/WebAbstractions/Controls/FireFox.rb +22 -22
- data/lib/sapphire/WebAbstractions/Controls/Hyperlink.rb +8 -8
- data/lib/sapphire/WebAbstractions/Controls/Image.rb +9 -9
- data/lib/sapphire/WebAbstractions/Controls/InternetExplorer.rb +21 -21
- data/lib/sapphire/WebAbstractions/Controls/Label.rb +8 -8
- data/lib/sapphire/WebAbstractions/Controls/RadioButton.rb +18 -18
- data/lib/sapphire/WebAbstractions/Controls/TableCell.rb +10 -0
- data/lib/sapphire/WebAbstractions/Controls/TextBox.rb +31 -31
- data/lib/sapphire/WebAbstractions/Controls/Title.rb +12 -12
- data/lib/sapphire/version.rb +1 -1
- metadata +13 -9
@@ -1,74 +1,74 @@
|
|
1
|
-
module Sapphire
|
2
|
-
module WebAbstractions
|
3
|
-
module WebBrowser
|
4
|
-
|
5
|
-
attr_reader :rootUrl
|
6
|
-
|
7
|
-
def Init(url)
|
8
|
-
@rootUrl = url
|
9
|
-
end
|
10
|
-
|
11
|
-
def SetRootUrl(url)
|
12
|
-
if(url.instance_of?(String))
|
13
|
-
self.Init(url)
|
14
|
-
else
|
15
|
-
x = url.new().Url
|
16
|
-
self.Init(x)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def NavigateTo(page)
|
21
|
-
if(page.is_a? Class)
|
22
|
-
nav = page.new self
|
23
|
-
else
|
24
|
-
nav = page
|
25
|
-
end
|
26
|
-
|
27
|
-
self.browser.get "https://" + nav.Url
|
28
|
-
nav
|
29
|
-
end
|
30
|
-
|
31
|
-
def CurrentUrl
|
32
|
-
self.current_url
|
33
|
-
end
|
34
|
-
|
35
|
-
def Reload
|
36
|
-
self.browser.get self.current_url
|
37
|
-
end
|
38
|
-
|
39
|
-
def ShouldNavigateTo(page)
|
40
|
-
if(page.is_a? Class)
|
41
|
-
nav = page.new self
|
42
|
-
else
|
43
|
-
nav = page
|
44
|
-
end
|
45
|
-
|
46
|
-
self.current_url.upcase.start_with?("HTTPS://" + nav.Url.upcase)
|
47
|
-
|
48
|
-
nav
|
49
|
-
end
|
50
|
-
|
51
|
-
def Run(background)
|
52
|
-
scenario = background.new self
|
53
|
-
scenario.Run
|
54
|
-
end
|
55
|
-
|
56
|
-
def ShouldShow(page)
|
57
|
-
self.ShouldNavigateTo page
|
58
|
-
end
|
59
|
-
|
60
|
-
def ShouldTransitionTo(url)
|
61
|
-
if(url.instance_of?(String))
|
62
|
-
self.current_url.upcase.start_with?("HTTPS://" + url.upcase)
|
63
|
-
@rootUrl = url
|
64
|
-
else
|
65
|
-
x = url.new().Url
|
66
|
-
self.current_url.upcase.start_with?("HTTPS://" + x.upcase)
|
67
|
-
@rootUrl = x
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
|
1
|
+
module Sapphire
|
2
|
+
module WebAbstractions
|
3
|
+
module WebBrowser
|
4
|
+
|
5
|
+
attr_reader :rootUrl
|
6
|
+
|
7
|
+
def Init(url)
|
8
|
+
@rootUrl = url
|
9
|
+
end
|
10
|
+
|
11
|
+
def SetRootUrl(url)
|
12
|
+
if(url.instance_of?(String))
|
13
|
+
self.Init(url)
|
14
|
+
else
|
15
|
+
x = url.new().Url
|
16
|
+
self.Init(x)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def NavigateTo(page)
|
21
|
+
if(page.is_a? Class)
|
22
|
+
nav = page.new self
|
23
|
+
else
|
24
|
+
nav = page
|
25
|
+
end
|
26
|
+
|
27
|
+
self.browser.get "https://" + nav.Url
|
28
|
+
nav
|
29
|
+
end
|
30
|
+
|
31
|
+
def CurrentUrl
|
32
|
+
self.current_url
|
33
|
+
end
|
34
|
+
|
35
|
+
def Reload
|
36
|
+
self.browser.get self.current_url
|
37
|
+
end
|
38
|
+
|
39
|
+
def ShouldNavigateTo(page)
|
40
|
+
if(page.is_a? Class)
|
41
|
+
nav = page.new self
|
42
|
+
else
|
43
|
+
nav = page
|
44
|
+
end
|
45
|
+
|
46
|
+
self.current_url.upcase.start_with?("HTTPS://" + nav.Url.upcase) == true
|
47
|
+
|
48
|
+
nav
|
49
|
+
end
|
50
|
+
|
51
|
+
def Run(background)
|
52
|
+
scenario = background.new self
|
53
|
+
scenario.Run
|
54
|
+
end
|
55
|
+
|
56
|
+
def ShouldShow(page)
|
57
|
+
self.ShouldNavigateTo page
|
58
|
+
end
|
59
|
+
|
60
|
+
def ShouldTransitionTo(url)
|
61
|
+
if(url.instance_of?(String))
|
62
|
+
self.current_url.upcase.start_with?("HTTPS://" + url.upcase) == true
|
63
|
+
@rootUrl = url
|
64
|
+
else
|
65
|
+
x = url.new().Url
|
66
|
+
self.current_url.upcase.start_with?("HTTPS://" + x.upcase) == true
|
67
|
+
@rootUrl = x
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
|
@@ -1,9 +1,9 @@
|
|
1
|
-
require File.expand_path('../../WebAbstractions/Controls/Base/Control', File.dirname(__FILE__))
|
2
|
-
|
3
|
-
module Sapphire
|
4
|
-
module WebAbstractions
|
5
|
-
class Button < Control
|
6
|
-
end
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
1
|
+
require File.expand_path('../../WebAbstractions/Controls/Base/Control', File.dirname(__FILE__))
|
2
|
+
|
3
|
+
module Sapphire
|
4
|
+
module WebAbstractions
|
5
|
+
class Button < Control
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
@@ -1,28 +1,28 @@
|
|
1
|
-
module Sapphire
|
2
|
-
module WebAbstractions
|
3
|
-
class CheckBox < Control
|
4
|
-
def Check (value)
|
5
|
-
|
6
|
-
if value && self.IsChecked
|
7
|
-
return;
|
8
|
-
end
|
9
|
-
|
10
|
-
if !value && !self.IsChecked
|
11
|
-
return;
|
12
|
-
end
|
13
|
-
|
14
|
-
radio = self.Find
|
15
|
-
radio.click
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
def IsChecked
|
20
|
-
|
21
|
-
radio = self.Find
|
22
|
-
radio.attribute("checked");
|
23
|
-
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
1
|
+
module Sapphire
|
2
|
+
module WebAbstractions
|
3
|
+
class CheckBox < Control
|
4
|
+
def Check (value)
|
5
|
+
|
6
|
+
if value && self.IsChecked
|
7
|
+
return;
|
8
|
+
end
|
9
|
+
|
10
|
+
if !value && !self.IsChecked
|
11
|
+
return;
|
12
|
+
end
|
13
|
+
|
14
|
+
radio = self.Find
|
15
|
+
radio.click
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
def IsChecked
|
20
|
+
|
21
|
+
radio = self.Find
|
22
|
+
radio.attribute("checked");
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
@@ -1,21 +1,21 @@
|
|
1
|
-
module Sapphire
|
2
|
-
module WebAbstractions
|
3
|
-
def Chrome(url)
|
4
|
-
ChromeBrowser.new
|
5
|
-
end
|
6
|
-
|
7
|
-
class ChromeBrowser < DelegateClass(Selenium::WebDriver::Chrome::Bridge)
|
8
|
-
include WebBrowser
|
9
|
-
|
10
|
-
attr_reader :browser
|
11
|
-
|
12
|
-
def initialize()
|
13
|
-
@browser = Selenium::WebDriver.for :chrome
|
14
|
-
super @browser
|
15
|
-
$browser = @browser
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
|
1
|
+
module Sapphire
|
2
|
+
module WebAbstractions
|
3
|
+
def Chrome(url)
|
4
|
+
ChromeBrowser.new
|
5
|
+
end
|
6
|
+
|
7
|
+
class ChromeBrowser < DelegateClass(Selenium::WebDriver::Chrome::Bridge)
|
8
|
+
include WebBrowser
|
9
|
+
|
10
|
+
attr_reader :browser
|
11
|
+
|
12
|
+
def initialize()
|
13
|
+
@browser = Selenium::WebDriver.for :chrome
|
14
|
+
super @browser
|
15
|
+
$browser = @browser
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
|
@@ -1,25 +1,25 @@
|
|
1
|
-
module Sapphire
|
2
|
-
module WebAbstractions
|
3
|
-
class DropDown < Control
|
4
|
-
def Selected= (value)
|
5
|
-
text = self.Find
|
6
|
-
text.send_keys value
|
7
|
-
end
|
8
|
-
|
9
|
-
def Selected
|
10
|
-
text = self.Find
|
11
|
-
text.value
|
12
|
-
end
|
13
|
-
|
14
|
-
def Set(value)
|
15
|
-
text = self.Find
|
16
|
-
text.send_keys value
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
1
|
+
module Sapphire
|
2
|
+
module WebAbstractions
|
3
|
+
class DropDown < Control
|
4
|
+
def Selected= (value)
|
5
|
+
text = self.Find
|
6
|
+
text.send_keys value
|
7
|
+
end
|
8
|
+
|
9
|
+
def Selected
|
10
|
+
text = self.Find
|
11
|
+
text.value
|
12
|
+
end
|
13
|
+
|
14
|
+
def Set(value)
|
15
|
+
text = self.Find
|
16
|
+
text.send_keys value
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
@@ -1,22 +1,22 @@
|
|
1
|
-
module Sapphire
|
2
|
-
module WebAbstractions
|
3
|
-
class FireFoxBrowser < DelegateClass(Selenium::WebDriver::Firefox::Bridge)
|
4
|
-
include WebBrowser
|
5
|
-
|
6
|
-
attr_reader :browser
|
7
|
-
|
8
|
-
def initialize()
|
9
|
-
@browser = Selenium::WebDriver.for :firefox
|
10
|
-
super(@browser)
|
11
|
-
$browser = @browser
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
15
|
-
|
16
|
-
def FireFox(url)
|
17
|
-
FireFoxBrowser.new
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
|
1
|
+
module Sapphire
|
2
|
+
module WebAbstractions
|
3
|
+
class FireFoxBrowser < DelegateClass(Selenium::WebDriver::Firefox::Bridge)
|
4
|
+
include WebBrowser
|
5
|
+
|
6
|
+
attr_reader :browser
|
7
|
+
|
8
|
+
def initialize()
|
9
|
+
@browser = Selenium::WebDriver.for :firefox
|
10
|
+
super(@browser)
|
11
|
+
$browser = @browser
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
def FireFox(url)
|
17
|
+
FireFoxBrowser.new
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
|
@@ -1,8 +1,8 @@
|
|
1
|
-
module Sapphire
|
2
|
-
module WebAbstractions
|
3
|
-
class Hyperlink < Control
|
4
|
-
|
5
|
-
end
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
1
|
+
module Sapphire
|
2
|
+
module WebAbstractions
|
3
|
+
class Hyperlink < Control
|
4
|
+
|
5
|
+
end
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
@@ -1,9 +1,9 @@
|
|
1
|
-
module Sapphire
|
2
|
-
module WebAbstractions
|
3
|
-
class Image < Control
|
4
|
-
|
5
|
-
end
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
|
1
|
+
module Sapphire
|
2
|
+
module WebAbstractions
|
3
|
+
class Image < Control
|
4
|
+
|
5
|
+
end
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
|
@@ -1,21 +1,21 @@
|
|
1
|
-
module Sapphire
|
2
|
-
module WebAbstractions
|
3
|
-
def InternetExplorer(url)
|
4
|
-
driver = InternetExplorerBrowser.new
|
5
|
-
driver
|
6
|
-
end
|
7
|
-
|
8
|
-
class InternetExplorerBrowser < DelegateClass(Selenium::WebDriver::IE::Bridge)
|
9
|
-
include WebBrowser
|
10
|
-
|
11
|
-
attr_reader :browser
|
12
|
-
|
13
|
-
def initialize
|
14
|
-
#@browser = Selenium::WebDriver.for :ie
|
15
|
-
super(@browser)
|
16
|
-
$browser = @browser
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
1
|
+
module Sapphire
|
2
|
+
module WebAbstractions
|
3
|
+
def InternetExplorer(url)
|
4
|
+
driver = InternetExplorerBrowser.new
|
5
|
+
driver
|
6
|
+
end
|
7
|
+
|
8
|
+
class InternetExplorerBrowser < DelegateClass(Selenium::WebDriver::IE::Bridge)
|
9
|
+
include WebBrowser
|
10
|
+
|
11
|
+
attr_reader :browser
|
12
|
+
|
13
|
+
def initialize
|
14
|
+
#@browser = Selenium::WebDriver.for :ie
|
15
|
+
super(@browser)
|
16
|
+
$browser = @browser
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
@@ -1,8 +1,8 @@
|
|
1
|
-
module Sapphire
|
2
|
-
module WebAbstractions
|
3
|
-
class Label < Control
|
4
|
-
|
5
|
-
end
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
1
|
+
module Sapphire
|
2
|
+
module WebAbstractions
|
3
|
+
class Label < Control
|
4
|
+
|
5
|
+
end
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|