sakai-cle-test-api 0.0.75 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sakai-cle-test-api.rb +4 -5
- data/lib/sakai-cle-test-api/base_page.rb +20 -0
- data/lib/sakai-cle-test-api/core-ext.rb +90 -0
- data/lib/sakai-cle-test-api/data_objects/announcement.rb +81 -0
- data/lib/sakai-cle-test-api/data_objects/assessment.rb +32 -0
- data/lib/sakai-cle-test-api/data_objects/assignment.rb +90 -0
- data/lib/sakai-cle-test-api/data_objects/event.rb +89 -0
- data/lib/sakai-cle-test-api/data_objects/lesson.rb +185 -0
- data/lib/sakai-cle-test-api/data_objects/resource.rb +209 -0
- data/lib/sakai-cle-test-api/data_objects/site.rb +208 -0
- data/lib/sakai-cle-test-api/data_objects/syllabus.rb +39 -0
- data/lib/sakai-cle-test-api/data_objects/web_content_tool.rb +51 -0
- data/lib/sakai-cle-test-api/data_objects/wiki.rb +53 -0
- data/lib/sakai-cle-test-api/gem_ext.rb +23 -0
- data/lib/sakai-cle-test-api/page_helper.rb +22 -0
- data/lib/sakai-cle-test-api/page_maker.rb +48 -0
- data/lib/sakai-cle-test-api/page_objects/account.rb +111 -0
- data/lib/sakai-cle-test-api/page_objects/aliases.rb +43 -0
- data/lib/sakai-cle-test-api/page_objects/announcements.rb +190 -0
- data/lib/sakai-cle-test-api/page_objects/assessments.rb +874 -0
- data/lib/sakai-cle-test-api/page_objects/assignments.rb +771 -0
- data/lib/sakai-cle-test-api/page_objects/basic_lti.rb +6 -0
- data/lib/sakai-cle-test-api/page_objects/blogger.rb +205 -0
- data/lib/sakai-cle-test-api/page_objects/blogs.rb +60 -0
- data/lib/sakai-cle-test-api/page_objects/calendar.rb +431 -0
- data/lib/sakai-cle-test-api/page_objects/calendar_summary.rb +1 -0
- data/lib/sakai-cle-test-api/page_objects/chat_room.rb +12 -0
- data/lib/sakai-cle-test-api/page_objects/drop_box.rb +9 -0
- data/lib/sakai-cle-test-api/page_objects/email_archive.rb +22 -0
- data/lib/sakai-cle-test-api/page_objects/evaluations.rb +158 -0
- data/lib/sakai-cle-test-api/page_objects/feedback.rb +36 -0
- data/lib/sakai-cle-test-api/page_objects/forms.rb +120 -0
- data/lib/sakai-cle-test-api/page_objects/forums.rb +289 -0
- data/lib/sakai-cle-test-api/page_objects/glossary.rb +117 -0
- data/lib/sakai-cle-test-api/page_objects/gradebook.rb +29 -0
- data/lib/sakai-cle-test-api/page_objects/gradebook2.rb +17 -0
- data/lib/sakai-cle-test-api/page_objects/home.rb +36 -0
- data/lib/sakai-cle-test-api/page_objects/jforums.rb +444 -0
- data/lib/sakai-cle-test-api/page_objects/job_scheduler.rb +121 -0
- data/lib/sakai-cle-test-api/page_objects/lessons.rb +360 -0
- data/lib/sakai-cle-test-api/page_objects/login.rb +28 -0
- data/lib/sakai-cle-test-api/page_objects/matrix.rb +241 -0
- data/lib/sakai-cle-test-api/page_objects/media_gallery.rb +13 -0
- data/lib/sakai-cle-test-api/page_objects/messages.rb +622 -0
- data/lib/sakai-cle-test-api/page_objects/my_workspace.rb +44 -0
- data/lib/sakai-cle-test-api/page_objects/news.rb +8 -0
- data/lib/sakai-cle-test-api/page_objects/podcasts.rb +27 -0
- data/lib/sakai-cle-test-api/page_objects/polls.rb +69 -0
- data/lib/sakai-cle-test-api/page_objects/portfolio_templates.rb +161 -0
- data/lib/sakai-cle-test-api/page_objects/portfolios.rb +162 -0
- data/lib/sakai-cle-test-api/page_objects/post_em.rb +1 -0
- data/lib/sakai-cle-test-api/page_objects/profile.rb +51 -0
- data/lib/sakai-cle-test-api/page_objects/profile2.rb +344 -0
- data/lib/sakai-cle-test-api/page_objects/public_search.rb +61 -0
- data/lib/sakai-cle-test-api/page_objects/realms.rb +19 -0
- data/lib/sakai-cle-test-api/page_objects/resources.rb +326 -0
- data/lib/sakai-cle-test-api/{resources_roster.rb → page_objects/resources_roster.rb} +0 -0
- data/lib/sakai-cle-test-api/page_objects/rosters.rb +70 -0
- data/lib/sakai-cle-test-api/page_objects/rwiki.rb +34 -0
- data/lib/sakai-cle-test-api/page_objects/search.rb +34 -0
- data/lib/sakai-cle-test-api/page_objects/sections.rb +295 -0
- data/lib/sakai-cle-test-api/page_objects/single_user.rb +1 -0
- data/lib/sakai-cle-test-api/page_objects/site_setup.rb +686 -0
- data/lib/sakai-cle-test-api/page_objects/site_statistics.rb +1 -0
- data/lib/sakai-cle-test-api/page_objects/sites.rb +255 -0
- data/lib/sakai-cle-test-api/page_objects/styles.rb +74 -0
- data/lib/sakai-cle-test-api/page_objects/syllabus.rb +166 -0
- data/lib/sakai-cle-test-api/page_objects/user_membership.rb +57 -0
- data/lib/sakai-cle-test-api/page_objects/users.rb +88 -0
- data/lib/sakai-cle-test-api/rich_text.rb +27 -0
- data/lib/sakai-cle-test-api/utilities.rb +260 -0
- data/lib/sakai-cle-test-api/workflows.rb +224 -0
- data/sakai-cle-test-api.gemspec +3 -5
- metadata +74 -64
- data/lib/sakai-cle-test-api/admin_page_elements.rb +0 -1030
- data/lib/sakai-cle-test-api/announcements.rb +0 -59
- data/lib/sakai-cle-test-api/assessments.rb +0 -194
- data/lib/sakai-cle-test-api/assignments.rb +0 -113
- data/lib/sakai-cle-test-api/basic_lti.rb +0 -5
- data/lib/sakai-cle-test-api/blogs.rb +0 -5
- data/lib/sakai-cle-test-api/calendar.rb +0 -65
- data/lib/sakai-cle-test-api/calendar_summary.rb +0 -0
- data/lib/sakai-cle-test-api/common_page_elements.rb +0 -1228
- data/lib/sakai-cle-test-api/drop_box.rb +0 -0
- data/lib/sakai-cle-test-api/email_archive.rb +0 -10
- data/lib/sakai-cle-test-api/forums.rb +0 -39
- data/lib/sakai-cle-test-api/gradebook.rb +0 -10
- data/lib/sakai-cle-test-api/gradebook2.rb +0 -6
- data/lib/sakai-cle-test-api/messages.rb +0 -119
- data/lib/sakai-cle-test-api/news.rb +0 -9
- data/lib/sakai-cle-test-api/polls.rb +0 -24
- data/lib/sakai-cle-test-api/post_em.rb +0 -0
- data/lib/sakai-cle-test-api/profile.rb +0 -17
- data/lib/sakai-cle-test-api/profile2.rb +0 -43
- data/lib/sakai-cle-test-api/rwiki.rb +0 -0
- data/lib/sakai-cle-test-api/sections.rb +0 -47
- data/lib/sakai-cle-test-api/single_user.rb +0 -0
- data/lib/sakai-cle-test-api/site_page_elements.rb +0 -2350
- data/lib/sakai-cle-test-api/site_statistics.rb +0 -0
- data/lib/sakai-cle-test-api/syllabus.rb +0 -77
- data/lib/sakai-cle-test-api/tools_menu.rb +0 -415
@@ -0,0 +1,19 @@
|
|
1
|
+
#================
|
2
|
+
# Realms Pages
|
3
|
+
#================
|
4
|
+
|
5
|
+
# Realms page
|
6
|
+
class Realms < BasePage
|
7
|
+
|
8
|
+
frame_element
|
9
|
+
|
10
|
+
action(:new_realm) { |b| b.frm.link(:text=>"New Realm").click }
|
11
|
+
action(:search) { |b| b.frm.link(:text=>"Search").click }
|
12
|
+
element(:select_page_size) { |b| b.frm.select_list(:name=>"selectPageSize") }
|
13
|
+
action(:next) { |b| b.frm.button(:name=>"eventSubmit_doList_next").click }
|
14
|
+
action(:last) { |b| b.frm.button(:name=>"eventSubmit_doList_last").click }
|
15
|
+
action(:previous) { |b| b.frm.button(:name=>"eventSubmit_doList_prev").click }
|
16
|
+
action(:first) { |b| b.frm.button(:name=>"eventSubmit_doList_first").click }
|
17
|
+
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,326 @@
|
|
1
|
+
#================
|
2
|
+
# Resources Pages
|
3
|
+
#================
|
4
|
+
|
5
|
+
# This class consolidates the code that can be shared among all the
|
6
|
+
# File Upload and Attachment pages.
|
7
|
+
#
|
8
|
+
# Not every method in this class will be appropriate for every attachment page.
|
9
|
+
class ResourcesBase < BasePage
|
10
|
+
|
11
|
+
frame_element
|
12
|
+
|
13
|
+
element(:files_table) { |b| b.frm.table(:class=>/listHier lines/) }
|
14
|
+
|
15
|
+
# Returns an array of the displayed folder names.
|
16
|
+
def folder_names
|
17
|
+
names = []
|
18
|
+
files_table.rows.each do |row|
|
19
|
+
next if row.td(:class=>"specialLink").exist? == false
|
20
|
+
next if row.td(:class=>"specialLink").link(:title=>"Folder").exist? == false
|
21
|
+
names << row.td(:class=>"specialLink").link(:title=>"Folder").text
|
22
|
+
end
|
23
|
+
names
|
24
|
+
end
|
25
|
+
|
26
|
+
# Returns an array of the file names currently listed
|
27
|
+
# on the page.
|
28
|
+
#
|
29
|
+
# It excludes folder names.
|
30
|
+
def file_names
|
31
|
+
names = []
|
32
|
+
files_table.rows.each do |row|
|
33
|
+
next if row.td(:class=>"specialLink").exist? == false
|
34
|
+
next if row.td(:class=>"specialLink").link(:title=>"Folder").exist?
|
35
|
+
names << row.td(:class=>"specialLink").link(:href=>/access.content/, :index=>1).text
|
36
|
+
end
|
37
|
+
names
|
38
|
+
end
|
39
|
+
|
40
|
+
# Use this as a means of checking if the file is visible or not
|
41
|
+
def item(name)
|
42
|
+
frm.link(:text=>name)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Clicks the Select button next to the specified file.
|
46
|
+
def select_file(filename)
|
47
|
+
files_table.row(:text, /#{Regexp.escape(filename)}/).link(:text=>"Select").click
|
48
|
+
end
|
49
|
+
|
50
|
+
# Clicks the Remove button.
|
51
|
+
action(:remove) { |b| b.frm.button(:value=>"Remove").click }
|
52
|
+
|
53
|
+
# Clicks the remove link for the specified item in the attachment list.
|
54
|
+
def remove_item(file_name)
|
55
|
+
files_table.row(:text=>/#{Regexp.escape(file_name)}/).link(:href=>/doRemoveitem/).click
|
56
|
+
end
|
57
|
+
|
58
|
+
# Clicks the Move button.
|
59
|
+
action(:move) { |b| b.frm.button(:value=>"Move").click }
|
60
|
+
|
61
|
+
# Clicks the Show Other Sites link.
|
62
|
+
action(:show_other_sites) { |b| b.frm.link(:text=>"Show other sites").click }
|
63
|
+
|
64
|
+
def href(item)
|
65
|
+
frm.link(:text=>item).href
|
66
|
+
end
|
67
|
+
|
68
|
+
# Clicks on the specified folder image, which
|
69
|
+
# will open the folder tree and remain on the page.
|
70
|
+
def open_folder(foldername)
|
71
|
+
files_table.row(:text=>/#{Regexp.escape(foldername)}/).link(:title=>"Open this folder").click
|
72
|
+
end
|
73
|
+
|
74
|
+
# Clicks on the specified folder name, which should open
|
75
|
+
# the folder contents on a refreshed page.
|
76
|
+
def go_to_folder(foldername)
|
77
|
+
frm.link(:text=>foldername).click
|
78
|
+
end
|
79
|
+
|
80
|
+
# Sets the URL field to the specified value.
|
81
|
+
def url=(url_string)
|
82
|
+
frm.text_field(:id=>"url").set(url_string)
|
83
|
+
end
|
84
|
+
|
85
|
+
# Clicks the Add button next to the URL field.
|
86
|
+
action(:add) { |b| b.frm.button(:value=>"Add").click }
|
87
|
+
|
88
|
+
# Gets the value of the access level cell for the specified
|
89
|
+
# file.
|
90
|
+
def access_level(filename)
|
91
|
+
files_table.row(:text=>/#{Regexp.escape(filename)}/)[6].text
|
92
|
+
end
|
93
|
+
|
94
|
+
def edit_details(name)
|
95
|
+
open_actions_menu(name)
|
96
|
+
files_table.row(:text=>/#{Regexp.escape(name)}/).link(:text=>"Edit Details").click
|
97
|
+
end
|
98
|
+
|
99
|
+
def edit_content(html_page_name)
|
100
|
+
open_actions_menu(html_page_name)
|
101
|
+
files_table.row(:text=>/#{Regexp.escape(html_page_name)}/).link(:text=>"Edit Content").click
|
102
|
+
end
|
103
|
+
|
104
|
+
# Clicks the Create Folders menu item in the
|
105
|
+
# Add menu of the specified folder.
|
106
|
+
def create_subfolders_in(folder_name)
|
107
|
+
open_add_menu(folder_name)
|
108
|
+
files_table.row(:text=>/#{Regexp.escape(folder_name)}/).link(:text=>"Create Folders").click
|
109
|
+
end
|
110
|
+
|
111
|
+
def create_html_page_in(folder_name)
|
112
|
+
open_add_menu(folder_name)
|
113
|
+
files_table.row(:text=>/#{Regexp.escape(folder_name)}/).link(:text=>"Create HTML Page").click
|
114
|
+
end
|
115
|
+
|
116
|
+
element(:upload_file_field) { |b| b.frm.file_field(:id=>"upload") }
|
117
|
+
|
118
|
+
# Enters the specified file into the file field name (assuming it's in the
|
119
|
+
# data/sakai-cle-test-api folder or a subfolder therein)
|
120
|
+
#
|
121
|
+
def upload_file(filename, filepath="")
|
122
|
+
upload_file_field.set(filepath + filename)
|
123
|
+
if frm.div(:class=>"alertMessage").exist?
|
124
|
+
sleep 2
|
125
|
+
upload_file(filename)
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
# Enters the specified file into the file field name (assuming it's in the
|
130
|
+
# data/sakai-cle-test-api folder or a subfolder therein)
|
131
|
+
#
|
132
|
+
# Use this method ONLY for instances where there's a file field on the page
|
133
|
+
# with an "upload" id.
|
134
|
+
def upload_local_file(filename, filepath="")
|
135
|
+
upload_file_field.set(filepath + filename)
|
136
|
+
if frm.div(:class=>"alertMessage").exist?
|
137
|
+
sleep 2
|
138
|
+
upload_local_file(filename)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
# Clicks the Add Menu for the specified
|
143
|
+
# folder, then selects the Upload Files
|
144
|
+
# command in the menu that appears.
|
145
|
+
def upload_files_to_folder(folder_name)
|
146
|
+
if frm.li(:text=>/A/, :class=>"menuOpen").exist?
|
147
|
+
files_table.row(:text=>/#{Regexp.escape(folder_name)}/).li(:text=>/A/, :class=>"menuOpen").fire_event("onclick")
|
148
|
+
else
|
149
|
+
files_table.row(:text=>/#{Regexp.escape(folder_name)}/).link(:text=>"Start Add Menu").fire_event("onfocus")
|
150
|
+
end
|
151
|
+
files_table.row(:text=>/#{Regexp.escape(folder_name)}/).link(:text=>"Upload Files").click
|
152
|
+
end
|
153
|
+
alias upload_file_to_folder upload_files_to_folder
|
154
|
+
|
155
|
+
# Clicks the "Attach a copy" link for the specified
|
156
|
+
# file, then reinstantiates the Class.
|
157
|
+
# If an alert box appears, the method will call itself again.
|
158
|
+
# Note that this can lead to an infinite loop. Will need to fix later.
|
159
|
+
def attach_a_copy(file_name)
|
160
|
+
files_table.row(:text=>/#{Regexp.escape(file_name)}/).link(:href=>/doAttachitem/).click
|
161
|
+
if frm.div(:class=>"alertMessage").exist?
|
162
|
+
sleep 1
|
163
|
+
attach_a_copy(file_name) # TODO - This can loop infinitely
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
# Takes the specified array object containing pointers
|
168
|
+
# to local file resources, then uploads those files to
|
169
|
+
# the folder specified, checks if they all uploaded properly and
|
170
|
+
# if not, re-tries the ones that failed the first time.
|
171
|
+
#
|
172
|
+
# Finally, it re-instantiates the appropriate page class.
|
173
|
+
# Note that it expects all files to be located in the same folder (can be in subfolders of that folder).
|
174
|
+
def upload_multiple_files_to_folder(folder, file_array, file_path="")
|
175
|
+
|
176
|
+
upload = upload_files_to_folder folder
|
177
|
+
|
178
|
+
file_array.each do |file|
|
179
|
+
upload.file_to_upload(file, file_path)
|
180
|
+
upload.add_another_file
|
181
|
+
end
|
182
|
+
|
183
|
+
resources = upload.upload_files_now
|
184
|
+
|
185
|
+
file_array.each do |file|
|
186
|
+
file =~ /(?<=\/).+/
|
187
|
+
# puts $~.to_s # For debugging purposes
|
188
|
+
unless resources.file_names.include?($~.to_s)
|
189
|
+
upload_files = resources.upload_files_to_folder(folder)
|
190
|
+
upload_files.file_to_upload(file, file_path)
|
191
|
+
upload_files.upload_files_now
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
# Clicks the Continue button
|
197
|
+
def continue
|
198
|
+
frm.div(:class=>"highlightPanel").span(:id=>"submitnotifxxx").wait_while_present
|
199
|
+
frm.button(:value=>"Continue").click
|
200
|
+
end
|
201
|
+
|
202
|
+
def open_add_menu(folder_name)
|
203
|
+
files_table.row(:text=>/#{Regexp.escape(folder_name)}/).link(:text=>"Start Add Menu").fire_event("onfocus")
|
204
|
+
end
|
205
|
+
|
206
|
+
def open_actions_menu(name)
|
207
|
+
files_table.row(:text=>/#{Regexp.escape(name)}/).li(:text=>/Action/, :class=>"menuOpen").fire_event("onclick")
|
208
|
+
end
|
209
|
+
|
210
|
+
end
|
211
|
+
|
212
|
+
# Resources page for a given Site, in the Course Tools menu
|
213
|
+
class Resources < ResourcesBase
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
end
|
218
|
+
|
219
|
+
class ResourcesUploadFiles < ResourcesBase
|
220
|
+
|
221
|
+
@@filex=0 # TODO: This is almost certainly not going to work right.
|
222
|
+
|
223
|
+
# Enters the specified folder/filename value into
|
224
|
+
# the file field on the page.
|
225
|
+
# The method will throw an error if the specified file
|
226
|
+
# is not found.
|
227
|
+
#
|
228
|
+
# This method is designed to be able to use
|
229
|
+
# multiple times, but it assumes
|
230
|
+
# that the add_another_file method is used
|
231
|
+
# before it, every time except before the first time.
|
232
|
+
def file_to_upload(file_name, file_path="")
|
233
|
+
frm.file_field(:id, "content_#{@@filex}").set(file_path + file_name)
|
234
|
+
@@filex+=1
|
235
|
+
end
|
236
|
+
|
237
|
+
# Clicks the Upload Files Now button, resets the
|
238
|
+
# @@filex class variable back to zero, and instantiates
|
239
|
+
# the Resources page class.
|
240
|
+
def upload_files_now
|
241
|
+
frm.button(:value=>"Upload Files Now").click
|
242
|
+
@@filex=0
|
243
|
+
# Resources.new(@browser)
|
244
|
+
end
|
245
|
+
|
246
|
+
# Clicks the Add Another File link.
|
247
|
+
def add_another_file
|
248
|
+
frm.link(:text=>"Add Another File").click
|
249
|
+
end
|
250
|
+
|
251
|
+
end
|
252
|
+
|
253
|
+
class EditFileDetails < ResourcesBase
|
254
|
+
|
255
|
+
# Clicks the Update button, then instantiates
|
256
|
+
# the Resources page class.
|
257
|
+
def update
|
258
|
+
frm.button(:value=>"Update").click
|
259
|
+
Resources.new(@browser)
|
260
|
+
end
|
261
|
+
|
262
|
+
# Enters the specified string into the title field.
|
263
|
+
def title=(title)
|
264
|
+
frm.text_field(:id=>"displayName_0").set(title)
|
265
|
+
end
|
266
|
+
|
267
|
+
# Enters the specified string into the description field.
|
268
|
+
def description=(description)
|
269
|
+
frm.text_field(:id=>"description_0").set(description)
|
270
|
+
end
|
271
|
+
|
272
|
+
# Sets the radio button for publically viewable.
|
273
|
+
def select_publicly_viewable
|
274
|
+
frm.radio(:id=>"access_mode_public_0").set
|
275
|
+
end
|
276
|
+
|
277
|
+
# Checks the checkbox for showing only on the specifed
|
278
|
+
# condition.
|
279
|
+
def check_show_only_if_condition
|
280
|
+
frm.checkbox(:id=>"cbCondition_0")
|
281
|
+
end
|
282
|
+
|
283
|
+
# Selects the specified Gradebook item value in the
|
284
|
+
# select list.
|
285
|
+
def gradebook_item=(item)
|
286
|
+
frm.select(:id=>"selectResource_0").select(item)
|
287
|
+
end
|
288
|
+
|
289
|
+
# Selects the specified value in the item condition
|
290
|
+
# field.
|
291
|
+
def item_condition=(condition)
|
292
|
+
frm.select(:id=>"selectCondition_0").select(condition)
|
293
|
+
end
|
294
|
+
|
295
|
+
# Sets the Grade field to the specified value.
|
296
|
+
def assignment_grade=(grade)
|
297
|
+
frm.text_field(:id=>"assignment_grade_0").set(grade)
|
298
|
+
end
|
299
|
+
end
|
300
|
+
|
301
|
+
class CreateFolders < ResourcesBase
|
302
|
+
|
303
|
+
thing(:folder_name) { |b| b.frm.text_field(:id=>"content_0") }
|
304
|
+
action(:create_folders_now) { |b| b.frm.button(:value=>"Create Folders Now").click }
|
305
|
+
|
306
|
+
end
|
307
|
+
|
308
|
+
class EditHTMLPageContent < BasePage
|
309
|
+
|
310
|
+
frame_element
|
311
|
+
include FCKEditor
|
312
|
+
|
313
|
+
thing(:editor) { |b| b.frm.frame(:id=>"content___Frame") }
|
314
|
+
action(:continue) { |b| b.frm.button(id: "saveChanges").click }
|
315
|
+
element(:email_notification) { |b| b.frm.select(:id=>"notify") }
|
316
|
+
|
317
|
+
end
|
318
|
+
|
319
|
+
class EditHTMLPageProperties < ResourcesBase
|
320
|
+
|
321
|
+
thing(:name) { |b| b.frm.text_field(id: "displayName_0") }
|
322
|
+
thing(:description) { |b| b.frm.text_field(id: "description_0") }
|
323
|
+
|
324
|
+
action(:finish) { |b| b.frm.button(id: "finish_button").click }
|
325
|
+
|
326
|
+
end
|
File without changes
|
@@ -0,0 +1,70 @@
|
|
1
|
+
#================
|
2
|
+
# Roster Pages for a Site
|
3
|
+
#================
|
4
|
+
|
5
|
+
#
|
6
|
+
class Roster < BasePage
|
7
|
+
|
8
|
+
frame_element
|
9
|
+
|
10
|
+
def find
|
11
|
+
frm.button(:value=>"Find").click
|
12
|
+
Roster.new @browser
|
13
|
+
end
|
14
|
+
|
15
|
+
def names
|
16
|
+
list = []
|
17
|
+
frm.table(:id=>"roster_form:rosterTable").rows.each do |row|
|
18
|
+
list << row[0].text
|
19
|
+
end
|
20
|
+
list.delete_at(0)
|
21
|
+
return list
|
22
|
+
end
|
23
|
+
|
24
|
+
# Clicks on the link on the page that matches the specified name.
|
25
|
+
# Then instantiates the RosterProfileView class.
|
26
|
+
# Note that it expects an exact match for the name string, otherwise
|
27
|
+
# the script will error out.
|
28
|
+
def view(name)
|
29
|
+
frm.link(:text=>name).click
|
30
|
+
RosterProfileView.new @browser
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
element(:name_or_id) { |b| b.frm.text_field(:id=>"roster_form:search") }
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
#
|
39
|
+
class RosterProfileView < BasePage
|
40
|
+
|
41
|
+
frame_element
|
42
|
+
|
43
|
+
def back
|
44
|
+
frm.button(:value=>"Back").click
|
45
|
+
Roster.new(@browser)
|
46
|
+
end
|
47
|
+
|
48
|
+
# Returns a hash containing the contents of the Public Information
|
49
|
+
# table on the page, with the keys being the row headers and the values
|
50
|
+
# being the row's data contents.
|
51
|
+
def public_information
|
52
|
+
hash = {}
|
53
|
+
frm.table(:class=>"chefEditItem", :index=>0).rows.each do |row|
|
54
|
+
hash.store(row[0].text, row[1].text)
|
55
|
+
end
|
56
|
+
return hash
|
57
|
+
end
|
58
|
+
|
59
|
+
# Returns a hash containing the contents of the Personal Information
|
60
|
+
# table on the page, with the keys being the row headers and the values
|
61
|
+
# being the row's data contents.
|
62
|
+
def personal_information
|
63
|
+
hash = {}
|
64
|
+
frm.table(:class=>"chefEditItem", :index=>1).rows.each do |row|
|
65
|
+
hash.store(row[0].text, row[1].text)
|
66
|
+
end
|
67
|
+
return hash
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
class RwikiBase < BasePage
|
2
|
+
|
3
|
+
frame_element
|
4
|
+
class << self
|
5
|
+
def menu_elements
|
6
|
+
action(:home) { |b| b.frm.link(id: "homelink").click }
|
7
|
+
action(:view) { |b| b.frm.link(id: "viewLink").click }
|
8
|
+
action(:edit) { |b| b.frm.link(id: "editLink").click }
|
9
|
+
action(:info) { |b| b.frm.link(id: "infoLink").click }
|
10
|
+
action(:history) { |b| b.frm.link(id: "historyLink").click }
|
11
|
+
action(:watch) { |b| b.frm.link(id: "watchLink").click }
|
12
|
+
element(:search_field) { |b| b.frm.text_field(id: "searchField") }
|
13
|
+
element(:rss_link) { |b| b.frm.link(id: "rssLink") }
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class Rwiki < RwikiBase
|
19
|
+
|
20
|
+
menu_elements
|
21
|
+
|
22
|
+
element(:content) { |b| b.frm.text_field(id: "content") }
|
23
|
+
action(:save) { |b| b.frm.button(text: "Save").click }
|
24
|
+
action(:cancel) { |b| b.frm.button(text: "Cancel").click }
|
25
|
+
|
26
|
+
def open_wiki(title)
|
27
|
+
frm.link(:text=>title).click
|
28
|
+
end
|
29
|
+
|
30
|
+
def wiki_href(title)
|
31
|
+
frm.link(:text=>title).href
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|