parfait 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/parfait/application.rb +5 -2
- data/lib/parfait/artifact.rb +117 -0
- data/lib/parfait/control.rb +27 -3
- data/lib/parfait/page.rb +13 -3
- data/lib/parfait/region.rb +12 -2
- data/lib/parfait.rb +2 -289
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42406d24ef33024391424ff2dbe5662cf0890351
|
4
|
+
data.tar.gz: edb42479dfe0f87dfd5239215fbb9090ffef65c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6fc62cca06729ab2c63b748092dbf6f4425bee63f05372fc80df8950b271e53ca034d9cce64be1602ebcaf8e0a1367bfa798e33f19556de598aea728901ef42
|
7
|
+
data.tar.gz: 3b027546091718d787475eca2b63ba772d55cdab4c4c8b1a8b02b13f0a3412000ffa6601ed7ea3020af7c3c325971520f66c6d6a62b0e2fee2e275a58e48b222
|
data/lib/parfait/application.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Parfait
|
2
2
|
|
3
|
-
class Application
|
3
|
+
class Application < ParfaitArtifact
|
4
4
|
|
5
5
|
# List of all defined applications
|
6
6
|
@@all = Hash.new
|
@@ -141,7 +141,10 @@ module Parfait
|
|
141
141
|
def page(requested_name)
|
142
142
|
page = @pages[requested_name]
|
143
143
|
if page
|
144
|
-
# Confirm that we are
|
144
|
+
# Confirm that we are in the requested application
|
145
|
+
if is_present_defined?
|
146
|
+
raise "Cannot navigate to page \"#{requested_name}\" because application presence check failed" unless present()
|
147
|
+
end
|
145
148
|
|
146
149
|
# Pass the browser through to any subsequently called methods
|
147
150
|
Thread.current[:parfait_region] = Thread.current[:parfait_browser]
|
@@ -0,0 +1,117 @@
|
|
1
|
+
module Parfait
|
2
|
+
|
3
|
+
class ParfaitArtifact
|
4
|
+
|
5
|
+
# Constructor for the ParfaitArtifact.
|
6
|
+
#
|
7
|
+
# *Options*
|
8
|
+
#
|
9
|
+
# This method does not take any parameters.
|
10
|
+
#
|
11
|
+
# No example provided because this method will not be called explicitly.
|
12
|
+
# It will strictly be inherited by the Application, Page, Region, and
|
13
|
+
# Control classes.
|
14
|
+
#
|
15
|
+
def initialize(opts = {})
|
16
|
+
@check_method = nil
|
17
|
+
@present_method = nil
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
# Define the presence check method for a given ParfaitArtifact
|
22
|
+
#
|
23
|
+
# *Options*
|
24
|
+
#
|
25
|
+
# +option+:: specifies something
|
26
|
+
#
|
27
|
+
# *Example*
|
28
|
+
#
|
29
|
+
# $$$ Need an example $$$
|
30
|
+
def add_check(&block)
|
31
|
+
@check_method = block
|
32
|
+
add_generic_present() unless @present_method
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
# Check if the ParfaitArtifact is present
|
37
|
+
#
|
38
|
+
# *Options*
|
39
|
+
#
|
40
|
+
# This method does not take any parameters.
|
41
|
+
#
|
42
|
+
# *Example*
|
43
|
+
#
|
44
|
+
# $$$ Need an example $$$
|
45
|
+
def check(opts = {})
|
46
|
+
@check_method.call(opts)
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
# Define the present directive for a given ParfaitArtifact
|
51
|
+
#
|
52
|
+
# *Options*
|
53
|
+
#
|
54
|
+
# +option+:: specifies something
|
55
|
+
#
|
56
|
+
# *Example*
|
57
|
+
#
|
58
|
+
# $$$ Need an example $$$
|
59
|
+
def add_present(&block)
|
60
|
+
@present_method = block
|
61
|
+
end
|
62
|
+
|
63
|
+
|
64
|
+
# Is the ParfaitArtifact present?
|
65
|
+
#
|
66
|
+
# *Options*
|
67
|
+
#
|
68
|
+
# This method does not take any parameters.
|
69
|
+
#
|
70
|
+
# *Example*
|
71
|
+
#
|
72
|
+
# $$$ Need an example $$$
|
73
|
+
def present(opts = {})
|
74
|
+
@present_method.call(opts)
|
75
|
+
end
|
76
|
+
|
77
|
+
|
78
|
+
# Method description
|
79
|
+
#
|
80
|
+
# Depends on check
|
81
|
+
#
|
82
|
+
# *Options*
|
83
|
+
#
|
84
|
+
# +option+:: specifies something
|
85
|
+
#
|
86
|
+
# *Example*
|
87
|
+
#
|
88
|
+
# $$$ Need an example $$$
|
89
|
+
def add_generic_present()
|
90
|
+
add_present { |opts|
|
91
|
+
check(opts)
|
92
|
+
}
|
93
|
+
end
|
94
|
+
|
95
|
+
|
96
|
+
# Is the present method defined for this Artifact?
|
97
|
+
#
|
98
|
+
# Depends on check
|
99
|
+
#
|
100
|
+
# *Options*
|
101
|
+
#
|
102
|
+
# This method takes no parameters
|
103
|
+
#
|
104
|
+
# *Example*
|
105
|
+
#
|
106
|
+
# $$$ Need an example $$$
|
107
|
+
def is_present_defined?()
|
108
|
+
if @present_method
|
109
|
+
return true
|
110
|
+
else
|
111
|
+
return false
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
data/lib/parfait/control.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Parfait
|
2
2
|
|
3
|
-
class Control
|
3
|
+
class Control < ParfaitArtifact
|
4
4
|
|
5
5
|
attr_reader :name,
|
6
6
|
:aliases
|
@@ -129,6 +129,22 @@ module Parfait
|
|
129
129
|
end
|
130
130
|
|
131
131
|
|
132
|
+
# Method description
|
133
|
+
#
|
134
|
+
# *Options*
|
135
|
+
#
|
136
|
+
# +option+:: specifies something
|
137
|
+
#
|
138
|
+
# *Example*
|
139
|
+
#
|
140
|
+
# $$$ Need an example $$$
|
141
|
+
def verify_control_presence(directive_name)
|
142
|
+
if is_present_defined?
|
143
|
+
raise "Cannot call \"#{directive_name}\" directive because presence check for control \"#{@name}\" failed" unless present()
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
|
132
148
|
# Method description
|
133
149
|
#
|
134
150
|
# *Options*
|
@@ -139,6 +155,7 @@ module Parfait
|
|
139
155
|
#
|
140
156
|
# $$$ Need an example $$$
|
141
157
|
def get(opts = {})
|
158
|
+
verify_control_presence("get")
|
142
159
|
return @get_method.call(opts)
|
143
160
|
end
|
144
161
|
|
@@ -153,6 +170,7 @@ module Parfait
|
|
153
170
|
#
|
154
171
|
# $$$ Need an example $$$
|
155
172
|
def set(value,opts = {})
|
173
|
+
verify_control_presence("set")
|
156
174
|
@set_method.call(value,opts)
|
157
175
|
end
|
158
176
|
|
@@ -167,6 +185,7 @@ module Parfait
|
|
167
185
|
#
|
168
186
|
# $$$ Need an example $$$
|
169
187
|
def retrieve(opts = {})
|
188
|
+
verify_control_presence("retrieve")
|
170
189
|
return @retrieve_method.call(opts)
|
171
190
|
end
|
172
191
|
|
@@ -181,6 +200,7 @@ module Parfait
|
|
181
200
|
#
|
182
201
|
# $$$ Need an example $$$
|
183
202
|
def update(value,opts = {})
|
203
|
+
verify_control_presence("update")
|
184
204
|
@update_method.call(value,opts)
|
185
205
|
end
|
186
206
|
|
@@ -195,6 +215,7 @@ module Parfait
|
|
195
215
|
#
|
196
216
|
# $$$ Need an example $$$
|
197
217
|
def confirm(value,opts = {})
|
218
|
+
verify_control_presence("confirm")
|
198
219
|
return @confirm_method.call(value,opts)
|
199
220
|
end
|
200
221
|
|
@@ -209,6 +230,7 @@ module Parfait
|
|
209
230
|
#
|
210
231
|
# $$$ Need an example $$$
|
211
232
|
def verify(value,opts = {})
|
233
|
+
verify_control_presence("verify")
|
212
234
|
@verify_method.call(value,opts)
|
213
235
|
end
|
214
236
|
|
@@ -223,6 +245,7 @@ module Parfait
|
|
223
245
|
#
|
224
246
|
# $$$ Need an example $$$
|
225
247
|
def goto(opts = {})
|
248
|
+
verify_control_presence("goto")
|
226
249
|
return @goto_method.call(opts)
|
227
250
|
end
|
228
251
|
|
@@ -237,6 +260,7 @@ module Parfait
|
|
237
260
|
#
|
238
261
|
# $$$ Need an example $$$
|
239
262
|
def navigate(opts = {})
|
263
|
+
verify_control_presence("navigate")
|
240
264
|
return @navigate_method.call(opts)
|
241
265
|
end
|
242
266
|
|
@@ -402,8 +426,8 @@ module Parfait
|
|
402
426
|
#
|
403
427
|
# $$$ Need an example $$$
|
404
428
|
def add_generic_retrieve()
|
405
|
-
add_retrieve {
|
406
|
-
get()
|
429
|
+
add_retrieve { |opts|
|
430
|
+
get(opts)
|
407
431
|
}
|
408
432
|
end
|
409
433
|
|
data/lib/parfait/page.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Parfait
|
2
2
|
|
3
|
-
class Page
|
3
|
+
class Page < ParfaitArtifact
|
4
4
|
|
5
5
|
attr_reader :name,
|
6
6
|
:aliases
|
@@ -130,12 +130,18 @@ module Parfait
|
|
130
130
|
def region(opts = {})
|
131
131
|
region = @regions[opts.first[0]]
|
132
132
|
if region
|
133
|
+
|
134
|
+
# Confirm that we are on the expected page
|
135
|
+
if is_present_defined?
|
136
|
+
raise "Cannot navigate to region \"#{opts.first[0]}\" because page presence check failed" unless present()
|
137
|
+
end
|
138
|
+
|
133
139
|
# Apply the filter method
|
134
140
|
region.filter(opts.first[1])
|
135
141
|
|
136
142
|
return region
|
137
143
|
else
|
138
|
-
raise "Invalid region name requested: \"#{
|
144
|
+
raise "Invalid region name requested: \"#{opts.first[0]}\""
|
139
145
|
end
|
140
146
|
end
|
141
147
|
|
@@ -250,7 +256,11 @@ module Parfait
|
|
250
256
|
def control(requested_name)
|
251
257
|
control = @controls[requested_name]
|
252
258
|
if control
|
253
|
-
|
259
|
+
|
260
|
+
# Confirm that we are on the expected page
|
261
|
+
if is_present_defined?
|
262
|
+
raise "Cannot navigate to control \"#{requested_name}\" because page presence check failed" unless present()
|
263
|
+
end
|
254
264
|
|
255
265
|
return control
|
256
266
|
else
|
data/lib/parfait/region.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Parfait
|
2
2
|
|
3
|
-
class Region
|
3
|
+
class Region < ParfaitArtifact
|
4
4
|
|
5
5
|
attr_reader :name,
|
6
6
|
:aliases
|
@@ -249,6 +249,12 @@ module Parfait
|
|
249
249
|
def region(opts = {})
|
250
250
|
region = @regions[opts.first[0]]
|
251
251
|
if region
|
252
|
+
|
253
|
+
# Confirm that we are in the expected region
|
254
|
+
if is_present_defined?
|
255
|
+
raise "Cannot navigate to region \"#{opts.first[0]}\" because region presence check failed" unless present()
|
256
|
+
end
|
257
|
+
|
252
258
|
# Apply the filter method
|
253
259
|
region.filter(opts.first[1])
|
254
260
|
|
@@ -312,7 +318,11 @@ module Parfait
|
|
312
318
|
def control(requested_name)
|
313
319
|
control = @controls[requested_name]
|
314
320
|
if control
|
315
|
-
# Confirm that
|
321
|
+
# Confirm that we are in the expected region
|
322
|
+
if is_present_defined?
|
323
|
+
raise "Cannot navigate to control \"#{requested_name}\" because region presence check failed" unless present()
|
324
|
+
end
|
325
|
+
|
316
326
|
|
317
327
|
return control
|
318
328
|
else
|
data/lib/parfait.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'watir-webdriver'
|
2
|
+
require 'parfait/artifact'
|
2
3
|
require 'parfait/application'
|
3
4
|
require 'parfait/page'
|
4
5
|
require 'parfait/region'
|
@@ -16,7 +17,7 @@ module Parfait
|
|
16
17
|
PAGES = Hash.new
|
17
18
|
|
18
19
|
|
19
|
-
# Configure the logging routine to be used by Parfait
|
20
|
+
# Configure the logging routine to be used by Parfait for this thread.
|
20
21
|
#
|
21
22
|
# The routine you store here can be invoked by Parfait.log
|
22
23
|
#
|
@@ -51,294 +52,6 @@ module Parfait
|
|
51
52
|
end
|
52
53
|
|
53
54
|
|
54
|
-
# Define a new page to Parfait
|
55
|
-
#
|
56
|
-
# *Options*
|
57
|
-
#
|
58
|
-
# +name+:: specifies the name of the page
|
59
|
-
# +aliases+:: is an array of aliases for the page
|
60
|
-
#
|
61
|
-
# Note that the type of these values does not matter as long as they are used consistently throughout. All examples provided with Parfait use strings.
|
62
|
-
#
|
63
|
-
# *Example*
|
64
|
-
#
|
65
|
-
# edit_user = Parfait.add_page(
|
66
|
-
# :name => "Edit User",
|
67
|
-
# :alias => "New User", "User New", "User Edit"
|
68
|
-
# )
|
69
|
-
def Parfait.add_page(opts = {})
|
70
|
-
o = {
|
71
|
-
:name => :notspecified,
|
72
|
-
:aliases => :notspecified
|
73
|
-
}.merge(opts)
|
74
|
-
name = o[:name]
|
75
|
-
aliases = o[:aliases]
|
76
|
-
|
77
|
-
new_page = Parfait::Page.new(name)
|
78
|
-
|
79
|
-
Parfait::PAGES[name] = new_page
|
80
|
-
unless aliases == :notspecified
|
81
|
-
aliases.each { |an_alias|
|
82
|
-
Parfait::PAGES[an_alias] = new_page
|
83
|
-
}
|
84
|
-
end
|
85
|
-
|
86
|
-
return new_page
|
87
|
-
end
|
88
|
-
|
89
|
-
|
90
|
-
# Retrieve a page object by name or alias
|
91
|
-
#
|
92
|
-
# Intended for internal use only
|
93
|
-
#
|
94
|
-
# *Options*
|
95
|
-
#
|
96
|
-
# +name+:: specifies the name or alias of the page
|
97
|
-
#
|
98
|
-
# *Example*
|
99
|
-
#
|
100
|
-
# Parfait.get_page("User New")
|
101
|
-
def Parfait.get_page(name)
|
102
|
-
page_name = Parfait::PAGES[name]
|
103
|
-
if page_name
|
104
|
-
return page_name
|
105
|
-
else
|
106
|
-
raise "Parfait::get_page called for invalid page name \"#{page_name}\""
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
|
111
|
-
# Set the value for a specified control on a specified page
|
112
|
-
#
|
113
|
-
# Parfait.set is only intended to be invoked from page directive routines, like retrieve, update, confirm, and verify. It does not invoke the logger.
|
114
|
-
#
|
115
|
-
# *Options*
|
116
|
-
#
|
117
|
-
# Parfait.set takes a hash as a parameter with the +:onpage+ key specifying the page to be manipulated. Users can utilize additional keys as they wish. A simple invocation of Parfait.set might contain an additional key matching the label of a control on that page and providing a value to set in that control.
|
118
|
-
#
|
119
|
-
# *Example*
|
120
|
-
#
|
121
|
-
# Parfait.set(:onpage => "Login", :username => "enrico_palazzo")
|
122
|
-
def Parfait.set(opts = {})
|
123
|
-
o = {
|
124
|
-
:onpage => :nopage
|
125
|
-
}.merge(opts)
|
126
|
-
|
127
|
-
if o[:onpage] == :nopage
|
128
|
-
raise "Parfait::set must be called with \":onpage\" specified."
|
129
|
-
end
|
130
|
-
|
131
|
-
# Find the specified control and invoke its set method
|
132
|
-
action_taken = false
|
133
|
-
page = Parfait::get_page(o[:onpage])
|
134
|
-
opts.each { |label,value|
|
135
|
-
control = page.get_control(label)
|
136
|
-
unless control == nil
|
137
|
-
control.set(opts)
|
138
|
-
action_taken = true
|
139
|
-
end
|
140
|
-
}
|
141
|
-
unless action_taken
|
142
|
-
raise "No valid control was passed to Parfait::set"
|
143
|
-
end
|
144
|
-
end
|
145
|
-
|
146
|
-
|
147
|
-
# Retreive the value from a specified control on a specified page and return it
|
148
|
-
#
|
149
|
-
# *Options*
|
150
|
-
#
|
151
|
-
# The Parfait.retrieve directive takes a hash as a parameter with an +:onpage+ key specifying the current page. The system-generated Parfait.retrieve directive will also take a +:data+ key specfying the control on that page from which data should be retrieved. Users can override the system-generated directive and use any keys they wish.
|
152
|
-
#
|
153
|
-
# The system-generated retrieve directive does not invoke the logger.
|
154
|
-
#
|
155
|
-
# *Example*
|
156
|
-
#
|
157
|
-
# my_ssn = Parfait.retrieve(:onpage => "User Data", :data => :ssn)
|
158
|
-
def Parfait.retrieve(opts = {})
|
159
|
-
o = {
|
160
|
-
:onpage => :nopage
|
161
|
-
}.merge(opts)
|
162
|
-
|
163
|
-
if o[:onpage] == :nopage
|
164
|
-
raise "Parfait::retrieve must be called with \":onpage\" specified."
|
165
|
-
end
|
166
|
-
|
167
|
-
# Find the specified control and invoke its retrieve method
|
168
|
-
action_taken = false
|
169
|
-
page = Parfait::get_page(o[:onpage])
|
170
|
-
opts.each { |label,value|
|
171
|
-
if label == :data
|
172
|
-
control = page.get_control(value)
|
173
|
-
unless control == nil
|
174
|
-
return control.retrieve(opts)
|
175
|
-
action_taken = true
|
176
|
-
end
|
177
|
-
end
|
178
|
-
}
|
179
|
-
unless action_taken
|
180
|
-
raise "No valid control was passed to Parfait::retrieve"
|
181
|
-
end
|
182
|
-
end
|
183
|
-
|
184
|
-
|
185
|
-
# Update the value of a specified control on a specified page.
|
186
|
-
#
|
187
|
-
# *Options*
|
188
|
-
#
|
189
|
-
# The Parfait.update directive takes a hash as a parameter with an +:onpage+ key specifying the current page. The system-generated Parfait.update directive will also take a key matching the label of a control on that page and providing a value to set in that control. Users can override the system-generated directive and use any keys they wish.
|
190
|
-
#
|
191
|
-
# The system-generated update directive will log both the original value and the newly updated value. It is assumed that users overriding the system-generated functionality will do the same.
|
192
|
-
#
|
193
|
-
# *Example*
|
194
|
-
#
|
195
|
-
# Parfait.update(:onpage => "Configure Settings", :time_zone => "Eastern Time (US & Canada)")
|
196
|
-
def Parfait.update(opts = {})
|
197
|
-
o = {
|
198
|
-
:onpage => :nopage
|
199
|
-
}.merge(opts)
|
200
|
-
|
201
|
-
if o[:onpage] == :nopage
|
202
|
-
raise "Parfait::update must be called with \":onpage\" specified."
|
203
|
-
end
|
204
|
-
|
205
|
-
# Find the specified control and invoke its update method
|
206
|
-
retval = nil
|
207
|
-
action_taken = false
|
208
|
-
page = Parfait::get_page(o[:onpage])
|
209
|
-
opts.each { |label,value|
|
210
|
-
control = page.get_control(label)
|
211
|
-
unless control == nil
|
212
|
-
retval = control.update(opts)
|
213
|
-
action_taken = true
|
214
|
-
end
|
215
|
-
}
|
216
|
-
unless action_taken
|
217
|
-
raise "No valid control was passed to Parfait::update"
|
218
|
-
end
|
219
|
-
retval
|
220
|
-
end
|
221
|
-
|
222
|
-
|
223
|
-
# Verify the value of a specified control on a specified page, returning +true+ if it matches the provided value and raising an exception if it does not.
|
224
|
-
#
|
225
|
-
# *Options*
|
226
|
-
#
|
227
|
-
# The Parfait.verify directive takes a hash as a parameter with an +:onpage+ key specifying the current page. The system-generated Parfait.verify directive will also take a key matching the label of a control on that page and providing a value against which to verify the current value of that control. Users can override the system-generated directive and use any keys they wish.
|
228
|
-
#
|
229
|
-
# The system-generated verify directive will log the successfully verified value. It is assumed that users overriding the system-generated functionality will do the same.
|
230
|
-
#
|
231
|
-
# *Example*
|
232
|
-
#
|
233
|
-
# Parfait.verify(:onpage => "Edit User", :social_security_number => "123-45-6789")
|
234
|
-
def Parfait.verify(opts = {})
|
235
|
-
o = {
|
236
|
-
:onpage => :nopage
|
237
|
-
}.merge(opts)
|
238
|
-
|
239
|
-
if o[:onpage] == :nopage
|
240
|
-
raise "Parfait::verify must be called with \":onpage\" specified."
|
241
|
-
end
|
242
|
-
|
243
|
-
page = Parfait::get_page(o[:onpage])
|
244
|
-
|
245
|
-
if opts.size == 1 #If no other parameters were passed, run the page test
|
246
|
-
if page.page_test()
|
247
|
-
Parfait.log("Verified that browser is on page \"#{page.name}\"",:style => :h2)
|
248
|
-
else
|
249
|
-
raise "Parfait expected browser to be on page #{page.name}, but it wasn\'t"
|
250
|
-
end
|
251
|
-
else
|
252
|
-
# Find the specified control and invoke its verify method
|
253
|
-
action_taken = false
|
254
|
-
opts.each { |label,value|
|
255
|
-
control = page.get_control(label)
|
256
|
-
unless control == nil
|
257
|
-
control.verify(opts)
|
258
|
-
action_taken = true
|
259
|
-
end
|
260
|
-
}
|
261
|
-
unless action_taken
|
262
|
-
raise "No valid control was passed to Parfait::verify"
|
263
|
-
end
|
264
|
-
end
|
265
|
-
true
|
266
|
-
end
|
267
|
-
|
268
|
-
|
269
|
-
# Confirm the value of a specified control on a specified page, returning +true+ if it matches the provided value and returning +false+ otherwise.
|
270
|
-
#
|
271
|
-
# *Options*
|
272
|
-
#
|
273
|
-
# The Parfait.confirm directive takes a hash as a parameter with an +:onpage+ key specifying the current page. The system-generated Parfait.confirm directive will also take a key matching the label of a control on that page and providing a value against which to test the current value of that control. Users can override the system-generated directive and use any keys they wish.
|
274
|
-
#
|
275
|
-
# The system-generated confirm directive does not invoke the logger.
|
276
|
-
#
|
277
|
-
# *Example*
|
278
|
-
#
|
279
|
-
# Parfait.confirm(:onpage => "Edit User", :gender => "female")
|
280
|
-
def Parfait.confirm(opts = {})
|
281
|
-
o = {
|
282
|
-
:onpage => :nopage
|
283
|
-
}.merge(opts)
|
284
|
-
|
285
|
-
if o[:onpage] == :nopage
|
286
|
-
raise "Parfait::confirm must be called with \":onpage\" specified."
|
287
|
-
end
|
288
|
-
|
289
|
-
page = Parfait::get_page(o[:onpage])
|
290
|
-
|
291
|
-
retval = false
|
292
|
-
if opts.size == 1 #If no other parameters were passed, run the page test
|
293
|
-
return page.page_test()
|
294
|
-
else
|
295
|
-
# Find the specified control and invoke its confirm method
|
296
|
-
action_taken = false
|
297
|
-
opts.each { |label,value|
|
298
|
-
control = page.get_control(label)
|
299
|
-
unless control == nil
|
300
|
-
retval = control.confirm(opts)
|
301
|
-
action_taken = true
|
302
|
-
end
|
303
|
-
}
|
304
|
-
if action_taken
|
305
|
-
return retval
|
306
|
-
else
|
307
|
-
raise "No valid control was passed to Parfait::confirm"
|
308
|
-
end
|
309
|
-
end
|
310
|
-
end
|
311
|
-
|
312
|
-
|
313
|
-
# Method description
|
314
|
-
#
|
315
|
-
# *Options*
|
316
|
-
#
|
317
|
-
# +option+:: specifies something
|
318
|
-
#
|
319
|
-
# *Example*
|
320
|
-
#
|
321
|
-
# $$$ Need an example $$$
|
322
|
-
def Parfait.navigate(opts = {})
|
323
|
-
o = {
|
324
|
-
:onpage => :nopage,
|
325
|
-
:to => :nodestination
|
326
|
-
}.merge(opts)
|
327
|
-
|
328
|
-
if o[:to] == :nodestination
|
329
|
-
raise "Parfait::navigate must be called with a destination (\":to\") specified."
|
330
|
-
end
|
331
|
-
|
332
|
-
if o[:onpage] == :nopage
|
333
|
-
#Only a target was specified
|
334
|
-
page = Parfait::get_page("All Pages")
|
335
|
-
else
|
336
|
-
page = Parfait::get_page(o[:onpage])
|
337
|
-
end
|
338
|
-
page.navigate(opts)
|
339
|
-
end
|
340
|
-
|
341
|
-
|
342
55
|
# Set the browser object (for the current thread) for Parfait to use
|
343
56
|
#
|
344
57
|
# *Options*
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parfait
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Rotter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -33,6 +33,7 @@ extra_rdoc_files: []
|
|
33
33
|
files:
|
34
34
|
- lib/parfait.rb
|
35
35
|
- lib/parfait/application.rb
|
36
|
+
- lib/parfait/artifact.rb
|
36
37
|
- lib/parfait/control.rb
|
37
38
|
- lib/parfait/page.rb
|
38
39
|
- lib/parfait/region.rb
|