sambal-cle 0.1.3

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.
Files changed (90) hide show
  1. data/README.md +4 -0
  2. data/lib/sambal-cle/base_page.rb +20 -0
  3. data/lib/sambal-cle/core-ext.rb +90 -0
  4. data/lib/sambal-cle/data_objects/announcement.rb +82 -0
  5. data/lib/sambal-cle/data_objects/assessment.rb +32 -0
  6. data/lib/sambal-cle/data_objects/assignment.rb +205 -0
  7. data/lib/sambal-cle/data_objects/blog.rb +46 -0
  8. data/lib/sambal-cle/data_objects/blogger.rb +49 -0
  9. data/lib/sambal-cle/data_objects/chat_room.rb +54 -0
  10. data/lib/sambal-cle/data_objects/event.rb +89 -0
  11. data/lib/sambal-cle/data_objects/forum.rb +212 -0
  12. data/lib/sambal-cle/data_objects/lesson.rb +185 -0
  13. data/lib/sambal-cle/data_objects/message.rb +57 -0
  14. data/lib/sambal-cle/data_objects/poll.rb +74 -0
  15. data/lib/sambal-cle/data_objects/resource.rb +209 -0
  16. data/lib/sambal-cle/data_objects/site.rb +295 -0
  17. data/lib/sambal-cle/data_objects/syllabus.rb +73 -0
  18. data/lib/sambal-cle/data_objects/web_content_tool.rb +51 -0
  19. data/lib/sambal-cle/data_objects/wiki.rb +63 -0
  20. data/lib/sambal-cle/date_makers.rb +118 -0
  21. data/lib/sambal-cle/gem_ext.rb +23 -0
  22. data/lib/sambal-cle/page_helper.rb +22 -0
  23. data/lib/sambal-cle/page_maker.rb +48 -0
  24. data/lib/sambal-cle/page_objects/account.rb +111 -0
  25. data/lib/sambal-cle/page_objects/aliases.rb +43 -0
  26. data/lib/sambal-cle/page_objects/announcements.rb +190 -0
  27. data/lib/sambal-cle/page_objects/assessments.rb +874 -0
  28. data/lib/sambal-cle/page_objects/assignments.rb +770 -0
  29. data/lib/sambal-cle/page_objects/basic_lti.rb +6 -0
  30. data/lib/sambal-cle/page_objects/blogger.rb +205 -0
  31. data/lib/sambal-cle/page_objects/blogs.rb +60 -0
  32. data/lib/sambal-cle/page_objects/calendar.rb +330 -0
  33. data/lib/sambal-cle/page_objects/calendar_summary.rb +1 -0
  34. data/lib/sambal-cle/page_objects/chat_room.rb +22 -0
  35. data/lib/sambal-cle/page_objects/drop_box.rb +9 -0
  36. data/lib/sambal-cle/page_objects/email_archive.rb +22 -0
  37. data/lib/sambal-cle/page_objects/entity_picker.rb +62 -0
  38. data/lib/sambal-cle/page_objects/evaluations.rb +158 -0
  39. data/lib/sambal-cle/page_objects/feedback.rb +36 -0
  40. data/lib/sambal-cle/page_objects/forms.rb +120 -0
  41. data/lib/sambal-cle/page_objects/forums.rb +254 -0
  42. data/lib/sambal-cle/page_objects/glossary.rb +117 -0
  43. data/lib/sambal-cle/page_objects/gradebook.rb +29 -0
  44. data/lib/sambal-cle/page_objects/gradebook2.rb +17 -0
  45. data/lib/sambal-cle/page_objects/home.rb +36 -0
  46. data/lib/sambal-cle/page_objects/jforums.rb +444 -0
  47. data/lib/sambal-cle/page_objects/job_scheduler.rb +121 -0
  48. data/lib/sambal-cle/page_objects/lessons.rb +361 -0
  49. data/lib/sambal-cle/page_objects/login.rb +28 -0
  50. data/lib/sambal-cle/page_objects/matrix.rb +241 -0
  51. data/lib/sambal-cle/page_objects/media_gallery.rb +13 -0
  52. data/lib/sambal-cle/page_objects/messages.rb +622 -0
  53. data/lib/sambal-cle/page_objects/my_workspace.rb +44 -0
  54. data/lib/sambal-cle/page_objects/news.rb +8 -0
  55. data/lib/sambal-cle/page_objects/podcasts.rb +27 -0
  56. data/lib/sambal-cle/page_objects/polls.rb +69 -0
  57. data/lib/sambal-cle/page_objects/portfolio_templates.rb +161 -0
  58. data/lib/sambal-cle/page_objects/portfolios.rb +162 -0
  59. data/lib/sambal-cle/page_objects/post_em.rb +1 -0
  60. data/lib/sambal-cle/page_objects/profile.rb +51 -0
  61. data/lib/sambal-cle/page_objects/profile2.rb +344 -0
  62. data/lib/sambal-cle/page_objects/public_search.rb +61 -0
  63. data/lib/sambal-cle/page_objects/realms.rb +19 -0
  64. data/lib/sambal-cle/page_objects/resources.rb +326 -0
  65. data/lib/sambal-cle/page_objects/resources_roster.rb +0 -0
  66. data/lib/sambal-cle/page_objects/rosters.rb +70 -0
  67. data/lib/sambal-cle/page_objects/rwiki.rb +34 -0
  68. data/lib/sambal-cle/page_objects/search.rb +34 -0
  69. data/lib/sambal-cle/page_objects/sections.rb +295 -0
  70. data/lib/sambal-cle/page_objects/single_user.rb +1 -0
  71. data/lib/sambal-cle/page_objects/site_setup.rb +621 -0
  72. data/lib/sambal-cle/page_objects/site_statistics.rb +1 -0
  73. data/lib/sambal-cle/page_objects/sites.rb +255 -0
  74. data/lib/sambal-cle/page_objects/styles.rb +74 -0
  75. data/lib/sambal-cle/page_objects/syllabus.rb +166 -0
  76. data/lib/sambal-cle/page_objects/user_membership.rb +57 -0
  77. data/lib/sambal-cle/page_objects/users.rb +88 -0
  78. data/lib/sambal-cle/randomizers.rb +117 -0
  79. data/lib/sambal-cle/rich_text.rb +38 -0
  80. data/lib/sambal-cle/utilities.rb +31 -0
  81. data/lib/sambal-cle/workflows.rb +223 -0
  82. data/lib/sambal-cle.rb +31 -0
  83. data/sambal-cle.gemspec +14 -0
  84. data/test/add_assignment_to_calendar_spec.rb +86 -0
  85. data/test/assignment_announcements_spec.rb +71 -0
  86. data/test/assignment_gradebook_spec.rb +98 -0
  87. data/test/config.yml.template +4 -0
  88. data/test/directory.yml.template +123 -0
  89. data/test/duplicate_site_spec.rb +244 -0
  90. metadata +167 -0
@@ -0,0 +1,255 @@
1
+ #================
2
+ # Sites Page - from Administration Workspace
3
+ #================
4
+
5
+ # Sites page - arrived at via the link with class="icon-sakai-sites"
6
+ class Sites < BasePage
7
+
8
+ frame_element
9
+
10
+ # Clicks the first site Id link
11
+ # listed. Useful when you've run a search and
12
+ # you're certain you've got the result you want.
13
+ # It then instantiates the EditSiteInfo page class.
14
+ def click_top_item
15
+ frm.link(:href, /#{Regexp.escape("&panel=Main&sakai_action=doEdit")}/).click
16
+ EditSiteInfo.new(@browser)
17
+ end
18
+
19
+ # Clicks the specified Site in the list, using the
20
+ # specified id value to determine which item to click.
21
+ # It then instantiates the EditSiteInfo page class.
22
+ # Use this method when you know the target site ID.
23
+ def edit_site_id(id)
24
+ frm.text_field(:id=>"search_site").value=id
25
+ frm.link(:text=>"Site ID").click
26
+ frm.link(:text, id).click
27
+ EditSiteInfo.new(@browser)
28
+ end
29
+
30
+ # Clicks the New Site button, then instantiates
31
+ # the EditSiteInfo page class.
32
+ def new_site
33
+ frm.link(:text, "New Site").click
34
+ EditSiteInfo.new(@browser)
35
+ end
36
+
37
+ element(:search_field) { |b| b.frm.text_field(:id=>"search") }
38
+ action(:search_button) { |b| b.frm.link(text=>"Search").click }
39
+ element(:search_site_id) { |b| b.frm.text_field(:id=>"search_site") }
40
+ action(:search_site_id_button) { |b| b.frm.link(text=>"Site ID").click }
41
+ element(:search_user_id) { |b| b.frm.text_field(:id=>"search_user") }
42
+ action(:search_user_id_button) { |b| b.frm.link(text=>"User ID").click }
43
+ action(:next) { |b| b.frm.button(:name=>"eventSubmit_doList_next").click }
44
+ action(:last) { |b| b.frm.button(:name=>"eventSubmit_doList_last").click }
45
+ action(:previous) { |b| b.frm.button(:name=>"eventSubmit_doList_prev").click }
46
+ action(:first) { |b| b.frm.button(:name=>"eventSubmit_doList_first").click }
47
+ element(:select_page_size) { |b| b.frm.select_list(:name=>"selectPageSize") }
48
+
49
+ end
50
+
51
+
52
+ # Page that appears when you've clicked a Site ID in the
53
+ # Sites section of the Administration Workspace.
54
+ class EditSiteInfo < BasePage
55
+
56
+ frame_element
57
+
58
+ # Clicks the Remove Site button, then instantiates
59
+ # the RemoveSite page class.
60
+ def remove_site
61
+ frm.link(:text, "Remove Site").click
62
+ RemoveSite.new(@browser)
63
+ end
64
+
65
+ # Clicks the Save button, then instantiates the Sites
66
+ # page class.
67
+ def save
68
+ frm.button(:value=>"Save").click
69
+ Sites.new(@browser)
70
+ end
71
+
72
+ # Clicks the Save As link, then instantiates
73
+ # the SiteSaveAs page class.
74
+ def save_as
75
+ frm.link(:text, "Save As").click
76
+ SiteSaveAs.new(@browser)
77
+ end
78
+
79
+ # Gets the Site ID from the page.
80
+ def site_id_read_only
81
+ @browser.frame(:index=>0).table(:class=>"itemSummary").td(:class=>"shorttext", :index=>0).text
82
+ end
83
+
84
+ # Enters the specified text string in the text area of
85
+ # the FCKEditor.
86
+ def description=(text)
87
+ editor.td(:id, "xEditingArea").frame(:index=>0).send_keys(text)
88
+ end
89
+
90
+ # The FCKEditor object. Use this object for
91
+ # wait commands when the site is slow
92
+ def editor
93
+ @browser.frame(:index=>0).frame(:id, "description___Frame")
94
+ end
95
+
96
+ # Clicks the Properties button on the page,
97
+ # then instantiates the AddEditSiteProperties
98
+ # page class.
99
+ def properties
100
+ frm.button(:value=>"Properties").click
101
+ AddEditSiteProperties.new(@browser)
102
+ end
103
+
104
+ # Clicks the Pages button, then instantiates
105
+ # the AddEditPages page class.
106
+ def pages
107
+ frm.button(:value=>"Pages").click
108
+ AddEditPages.new(@browser)
109
+ end
110
+
111
+ # Non-navigating, interactive page objects go here
112
+ element(:site_id) { |b| b.frm.text_field(:id=>"id") }
113
+ element(:title) { |b| b.frm.text_field(:id=>"title") }
114
+ element(:type) { |b| b.frm.text_field(:id=>"type") }
115
+ element(:short_description) { |b| b.frm.text_field(:id=>"shortDescription") }
116
+ element(:unpublished) { |b| b.frm.select_list(:id=>"publishedfalse") }
117
+ element(:published) { |b| b.frm.select_list(:id=>"publishedtrue") }
118
+ element(:public_view_yes) { |b| b.frm.select_list(:id=>"pubViewtrue") }
119
+ end
120
+
121
+
122
+
123
+ # The page you come to when editing a Site in Sites
124
+ # and you click on the Pages button
125
+ class AddEditPages < BasePage
126
+
127
+ frame_element
128
+
129
+ # Clicks the link for New Page, then
130
+ # instantiates the NewPage page class.
131
+ def new_page
132
+ frm.link(:text=>"New Page").click
133
+ NewPage.new(@browser)
134
+ end
135
+
136
+ end
137
+
138
+ # Page for adding a new page to a Site.
139
+ class NewPage < BasePage
140
+
141
+ frame_element
142
+
143
+ # Clicks the Tools button, then instantiates
144
+ # the AddEditTools class.
145
+ def tools
146
+ frm.button(:value=>"Tools").click
147
+ AddEditTools.new(@browser)
148
+ end
149
+
150
+ # Interactive page objects that do no navigation
151
+ # or page refreshes go here.
152
+ element(:title) { |b| b.frm.text_field(:id=>"title") }
153
+
154
+ end
155
+
156
+
157
+
158
+ # Page when editing a Site and adding/editing tools for pages.
159
+ class AddEditTools < BasePage
160
+
161
+ frame_element
162
+
163
+ # Clicks the New Tool link, then instantiates
164
+ # the NewTool class.
165
+ def new_tool
166
+ frm.link(:text=>"New Tool").click
167
+ NewTool.new(@browser)
168
+ end
169
+
170
+ # Clicks the Save button, then
171
+ # instantiates the AddEditPages class.
172
+ def save
173
+ frm.button(:value=>"Save").click
174
+ AddEditPages.new(@browser)
175
+ end
176
+
177
+ end
178
+
179
+ # Page for creating a new tool for a page in a site
180
+ class NewTool < BasePage
181
+
182
+ frame_element
183
+
184
+ # Clicks the Done button, the instantiates
185
+ # The AddEditTools class.
186
+ def done
187
+ frm.button(:value=>"Done").click
188
+ AddEditTools.new(@browser)
189
+ end
190
+
191
+ # Interactive page objects that do no navigation
192
+ # or page refreshes go here.
193
+ element(:title) { |b| b.frm.text_field(:id=>"title") }
194
+ element(:layout_hints) { |b| b.frm.text_field(:id=>"layoutHints") }
195
+ element(:resources) { |b| b.frm.select_list(:id=>"feature80") }
196
+ end
197
+
198
+
199
+ # Page that appears when you click "Remove Site" when editing a Site in Sites
200
+ class RemoveSite < BasePage
201
+
202
+ frame_element
203
+
204
+ # Clicks the Remove button, then
205
+ # instantiates the Sites class.
206
+ def remove
207
+ frm.button(:value=>"Remove").click
208
+ Sites.new(@browser)
209
+ end
210
+
211
+
212
+ # Page that appears when you click "Save As" when editing a Site in Sites
213
+ class SiteSaveAs < BasePage
214
+
215
+ frame_element
216
+
217
+ # Clicks the Save button, then
218
+ # instantiates the Sites class.
219
+ def save
220
+ frm.button(:value, "Save").click
221
+ Sites.new(@browser)
222
+ end
223
+
224
+ element(:site_id) { |b| b.frm.text_field(:id=>"id") }
225
+ end
226
+
227
+ end
228
+
229
+ class AddEditSiteProperties < BasePage
230
+
231
+ frame_element
232
+
233
+ # Clicks the New Property button
234
+ def new_property
235
+ frm.button(:value=>"New Property").click
236
+ #Class.new(@browser)
237
+ end
238
+
239
+ # Clicks the Done button, then instantiates
240
+ # the EditSiteInfo class.
241
+ def done
242
+ frm.button(:value=>"Done").click
243
+ EditSiteInfo.new(@browser)
244
+ end
245
+
246
+ # Clicks the Save button, then instantiates
247
+ # the Sites page class.
248
+ def save
249
+ frm.button(:value=>"Save").click
250
+ Sites.new(@browser)
251
+ end
252
+
253
+ element(:name) { |b| b.frm.text_field(:id=>"new_name") }
254
+ element(:value) { |b| b.frm.text_field(:id=>"new_value") }
255
+ end
@@ -0,0 +1,74 @@
1
+ #================
2
+ # Styles pages in a Portfolio Site
3
+ #================
4
+
5
+ #
6
+ class Styles < BasePage
7
+
8
+ frame_element
9
+
10
+ # Clicks the Add link and
11
+ # instantiates the AddStyle Class.
12
+ def add
13
+ frm.link(:text=>"Add").click
14
+ AddStyle.new(@browser)
15
+ end
16
+
17
+ end
18
+
19
+ #
20
+ class AddStyle < BasePage
21
+
22
+ frame_element
23
+
24
+ # Clicks the Add Style button and
25
+ # instantiates the Styles Class.
26
+ def add_style
27
+ frm.button(:value=>"Add Style").click
28
+ Styles.new(@browser)
29
+ end
30
+
31
+ # Clicks the "Select File" link and
32
+ # instantiates the StylesAddAttachment Class.
33
+ def select_file
34
+ frm.link(:text=>"Select File").click
35
+ StylesAddAttachment.new(@browser)
36
+ end
37
+
38
+ element(:name) { |b| b.frm.text_field(:id=>"name-id") }
39
+ element(:description) { |b| b.frm.text_field(:id=>"descriptionTextArea") }
40
+
41
+ end
42
+
43
+ # TODO Dry this up because there can be a superclass here
44
+ class StylesUploadFiles < ResourcesBase
45
+
46
+ @@filex=0
47
+
48
+ # Note that the file_to_upload method can be used
49
+ # multiple times, but it assumes
50
+ # that the add_another_file method is used
51
+ # before it, every time except before the first time.
52
+ def file_to_upload(file_name, file_path="")
53
+ frm.file_field(:id, "content_#{@@filex}").set(file_path + file_name)
54
+ @@filex+=1
55
+ end
56
+
57
+ # Clicks the "Upload Files Now" button
58
+ # then instantiates the StylesAddAttachment Class.
59
+ def upload_files_now
60
+ frm.button(:value=>"Upload Files Now").click
61
+ sleep 0.5
62
+ @@filex=0
63
+ StylesAddAttachment.new(@browser)
64
+ end
65
+
66
+ # Clicks the "Add Another File" link.
67
+ def add_another_file
68
+ frm.link(:text=>"Add Another File").click
69
+ end
70
+
71
+ end
72
+
73
+
74
+
@@ -0,0 +1,166 @@
1
+ #================
2
+ # Syllabus pages in a Site
3
+ #================
4
+
5
+ class SyllabusBase < BasePage
6
+
7
+ frame_element
8
+ basic_page_elements
9
+
10
+ class << self
11
+
12
+ def menu_elements
13
+ action(:create_edit) { |b| b.frm.link(:text=>"Create/Edit").click }
14
+ action(:add) { |b| b.frm.link(:text=>"Add").click }
15
+ action(:redirect) { |b| b.frm.link(:text=>"Redirect").click }
16
+ action(:preview) { |b| b.frm.link(text: "Preview").click }
17
+ end
18
+
19
+ end
20
+
21
+ end
22
+
23
+ # The topmost page in the Syllabus feature.
24
+ # If there are no syllabus items it will appear
25
+ # differently than if there are.
26
+ class Syllabus < SyllabusBase
27
+
28
+ menu_elements
29
+
30
+ def attachments_list
31
+ list = []
32
+ frm.div(:class=>"portletBody").links.each { |link| list << link.text }
33
+ return list
34
+ end
35
+
36
+ end
37
+
38
+ # This is the page that lists Syllabus sections, allows for
39
+ # moving them up or down in the list, and allows for removing
40
+ # items from the syllabus.
41
+ class SyllabusEdit < SyllabusBase
42
+
43
+ menu_elements
44
+
45
+ # Clicks the checkbox for the item with the
46
+ # specified title.
47
+ def check_title(title)
48
+ index=syllabus_titles.index(title)
49
+ frm.checkbox(:index=>index).set
50
+ end
51
+
52
+ #
53
+ def move_title_up(title)
54
+ #FIXME
55
+ end
56
+
57
+ #
58
+ def move_title_down(title)
59
+ #FIXME
60
+ end
61
+
62
+ action(:update) { |b| b.frm.button(:value=>"Update").click }
63
+
64
+ # Opens the specified item
65
+ def open_item(title)
66
+ frm.link(:text=>title).click
67
+ end
68
+
69
+ # Returns an array containing the titles of the syllabus items
70
+ # displayed on the page.
71
+ def syllabus_titles
72
+ titles = []
73
+ s_table = frm.table(:class=>"listHier lines nolines")
74
+ 1.upto(s_table.rows.size-1) do |x|
75
+ titles << s_table[x][0].text
76
+ end
77
+ return titles
78
+ end
79
+
80
+ end
81
+
82
+ #
83
+ class AddEditSyllabusItem < SyllabusBase
84
+
85
+ menu_elements
86
+ include FCKEditor
87
+
88
+ expected_element :editor
89
+
90
+ # Clicks the "Post" button and instantiates
91
+ # the Syllabus Class.
92
+ action(:post) { |b| b.frm.button(:value=>"Post").click }
93
+
94
+ # Defines the text area of the FCKEditor that appears on the page for
95
+ # the Syllabus content.
96
+ def editor
97
+ frm.frame(:id=>/_textarea___Frame/)
98
+ end
99
+
100
+ # Sends the specified string to the FCKEditor text area on the page.
101
+ def content=(text)
102
+ editor.send_keys(text)
103
+ end
104
+
105
+ # Clicks the Add attachments button and instantiates the
106
+ # SyllabusAttach class.
107
+ action(:add_attachments) { |b| frm.button(:value=>"Add attachments").click }
108
+
109
+ # Returns an array of the filenames in the attachments
110
+ # table
111
+ def files_list
112
+ names = []
113
+ frm.table(:class=>"listHier lines nolines").rows.each do |row|
114
+ if row.td(:class=>"item").exist?
115
+ names << row.td(:class=>"item").h4.text
116
+ end
117
+ end
118
+ return names
119
+ end
120
+
121
+ # Clicks the preview button and
122
+ # instantiates the SyllabusPreview class
123
+ def preview
124
+ frm.button(:value=>"Preview").click
125
+ SyllabusPreview.new(@browser)
126
+ end
127
+
128
+ element(:title) { |b| b.frm.text_field(:id=>"_id4:title") }
129
+ element(:only_members_of_this_site) { |b| b.frm.radio_button(:name=>/_id\d+:_id\d+/, :value=>"no") }
130
+ element(:publicly_viewable) { |b| b.frm.radio_button(:name=>/_id\d+:_id\d+/, :value=>"yes") }
131
+
132
+ end
133
+
134
+ # The page for previewing a syllabus.
135
+ class SyllabusPreview < SyllabusBase
136
+
137
+ menu_elements
138
+
139
+ action(:edit) { |b| b.frm.button(:value=>"Edit").click }
140
+
141
+ end
142
+
143
+ #
144
+ class SyllabusRedirect < SyllabusBase
145
+
146
+ menu_elements
147
+
148
+ action(:save) { |b| b.frm.button(:value=>"Save").click }
149
+ element(:url) { |b| b.frm.text_field(:id=>"redirectForm:urlValue") }
150
+
151
+ end
152
+
153
+ # The page where Syllabus Items can be deleted.
154
+ class DeleteSyllabusItems < SyllabusBase
155
+
156
+ menu_elements
157
+
158
+ action(:delete) { |b| b.frm.button(:value=>"Delete").click }
159
+
160
+ end
161
+
162
+ class CreateEditSyllabus < SyllabusBase
163
+
164
+ menu_elements
165
+
166
+ end
@@ -0,0 +1,57 @@
1
+ #================
2
+ # User Membership Pages from Administration Workspace
3
+ #================
4
+
5
+ # User Membership page for admin users - "icon-sakai-usermembership"
6
+ class UserMembership < BasePage
7
+
8
+ frame_element
9
+
10
+ # Returns an array containing the user names displayed in the search results.
11
+ def names
12
+ names = []
13
+ frm.table(:class=>/listHier/).rows.each do |row|
14
+ names << row[2].text
15
+ end
16
+ names.delete_at(0)
17
+ return names
18
+ end
19
+
20
+ # Returns the user id of the specified user (assuming that person
21
+ # appears in the search results list, otherwise this method will
22
+ # throw an error.)
23
+ def user_id(name)
24
+ frm.table(:class=>/listHier/).row(:text=>/#{Regexp.escape(name)}/)[0].text
25
+ end
26
+
27
+ # Returns the user type of the specified user (assuming that person
28
+ # appears in the search results list, otherwise this method will
29
+ # throw an error.)
30
+ def type(name)
31
+ frm.table(:class=>/listHier/).row(:text=>/#{Regexp.escape(name)}/)[4].text
32
+ end
33
+
34
+ # Returns the text contents of the "instruction" paragraph that
35
+ # appears when there are no search results.
36
+ def alert_text
37
+ frm.p(:class=>"instruction").text
38
+ end
39
+
40
+ element(:user_type) { |b| b.frm.select_list(:id=>"userlistForm:selectType") }
41
+ element(:user_authority) { |b| b.frm.select_list(:id=>"userlistForm:selectAuthority") }
42
+ element(:search_field) { |b| b.frm.text_field(:id=>"userlistForm:inputSearchBox") }
43
+ action(:search) { |b| b.frm.button(:id=>"userlistForm:searchButton").click }
44
+ action(:clear_search) { |b| b.frm.button(:id=>"userlistForm:clearSearchButton").click }
45
+ element(:page_size) { |b| b.frm.select_list(:id=>"userlistForm:pager_pageSize") }
46
+ action(:export_csv) { |b| b.frm.button(:id=>"userlistForm:exportCsv").click }
47
+ action(:export_excel) { |b| b.frm.button(:id=>"userlistForm:exportXls").click }
48
+ action(:sort_user_id) { |b| b.frm.link(id=>"userlistForm:_idJsp13:_idJsp14").click }
49
+ action(:sort_internal_user_id) { |b| b.frm.link(id=>"userlistForm:_idJsp13:_idJsp18").click }
50
+ action(:sort_name) { |b| b.frm.link(id=>"userlistForm:_idJsp13:_idJsp21").click }
51
+ action(:sort_email) { |b| b.frm.link(id=>"userlistForm:_idJsp13:_idJsp24").click }
52
+ action(:sort_type) { |b| b.frm.link(id=>"userlistForm:_idJsp13:_idJsp28").click }
53
+ action(:sort_authority) { |b| b.frm.link(id=>"userlistForm:_idJsp13:_idJsp31").click }
54
+ action(:sort_created_on) { |b| b.frm.link(id=>"userlistForm:_idJsp13:_idJsp34").click }
55
+ action(:sort_modified_on) { |b| b.frm.link(id=>"userlistForm:_idJsp13:_idJsp37").click }
56
+
57
+ end
@@ -0,0 +1,88 @@
1
+ #================
2
+ # Users Pages - From the Workspace
3
+ #================
4
+
5
+ # The Page for editing User Account details
6
+ class EditUser < BasePage
7
+
8
+ frame_element
9
+
10
+ def update_details
11
+ frm.button(:name=>"eventSubmit_doSave").click
12
+ sleep 1
13
+ end
14
+
15
+ action(:remove_user) { |b| b.frm.link(text=>"Remove User").click }
16
+ element(:first_name) { |b| b.frm.text_field(:id=>"first-name") }
17
+ element(:last_name) { |b| b.frm.text_field(:id=>"last-name") }
18
+ element(:email) { |b| b.frm.text_field(:id=>"email") }
19
+ element(:create_new_password) { |b| b.frm.text_field(:id=>"pw") }
20
+ element(:verify_new_password) { |b| b.frm.text_field(:id=>"pw0") }
21
+ action(:cancel_changes) { |b| b.frm.button(:name=>"eventSubmit_doCancel").click }
22
+
23
+ end
24
+
25
+ # The Users page - "icon-sakai-users"
26
+ class Users < BasePage
27
+
28
+ frame_element
29
+
30
+ def new_user
31
+ frm.link(:text=>"New User").click
32
+ CreateNewUser.new @browser
33
+ end
34
+
35
+ # Returns the contents of the Name cell
36
+ # based on the specified user ID value.
37
+ def name(user_id)
38
+ frm.table(:class=>"listHier lines").row(:text=>/#{Regexp.escape(user_id)}/i)[1].text
39
+ end
40
+
41
+ # Returns the contents of the Email cell
42
+ # based on the specified user ID value.
43
+ def email(user_id)
44
+ frm.table(:class=>"listHier lines").row(:text=>/#{Regexp.escape(user_id)}/i)[2].text
45
+ end
46
+
47
+ # Returns the contents of the Type cell
48
+ # based on the specified user ID value.
49
+ def type(user_id)
50
+ frm.table(:class=>"listHier lines").row(:text=>/#{Regexp.escape(user_id)}/i)[3].text
51
+ end
52
+
53
+ def search_button
54
+ frm.link(:text=>"Search").click
55
+ frm.table(:class=>"listHier lines").wait_until_present
56
+ Users.new @browser
57
+ end
58
+
59
+ action(:clear_search) { |b| b.frm.link(text=>"Clear Search").click }
60
+ element(:search_field) { |b| b.frm.text_field(:id=>"search") }
61
+ element(:select_page_size) { |b| b.frm.select_list(:name=>"selectPageSize") }
62
+ action(:next) { |b| b.frm.button(:name=>"eventSubmit_doList_next").click }
63
+ action(:last) { |b| b.frm.button(:name=>"eventSubmit_doList_last").click }
64
+ action(:previous) { |b| b.frm.button(:name=>"eventSubmit_doList_prev").click }
65
+ action(:first) { |b| b.frm.button(:name=>"eventSubmit_doList_first").click }
66
+
67
+ end
68
+
69
+
70
+ # The Create New User page
71
+ class CreateNewUser < BasePage
72
+
73
+ frame_element
74
+
75
+ def save_details
76
+ frm.button(:name=>"eventSubmit_doSave").click
77
+ Users.new(@browser)
78
+ end
79
+
80
+ element(:user_id) { |b| b.frm.text_field(:id=>"eid") }
81
+ element(:first_name) { |b| b.frm.text_field(:id=>"first-name") }
82
+ element(:last_name) { |b| b.frm.text_field(:id=>"last-name") }
83
+ element(:email) { |b| b.frm.text_field(:id=>"email") }
84
+ element(:create_new_password) { |b| b.frm.text_field(:id=>"pw") }
85
+ element(:verify_new_password) { |b| b.frm.text_field(:id=>"pw0") }
86
+ element(:type) { |b| b.frm.select_list(:name=>"type") }
87
+ action(:cancel_changes) { |b| b.frm.button(:name=>"eventSubmit_doCancel").click }
88
+ end