sapphire 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sapphire/Adapters/Selenium/RubySeleniumWebDriver.rb +190 -190
- data/lib/sapphire/DSL/Browser/ExecuteAgainstControl.rb +34 -45
- data/lib/sapphire/DSL/Browser/Extensions/Class.rb +29 -0
- data/lib/sapphire/DSL/Browser/Extensions/Hash.rb +11 -0
- data/lib/sapphire/DSL/Browser/Extensions/Numeric.rb +7 -0
- data/lib/sapphire/DSL/Browser/Extensions/Symbol.rb +37 -0
- data/lib/sapphire/DSL/Browser/{By.rb → Fluff/By.rb} +10 -10
- data/lib/sapphire/DSL/Browser/{To.rb → Fluff/To.rb} +10 -10
- data/lib/sapphire/DSL/Browser/{With.rb → Fluff/With.rb} +10 -10
- data/lib/sapphire/DSL/Browser/For.rb +10 -10
- data/lib/sapphire/DSL/Browser/{AlertBox.rb → Nouns/AlertBox.rb} +14 -14
- data/lib/sapphire/DSL/Browser/{Browser.rb → Nouns/Browser.rb} +17 -17
- data/lib/sapphire/DSL/Browser/{Day.rb → Nouns/Day.rb} +24 -24
- data/lib/sapphire/DSL/Browser/{Keys → Nouns}/Enter.rb +10 -10
- data/lib/sapphire/DSL/Browser/{Month.rb → Nouns/Month.rb} +24 -24
- data/lib/sapphire/DSL/Browser/{Popup.rb → Nouns/Popup.rb} +0 -0
- data/lib/sapphire/DSL/Browser/Should.rb +42 -42
- data/lib/sapphire/DSL/Browser/Tracker.rb +15 -15
- data/lib/sapphire/DSL/Browser/{Accept.rb → Verbs/Accept.rb} +9 -9
- data/lib/sapphire/DSL/Browser/Verbs/Check.rb +11 -0
- data/lib/sapphire/DSL/Browser/{IsHidden.rb → Verbs/Clear.rb} +9 -10
- data/lib/sapphire/DSL/Browser/Verbs/Click.rb +11 -0
- data/lib/sapphire/DSL/Browser/{Close.rb → Verbs/Close.rb} +11 -12
- data/lib/sapphire/DSL/Browser/{Compare.rb → Verbs/Compare.rb} +18 -18
- data/lib/sapphire/DSL/Browser/Verbs/Complete.rb +10 -0
- data/lib/sapphire/DSL/Browser/{Differ.rb → Verbs/Differ.rb} +18 -18
- data/lib/sapphire/DSL/Browser/{Disable.rb → Verbs/Disable.rb} +0 -0
- data/lib/sapphire/DSL/Browser/{Error.rb → Verbs/Error.rb} +25 -26
- data/lib/sapphire/DSL/Browser/{Exists.rb → Verbs/Exists.rb} +22 -22
- data/lib/sapphire/DSL/Browser/{Hide.rb → Verbs/Hide.rb} +25 -26
- data/lib/sapphire/DSL/Browser/Verbs/MouseOver.rb +11 -0
- data/lib/sapphire/DSL/Browser/{Navigate.rb → Verbs/Navigate.rb} +11 -11
- data/lib/sapphire/DSL/Browser/{Press.rb → Verbs/Press.rb} +8 -10
- data/lib/sapphire/DSL/Browser/{Reload.rb → Verbs/Reload.rb} +11 -11
- data/lib/sapphire/DSL/Browser/Verbs/Set.rb +10 -0
- data/lib/sapphire/DSL/Browser/{Show.rb → Verbs/Show.rb} +25 -26
- data/lib/sapphire/DSL/Browser/{Start.rb → Verbs/Start.rb} +16 -16
- data/lib/sapphire/DSL/Browser/{Switch.rb → Verbs/Switch.rb} +0 -0
- data/lib/sapphire/DSL/Browser/{Transition.rb → Verbs/Transition.rb} +25 -26
- data/lib/sapphire/DSL/Browser/Verbs/Uncheck.rb +11 -0
- data/lib/sapphire/DSL/Browser/{Virtually.rb → Verbs/Virtually.rb} +0 -0
- data/lib/sapphire/DSL/Browser/{Wait.rb → Verbs/Wait.rb} +2 -2
- 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/DSL.rb +10 -6
- 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/ClassStrategy.rb +1 -1
- data/lib/sapphire/Strategies/Strategy.rb +1 -2
- data/lib/sapphire/Strategies.rb +1 -1
- data/lib/sapphire/TeamCity.rb +8 -8
- 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/Testing.rb +2 -2
- data/lib/sapphire/Virtualization.rb +7 -7
- data/lib/sapphire/Web.rb +2 -2
- data/lib/sapphire/WebAbstractions/Browsers/Chrome.rb +21 -21
- data/lib/sapphire/WebAbstractions/Browsers/FireFox.rb +22 -22
- data/lib/sapphire/WebAbstractions/Browsers/InternetExplorer.rb +21 -21
- data/lib/sapphire/WebAbstractions/Controls/Base/Control.rb +58 -59
- data/lib/sapphire/WebAbstractions/Controls/Base/Page.rb +61 -62
- data/lib/sapphire/WebAbstractions/Controls/Button.rb +7 -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
- data/lib/sapphire.rb +38 -38
- metadata +46 -45
- data/lib/sapphire/DSL/Browser/Check.rb +0 -12
- data/lib/sapphire/DSL/Browser/Clear.rb +0 -13
- data/lib/sapphire/DSL/Browser/Click.rb +0 -12
- data/lib/sapphire/DSL/Browser/Complete.rb +0 -15
- data/lib/sapphire/DSL/Browser/CurrentUrl.rb +0 -11
- data/lib/sapphire/DSL/Browser/IsVisible.rb +0 -33
- data/lib/sapphire/DSL/Browser/MouseOver.rb +0 -12
- data/lib/sapphire/DSL/Browser/Set.rb +0 -18
- data/lib/sapphire/DSL/Browser/Uncheck.rb +0 -12
@@ -1,190 +1,190 @@
|
|
1
|
-
module Sapphire
|
2
|
-
module WebAbstractions
|
3
|
-
module RubySeleniumWebDriver
|
4
|
-
|
5
|
-
attr_reader :rootUrl
|
6
|
-
|
7
|
-
def Init(url)
|
8
|
-
@rootUrl = url
|
9
|
-
end
|
10
|
-
|
11
|
-
def Close
|
12
|
-
self.browser.close
|
13
|
-
end
|
14
|
-
|
15
|
-
def Switch
|
16
|
-
self.browser.switch_to.window(self.browser.window_handles[0])
|
17
|
-
end
|
18
|
-
|
19
|
-
def Type(keys)
|
20
|
-
self.browser.action.send_keys(keys).perform()
|
21
|
-
end
|
22
|
-
|
23
|
-
def AcceptAlert
|
24
|
-
alert = self.browser.switch_to.alert
|
25
|
-
alert.accept()
|
26
|
-
self.browser.switch_to.window(self.browser.window_handles[0])
|
27
|
-
end
|
28
|
-
|
29
|
-
def SetAlert(text)
|
30
|
-
alert = self.browser.switch_to.alert
|
31
|
-
alert.send_keys(text)
|
32
|
-
alert.accept()
|
33
|
-
self.browser.switch_to.window(self.browser.window_handles[0])
|
34
|
-
end
|
35
|
-
|
36
|
-
def ClosePopup
|
37
|
-
self.browser.switch_to.window(self.browser.window_handles.last)
|
38
|
-
self.browser.close
|
39
|
-
self.browser.switch_to.window(self.browser.window_handles[0])
|
40
|
-
end
|
41
|
-
|
42
|
-
def SwitchToPopup
|
43
|
-
self.browser.switch_to.window(self.browser.window_handles.last)
|
44
|
-
end
|
45
|
-
|
46
|
-
def SetRootUrl(url)
|
47
|
-
if(url.instance_of?(String))
|
48
|
-
self.Init(url)
|
49
|
-
else
|
50
|
-
x = url.new().Url
|
51
|
-
self.Init(x)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
def NavigateTo(page)
|
56
|
-
if(page.is_a? Class)
|
57
|
-
nav = page.new
|
58
|
-
else
|
59
|
-
nav = page
|
60
|
-
end
|
61
|
-
|
62
|
-
self.browser.get "https://" + nav.Url
|
63
|
-
nav.Init
|
64
|
-
nav
|
65
|
-
end
|
66
|
-
|
67
|
-
def CurrentUrl
|
68
|
-
wait = Selenium::WebDriver::Wait.new(:timeout => 30)
|
69
|
-
url = wait.until { x = self.browser.current_url
|
70
|
-
x unless x == nil
|
71
|
-
}
|
72
|
-
|
73
|
-
url
|
74
|
-
end
|
75
|
-
|
76
|
-
def Reload
|
77
|
-
self.browser.get self.CurrentUrl
|
78
|
-
end
|
79
|
-
|
80
|
-
def ShouldNavigateTo(page)
|
81
|
-
if(page.is_a? Class)
|
82
|
-
nav = page.new
|
83
|
-
else
|
84
|
-
nav = page
|
85
|
-
end
|
86
|
-
|
87
|
-
wait = Selenium::WebDriver::Wait.new(:timeout => 30)
|
88
|
-
found = wait.until {
|
89
|
-
x = self.CurrentUrl.upcase.start_with?("HTTP://" + nav.Url.upcase) || self.CurrentUrl.upcase.start_with?("HTTPS://" + nav.Url.upcase)
|
90
|
-
if(x == false)
|
91
|
-
nav.AlternateUrls.each do |url|
|
92
|
-
x = self.CurrentUrl.upcase.start_with?("HTTP://" + url.upcase) || self.CurrentUrl.upcase.start_with?("HTTPS://" + url.upcase)
|
93
|
-
end
|
94
|
-
end
|
95
|
-
x
|
96
|
-
}
|
97
|
-
temp = Evaluation.new(found, true)
|
98
|
-
return temp, nav
|
99
|
-
end
|
100
|
-
|
101
|
-
def Run(background)
|
102
|
-
scenario = background.new
|
103
|
-
scenario.Run
|
104
|
-
end
|
105
|
-
|
106
|
-
def ShouldShow(page)
|
107
|
-
self.ShouldNavigateTo page
|
108
|
-
end
|
109
|
-
|
110
|
-
def ShouldTransitionTo(url)
|
111
|
-
if(url.instance_of?(String))
|
112
|
-
temp = Evaluation.new(self.CurrentUrl.upcase.start_with?("HTTP://" + url.upcase) || self.CurrentUrl.upcase.start_with?("HTTPS://" + url.upcase), true)
|
113
|
-
@rootUrl = url
|
114
|
-
else
|
115
|
-
x = url.new().Url
|
116
|
-
temp = Evaluation.new(self.CurrentUrl.upcase.start_with?("HTTP://" + x.upcase) || self.CurrentUrl.upcase.start_with?("HTTPS://" + x.upcase), true)
|
117
|
-
@rootUrl = x
|
118
|
-
end
|
119
|
-
|
120
|
-
return temp
|
121
|
-
end
|
122
|
-
|
123
|
-
def FindItem(hash)
|
124
|
-
masterWait = Selenium::WebDriver::Wait.new(:timeout => 30)
|
125
|
-
|
126
|
-
element = masterWait.until {
|
127
|
-
hash.each do |item|
|
128
|
-
wait = Selenium::WebDriver::Wait.new(:timeout => 1)
|
129
|
-
begin
|
130
|
-
y = wait.until {
|
131
|
-
x = self.FindElement item.keys.first, item.fetch(item.keys.first) if item.is_a? Hash
|
132
|
-
x = self.FindElement item[0], item[1] if item.is_a? Array
|
133
|
-
return x if x != nil
|
134
|
-
}
|
135
|
-
return y if y != nil
|
136
|
-
rescue
|
137
|
-
end
|
138
|
-
end if hash.is_a? Array
|
139
|
-
|
140
|
-
x = self.FindElement hash.keys.first, hash.fetch(hash.keys.first) if hash.is_a? Hash
|
141
|
-
return x if x != nil
|
142
|
-
}
|
143
|
-
return element if element != nil
|
144
|
-
raise "Could not find control for symbol: " + @hash.to_s
|
145
|
-
end
|
146
|
-
|
147
|
-
def FindAllItems(hash)
|
148
|
-
masterWait = Selenium::WebDriver::Wait.new(:timeout => 30)
|
149
|
-
|
150
|
-
element = masterWait.until {
|
151
|
-
hash.each do |item|
|
152
|
-
wait = Selenium::WebDriver::Wait.new(:timeout => 1)
|
153
|
-
begin
|
154
|
-
y = wait.until {
|
155
|
-
x = self.FindElements item.keys.first, item.fetch(item.keys.first) if item.is_a? Hash
|
156
|
-
x = self.FindElements item[0], item[1] if item.is_a? Array
|
157
|
-
return x if x != nil
|
158
|
-
}
|
159
|
-
return y if y != nil
|
160
|
-
rescue
|
161
|
-
end
|
162
|
-
end if hash.is_a? Array
|
163
|
-
|
164
|
-
x = self.FindElements hash.keys.first, hash.fetch(hash.keys.first) if hash.is_a? Hash
|
165
|
-
return x if x != nil
|
166
|
-
}
|
167
|
-
return element if element != nil
|
168
|
-
raise "Could not find control for symbol: " + @hash.to_s
|
169
|
-
end
|
170
|
-
|
171
|
-
def FindElement(discriminator, selector)
|
172
|
-
self.browser.find_element discriminator, selector
|
173
|
-
end
|
174
|
-
|
175
|
-
def FindElements(discriminator, selector)
|
176
|
-
self.browser.find_elements discriminator, selector
|
177
|
-
end
|
178
|
-
|
179
|
-
def ExecuteScript(script)
|
180
|
-
self.browser.execute_script(script)
|
181
|
-
end
|
182
|
-
|
183
|
-
def Create(type)
|
184
|
-
Selenium::WebDriver.for type
|
185
|
-
end
|
186
|
-
end
|
187
|
-
end
|
188
|
-
end
|
189
|
-
|
190
|
-
|
1
|
+
module Sapphire
|
2
|
+
module WebAbstractions
|
3
|
+
module RubySeleniumWebDriver
|
4
|
+
|
5
|
+
attr_reader :rootUrl
|
6
|
+
|
7
|
+
def Init(url)
|
8
|
+
@rootUrl = url
|
9
|
+
end
|
10
|
+
|
11
|
+
def Close
|
12
|
+
self.browser.close
|
13
|
+
end
|
14
|
+
|
15
|
+
def Switch
|
16
|
+
self.browser.switch_to.window(self.browser.window_handles[0])
|
17
|
+
end
|
18
|
+
|
19
|
+
def Type(keys)
|
20
|
+
self.browser.action.send_keys(keys).perform()
|
21
|
+
end
|
22
|
+
|
23
|
+
def AcceptAlert
|
24
|
+
alert = self.browser.switch_to.alert
|
25
|
+
alert.accept()
|
26
|
+
self.browser.switch_to.window(self.browser.window_handles[0])
|
27
|
+
end
|
28
|
+
|
29
|
+
def SetAlert(text)
|
30
|
+
alert = self.browser.switch_to.alert
|
31
|
+
alert.send_keys(text)
|
32
|
+
alert.accept()
|
33
|
+
self.browser.switch_to.window(self.browser.window_handles[0])
|
34
|
+
end
|
35
|
+
|
36
|
+
def ClosePopup
|
37
|
+
self.browser.switch_to.window(self.browser.window_handles.last)
|
38
|
+
self.browser.close
|
39
|
+
self.browser.switch_to.window(self.browser.window_handles[0])
|
40
|
+
end
|
41
|
+
|
42
|
+
def SwitchToPopup
|
43
|
+
self.browser.switch_to.window(self.browser.window_handles.last)
|
44
|
+
end
|
45
|
+
|
46
|
+
def SetRootUrl(url)
|
47
|
+
if(url.instance_of?(String))
|
48
|
+
self.Init(url)
|
49
|
+
else
|
50
|
+
x = url.new().Url
|
51
|
+
self.Init(x)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def NavigateTo(page)
|
56
|
+
if(page.is_a? Class)
|
57
|
+
nav = page.new
|
58
|
+
else
|
59
|
+
nav = page
|
60
|
+
end
|
61
|
+
|
62
|
+
self.browser.get "https://" + nav.Url
|
63
|
+
nav.Init
|
64
|
+
nav
|
65
|
+
end
|
66
|
+
|
67
|
+
def CurrentUrl
|
68
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 30)
|
69
|
+
url = wait.until { x = self.browser.current_url
|
70
|
+
x unless x == nil
|
71
|
+
}
|
72
|
+
|
73
|
+
url
|
74
|
+
end
|
75
|
+
|
76
|
+
def Reload
|
77
|
+
self.browser.get self.CurrentUrl
|
78
|
+
end
|
79
|
+
|
80
|
+
def ShouldNavigateTo(page)
|
81
|
+
if(page.is_a? Class)
|
82
|
+
nav = page.new
|
83
|
+
else
|
84
|
+
nav = page
|
85
|
+
end
|
86
|
+
|
87
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 30)
|
88
|
+
found = wait.until {
|
89
|
+
x = self.CurrentUrl.upcase.start_with?("HTTP://" + nav.Url.upcase) || self.CurrentUrl.upcase.start_with?("HTTPS://" + nav.Url.upcase)
|
90
|
+
if(x == false)
|
91
|
+
nav.AlternateUrls.each do |url|
|
92
|
+
x = self.CurrentUrl.upcase.start_with?("HTTP://" + url.upcase) || self.CurrentUrl.upcase.start_with?("HTTPS://" + url.upcase)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
x
|
96
|
+
}
|
97
|
+
temp = Evaluation.new(found, true)
|
98
|
+
return temp, nav
|
99
|
+
end
|
100
|
+
|
101
|
+
def Run(background)
|
102
|
+
scenario = background.new
|
103
|
+
scenario.Run
|
104
|
+
end
|
105
|
+
|
106
|
+
def ShouldShow(page)
|
107
|
+
self.ShouldNavigateTo page
|
108
|
+
end
|
109
|
+
|
110
|
+
def ShouldTransitionTo(url)
|
111
|
+
if(url.instance_of?(String))
|
112
|
+
temp = Evaluation.new(self.CurrentUrl.upcase.start_with?("HTTP://" + url.upcase) || self.CurrentUrl.upcase.start_with?("HTTPS://" + url.upcase), true)
|
113
|
+
@rootUrl = url
|
114
|
+
else
|
115
|
+
x = url.new().Url
|
116
|
+
temp = Evaluation.new(self.CurrentUrl.upcase.start_with?("HTTP://" + x.upcase) || self.CurrentUrl.upcase.start_with?("HTTPS://" + x.upcase), true)
|
117
|
+
@rootUrl = x
|
118
|
+
end
|
119
|
+
|
120
|
+
return temp
|
121
|
+
end
|
122
|
+
|
123
|
+
def FindItem(hash)
|
124
|
+
masterWait = Selenium::WebDriver::Wait.new(:timeout => 30)
|
125
|
+
|
126
|
+
element = masterWait.until {
|
127
|
+
hash.each do |item|
|
128
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 1)
|
129
|
+
begin
|
130
|
+
y = wait.until {
|
131
|
+
x = self.FindElement item.keys.first, item.fetch(item.keys.first) if item.is_a? Hash
|
132
|
+
x = self.FindElement item[0], item[1] if item.is_a? Array
|
133
|
+
return x if x != nil
|
134
|
+
}
|
135
|
+
return y if y != nil
|
136
|
+
rescue
|
137
|
+
end
|
138
|
+
end if hash.is_a? Array
|
139
|
+
|
140
|
+
x = self.FindElement hash.keys.first, hash.fetch(hash.keys.first) if hash.is_a? Hash
|
141
|
+
return x if x != nil
|
142
|
+
}
|
143
|
+
return element if element != nil
|
144
|
+
raise "Could not find control for symbol: " + @hash.to_s
|
145
|
+
end
|
146
|
+
|
147
|
+
def FindAllItems(hash)
|
148
|
+
masterWait = Selenium::WebDriver::Wait.new(:timeout => 30)
|
149
|
+
|
150
|
+
element = masterWait.until {
|
151
|
+
hash.each do |item|
|
152
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 1)
|
153
|
+
begin
|
154
|
+
y = wait.until {
|
155
|
+
x = self.FindElements item.keys.first, item.fetch(item.keys.first) if item.is_a? Hash
|
156
|
+
x = self.FindElements item[0], item[1] if item.is_a? Array
|
157
|
+
return x if x != nil
|
158
|
+
}
|
159
|
+
return y if y != nil
|
160
|
+
rescue
|
161
|
+
end
|
162
|
+
end if hash.is_a? Array
|
163
|
+
|
164
|
+
x = self.FindElements hash.keys.first, hash.fetch(hash.keys.first) if hash.is_a? Hash
|
165
|
+
return x if x != nil
|
166
|
+
}
|
167
|
+
return element if element != nil
|
168
|
+
raise "Could not find control for symbol: " + @hash.to_s
|
169
|
+
end
|
170
|
+
|
171
|
+
def FindElement(discriminator, selector)
|
172
|
+
self.browser.find_element discriminator, selector
|
173
|
+
end
|
174
|
+
|
175
|
+
def FindElements(discriminator, selector)
|
176
|
+
self.browser.find_elements discriminator, selector
|
177
|
+
end
|
178
|
+
|
179
|
+
def ExecuteScript(script)
|
180
|
+
self.browser.execute_script(script)
|
181
|
+
end
|
182
|
+
|
183
|
+
def Create(type)
|
184
|
+
Selenium::WebDriver.for type
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
|
@@ -1,45 +1,34 @@
|
|
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(
|
20
|
-
|
21
|
-
field.keys.each do |field_key|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
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(item, page, &block)
|
20
|
+
page.fields.each do |field|
|
21
|
+
field.keys.each do |field_key|
|
22
|
+
if(field_key == item)
|
23
|
+
block.call(field[field_key], item)
|
24
|
+
return
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
raise "Cannot find controls matching: " + item + "for page " + @page.to_s
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class Class < Module
|
2
|
+
|
3
|
+
def Clear
|
4
|
+
x = self.new
|
5
|
+
x.Clear
|
6
|
+
end
|
7
|
+
|
8
|
+
def Exit(item)
|
9
|
+
x = item.new
|
10
|
+
x.Close
|
11
|
+
end
|
12
|
+
|
13
|
+
def Complete(item)
|
14
|
+
x = item.new
|
15
|
+
x.Complete
|
16
|
+
end
|
17
|
+
|
18
|
+
def Press(item)
|
19
|
+
x = item.new
|
20
|
+
x.Press
|
21
|
+
end
|
22
|
+
|
23
|
+
def Set(hash)
|
24
|
+
text = hash[hash.keys.first]
|
25
|
+
klass = hash.keys.first.new
|
26
|
+
klass.Set text
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
class Symbol
|
2
|
+
|
3
|
+
def With(options = {})
|
4
|
+
@page = options.fetch(:page) if options.has_key? :page
|
5
|
+
end
|
6
|
+
|
7
|
+
def Check
|
8
|
+
ExecuteAgainstControl(self, @page) do |control, arg|
|
9
|
+
control.Check true
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def Click
|
14
|
+
ExecuteAgainstControl(self, @page) do |control, arg|
|
15
|
+
control.Click
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def MouseOver
|
20
|
+
ExecuteAgainstControl(self, @page) do |control, arg|
|
21
|
+
control.MouseOver
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def Uncheck
|
26
|
+
ExecuteAgainstControl(self, @page) do |control, arg|
|
27
|
+
control.Check false
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def Set(hash)
|
32
|
+
ExecuteHashAgainstControl(hash, @page) do |control, arg|
|
33
|
+
control.Set arg
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -1,10 +1,10 @@
|
|
1
|
-
module Sapphire
|
2
|
-
module DSL
|
3
|
-
module Browser
|
4
|
-
def By(value, compare1, compare2)
|
5
|
-
return value, compare1, compare2
|
6
|
-
end
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
1
|
+
module Sapphire
|
2
|
+
module DSL
|
3
|
+
module Browser
|
4
|
+
def By(value, compare1, compare2)
|
5
|
+
return value, compare1, compare2
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
@@ -1,10 +1,10 @@
|
|
1
|
-
module Sapphire
|
2
|
-
module DSL
|
3
|
-
module Browser
|
4
|
-
def To(url)
|
5
|
-
url
|
6
|
-
end
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
1
|
+
module Sapphire
|
2
|
+
module DSL
|
3
|
+
module Browser
|
4
|
+
def To(url)
|
5
|
+
url
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
@@ -1,10 +1,10 @@
|
|
1
|
-
module Sapphire
|
2
|
-
module DSL
|
3
|
-
module Browser
|
4
|
-
def With(item)
|
5
|
-
item
|
6
|
-
end
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
1
|
+
module Sapphire
|
2
|
+
module DSL
|
3
|
+
module Browser
|
4
|
+
def With(item)
|
5
|
+
item
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
@@ -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,15 +1,15 @@
|
|
1
|
-
module Sapphire
|
2
|
-
module DSL
|
3
|
-
module Browser
|
4
|
-
class AlertBox
|
5
|
-
def Accept
|
6
|
-
$browser.AcceptAlert
|
7
|
-
end
|
8
|
-
|
9
|
-
def Set(text)
|
10
|
-
$browser.SetAlert(text)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
1
|
+
module Sapphire
|
2
|
+
module DSL
|
3
|
+
module Browser
|
4
|
+
class AlertBox
|
5
|
+
def Accept
|
6
|
+
$browser.AcceptAlert
|
7
|
+
end
|
8
|
+
|
9
|
+
def Set(text)
|
10
|
+
$browser.SetAlert(text)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
15
|
end
|