sakai-cle-test-api 0.0.7 → 0.0.9

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 (44) hide show
  1. data/lib/sakai-cle-test-api.rb +7 -2
  2. data/lib/sakai-cle-test-api/add_files.rb +198 -0
  3. data/lib/sakai-cle-test-api/admin_page_elements.rb +7 -3
  4. data/lib/sakai-cle-test-api/announcements.rb +274 -7
  5. data/lib/sakai-cle-test-api/assessments.rb +930 -27
  6. data/lib/sakai-cle-test-api/assignments.rb +769 -13
  7. data/lib/sakai-cle-test-api/basic_lti.rb +5 -1
  8. data/lib/sakai-cle-test-api/blogs.rb +54 -2
  9. data/lib/sakai-cle-test-api/calendar.rb +423 -8
  10. data/lib/sakai-cle-test-api/chat_room.rb +0 -0
  11. data/lib/sakai-cle-test-api/common_page_elements.rb +69 -172
  12. data/lib/sakai-cle-test-api/core-ext.rb +90 -0
  13. data/lib/sakai-cle-test-api/data_objects/announcement.rb +38 -0
  14. data/lib/sakai-cle-test-api/data_objects/assessment.rb +32 -0
  15. data/lib/sakai-cle-test-api/data_objects/assignment.rb +62 -0
  16. data/lib/sakai-cle-test-api/data_objects/event.rb +86 -0
  17. data/lib/sakai-cle-test-api/data_objects/lesson.rb +137 -0
  18. data/lib/sakai-cle-test-api/data_objects/resource.rb +174 -0
  19. data/lib/sakai-cle-test-api/data_objects/site.rb +213 -0
  20. data/lib/sakai-cle-test-api/data_objects/syllabus.rb +7 -0
  21. data/lib/sakai-cle-test-api/data_objects/topic.rb +0 -0
  22. data/lib/sakai-cle-test-api/data_objects/web_content_tool.rb +52 -0
  23. data/lib/sakai-cle-test-api/data_objects/wiki.rb +7 -0
  24. data/lib/sakai-cle-test-api/drop_box.rb +21 -0
  25. data/lib/sakai-cle-test-api/email_archive.rb +15 -1
  26. data/lib/sakai-cle-test-api/forums.rb +282 -8
  27. data/lib/sakai-cle-test-api/gem_ext.rb +45 -0
  28. data/lib/sakai-cle-test-api/gradebook.rb +19 -1
  29. data/lib/sakai-cle-test-api/gradebook2.rb +15 -1
  30. data/lib/sakai-cle-test-api/lessons.rb +440 -0
  31. data/lib/sakai-cle-test-api/messages.rb +551 -15
  32. data/lib/sakai-cle-test-api/news.rb +3 -1
  33. data/lib/sakai-cle-test-api/polls.rb +65 -3
  34. data/lib/sakai-cle-test-api/profile.rb +36 -2
  35. data/lib/sakai-cle-test-api/profile2.rb +315 -6
  36. data/lib/sakai-cle-test-api/resources.rb +138 -0
  37. data/lib/sakai-cle-test-api/rich_text.rb +13 -0
  38. data/lib/sakai-cle-test-api/sections.rb +198 -8
  39. data/lib/sakai-cle-test-api/site_page_elements.rb +4 -441
  40. data/lib/sakai-cle-test-api/syllabus.rb +149 -7
  41. data/lib/sakai-cle-test-api/tools_menu.rb +3 -20
  42. data/lib/sakai-cle-test-api/utilities.rb +260 -0
  43. data/sakai-cle-test-api.gemspec +2 -3
  44. metadata +21 -19
@@ -5,5 +5,7 @@
5
5
  class News
6
6
  include PageObject
7
7
  include ToolsMenu
8
- include NewsMethods
8
+ in_frame(:class=>"portletMainIframe") do |frame|
9
+
10
+ end
9
11
  end
@@ -6,19 +6,81 @@
6
6
  class Polls
7
7
  include PageObject
8
8
  include ToolsMenu
9
- include PollsMethods
9
+ def add
10
+ frm.link(:text=>"Add").click
11
+ frm.frame(:id, "newpolldescr::input___Frame").td(:id, "xEditingArea").wait_until_present
12
+ AddEditPoll.new(@browser)
13
+ end
14
+
15
+ #
16
+ def edit(poll)
17
+
18
+ end
19
+
20
+ def questions
21
+ questions = []
22
+ frm.table(:id=>"sortableTable").rows.each do |row|
23
+ questions << row[0].link.text
24
+ end
25
+ return questions
26
+ end
27
+
28
+ # Returns an array containing the list of poll questions displayed.
29
+ def list
30
+ list = []
31
+ frm.table(:id=>"sortableTable").rows.each_with_index do |row, index|
32
+ next if index==0
33
+ list << row[0].link(:href=>/voteQuestion/).text
34
+ end
35
+ return list
36
+ end
37
+
38
+ in_frame(:class=>"portletMainIframe") do |frame|
39
+
40
+ end
10
41
  end
11
42
 
12
43
  #
13
44
  class AddEditPoll
14
45
  include PageObject
15
46
  include ToolsMenu
16
- include AddEditPollMethods
47
+
48
+ def additional_instructions=(text)
49
+ frm.frame(:id, "newpolldescr::input___Frame").td(:id, "xEditingArea").frame(:index=>0).send_keys(text)
50
+ end
51
+
52
+ def save_and_add_options
53
+ frm.button(:value=>"Save and add options").click
54
+ AddAnOption.new(@browser)
55
+ end
56
+
57
+ def save
58
+ frm.button(:value=>"Save").click
59
+ Polls.new(@browser)
60
+ end
61
+
62
+ in_frame(:class=>"portletMainIframe") do |frame|
63
+ text_field(:question, :id=>"new-poll-text", :frame=>frame)
64
+
65
+ end
66
+
17
67
  end
18
68
 
19
69
  #
20
70
  class AddAnOption
21
71
  include PageObject
22
72
  include ToolsMenu
23
- include AddAnOptionMethods
73
+ def answer_option=(text)
74
+ frm.frame(:id, "optText::input___Frame").td(:id, "xEditingArea").frame(:index=>0).send_keys(text)
75
+ end
76
+
77
+ def save
78
+ frm.button(:value=>"Save").click
79
+ AddEditPoll.new(@browser)
80
+ end
81
+
82
+ def save_and_add_options
83
+ frm.button(:value=>"Save and add options").click
84
+ AddAnOption.new(@browser)
85
+ end
24
86
  end
@@ -6,12 +6,46 @@
6
6
  class Profile
7
7
  include PageObject
8
8
  include ToolsMenu
9
- include ProfileMethods
9
+ def edit_my_profile
10
+ frm.link(:text=>"Edit my Profile").click
11
+ EditProfile.new(@browser)
12
+ end
13
+
14
+ def show_my_profile
15
+ frm.link(:text=>"Show my Profile").click
16
+ Profile.new @browser
17
+ end
18
+
19
+ def photo
20
+ source = frm.image(:id=>"profileForm:image1").src
21
+ return source.split("/")[-1]
22
+ end
23
+
24
+ def email
25
+ frm.link(:id=>"profileForm:email").text
26
+ end
10
27
  end
11
28
 
12
29
  #
13
30
  class EditProfile
14
31
  include PageObject
15
32
  include ToolsMenu
16
- include EditProfileMethods
33
+ def save
34
+ frm.button(:value=>"Save").click
35
+ Profile.new(@browser)
36
+ end
37
+
38
+ def picture_file(filename, filepath="")
39
+ frm.file_field(:name=>"editProfileForm:uploadFile.uploadId").set(filepath + filename)
40
+ end
41
+
42
+ in_frame(:class=>"portletMainIframe") do |frame|
43
+ text_field(:first_name, :id=>"editProfileForm:first_name", :frame=>frame)
44
+ text_field(:last_name, :id=>"editProfileForm:lname", :frame=>frame)
45
+ text_field(:nickname, :id=>"editProfileForm:nickname", :frame=>frame)
46
+ text_field(:position, :id=>"editProfileForm:position", :frame=>frame)
47
+ text_field(:email, :id=>"editProfileForm:email", :frame=>frame)
48
+ radio_button(:upload_new_picture, :value=>"pictureUpload", :frame=>frame)
49
+
50
+ end
17
51
  end
@@ -1,9 +1,164 @@
1
+ module Profile2Nav
2
+
3
+ def preferences
4
+ frm.link(:class=>"icon preferences").click
5
+ Profile2Preferences.new @browser
6
+ end
7
+
8
+ def privacy
9
+ frm.link(:text=>"Privacy").click
10
+ Profile2Privacy.new @browser
11
+ end
12
+
13
+ def my_profile
14
+ frm.link(:text=>"My profile").click
15
+ Profile2.new(@browser)
16
+ end
17
+
18
+ def connections
19
+ frm.link(:class=>"icon connections").click
20
+ Profile2Connections.new @browser
21
+ end
22
+
23
+ def pictures
24
+ frm.link(:text=>"Pictures").click
25
+ Profile2Pictures.new @browser
26
+ end
27
+
28
+ def messages
29
+ frm.link(:text=>"Messages").click
30
+ Profile2Messages.new @browser
31
+ end
32
+
33
+ def search_for_connections
34
+ frm.link(:class=>"icon search").click
35
+ Profile2Search.new @browser
36
+ end
37
+
38
+ end
1
39
  #
2
40
  class Profile2
3
41
  include PageObject
4
42
  include ToolsMenu
5
43
  include Profile2Nav
6
- include Profile2Methods
44
+ def edit_basic_info
45
+ frm.div(:id=>"mainPanel").span(:text=>"Basic Information").fire_event("onmouseover")
46
+ frm.div(:id=>"mainPanel").link(:href=>/myInfo:editButton/).click
47
+ sleep 0.5
48
+ Profile2.new @browser
49
+ end
50
+
51
+ def edit_contact_info
52
+ frm.div(:id=>"mainPanel").span(:text=>"Contact Information").fire_event("onmouseover")
53
+ frm.div(:id=>"mainPanel").link(:href=>/myContact:editButton/).click
54
+ sleep 0.5
55
+ Profile2.new @browser
56
+ end
57
+
58
+ def edit_staff_info
59
+ frm.div(:id=>"mainPanel").span(:text=>"Staff Information").fire_event("onmouseover")
60
+ frm.div(:id=>"mainPanel").link(:href=>/myStaff:editButton/).click
61
+ sleep 0.5
62
+ Profile2.new @browser
63
+ end
64
+
65
+ def edit_student_info
66
+ frm.div(:id=>"mainPanel").span(:text=>"Student Information").fire_event("onmouseover")
67
+ frm.div(:id=>"mainPanel").link(:href=>/myStudent:editButton/).click
68
+ sleep 0.5
69
+ Profile2.new @browser
70
+ end
71
+
72
+ def edit_social_networking
73
+ frm.div(:id=>"mainPanel").span(:text=>"Social Networking").fire_event("onmouseover")
74
+ frm.div(:id=>"mainPanel").link(:href=>/mySocialNetworking:editButton/).click
75
+ sleep 0.5
76
+ Profile2.new @browser
77
+ end
78
+
79
+ def edit_personal_info
80
+ frm.div(:id=>"mainPanel").span(:text=>"Personal Information").fire_event("onmouseover")
81
+ frm.div(:id=>"mainPanel").link(:href=>/myInterests:editButton/).click
82
+ sleep 0.5
83
+ Profile2.new @browser
84
+ end
85
+
86
+ def change_picture
87
+ frm.div(:id=>"myPhoto").fire_event("onmouseover")
88
+ frm.div(:id=>"myPhoto").link(:class=>"edit-image-button").click
89
+ sleep 0.5
90
+ Profile2.new @browser
91
+ end
92
+
93
+ # Enters the specified filename in the file field.
94
+ #
95
+ # Note that the file should be inside the data/sakai-cle-test-api folder.
96
+ # The file or folder name used for the filename variable
97
+ # should not include a preceding slash ("/") character.
98
+ def image_file=(filename)
99
+ frm.file_field(:name=>"picture").set(File.expand_path(File.dirname(__FILE__)) + "/../../data/sakai-cle-test-api/" + filename)
100
+ end
101
+
102
+ def upload
103
+ frm.button(:value=>"Upload").click
104
+ sleep 0.5
105
+ Profile2.new @browser
106
+ end
107
+
108
+ def personal_summary=(text)
109
+ frm.frame(:id=>"id1a_ifr").send_keys([:command, 'a'], :backspace)
110
+ frm.frame(:id=>"id1a_ifr").send_keys(text)
111
+ end
112
+
113
+ def birthday(day, month, year)
114
+ frm.text_field(:name=>"birthdayContainer:birthday").click
115
+ frm.select(:class=>"ui-datepicker-new-year").wait_until_present
116
+ frm.select(:class=>"ui-datepicker-new-year").select(year.to_i)
117
+ frm.select(:class=>"ui-datepicker-new-month").select(month)
118
+ frm.link(:text=>day.to_s).click
119
+ end
120
+
121
+ def save_changes
122
+ frm.button(:value=>"Save changes").click
123
+ Profile2.new @browser
124
+ end
125
+
126
+ # Returns the number (as a string) displayed next to
127
+ # the "Connections" link in the menu. If there are no
128
+ # connections then returns zero as a string object.
129
+ def connection_requests
130
+ begin
131
+ frm.link(:class=>/icon connections/).span(:class=>"new-items-count").text
132
+ rescue
133
+ return "0"
134
+ end
135
+ end
136
+
137
+ in_frame(:class=>"portletMainIframe") do |frame|
138
+ text_field(:say_something, :id=>"id1", :frame=>frame)
139
+ button(:say_it, :value=>"Say it", :frame=>frame)
140
+ # Basic Information
141
+ text_field(:nickname, :name=>"nicknameContainer:nickname", :frame=>frame)
142
+ # Contact Information
143
+ text_field(:email, :name=>"emailContainer:email", :frame=>frame)
144
+ text_field(:home_page, :name=>"homepageContainer:homepage", :frame=>frame)
145
+ text_field(:work_phone, :name=>"workphoneContainer:workphone", :frame=>frame)
146
+ text_field(:home_phone, :name=>"homephoneContainer:homephone", :frame=>frame)
147
+ text_field(:mobile_phone, :name=>"mobilephoneContainer:mobilephone", :frame=>frame)
148
+ text_field(:facsimile, :name=>"facsimileContainer:facsimile", :frame=>frame)
149
+ # Someday Staff Info fields should go here...
150
+
151
+ # Student Information
152
+ text_field(:degree_course, :name=>"courseContainer:course", :frame=>frame)
153
+ text_field(:subjects, :name=>"subjectsContainer:subjects", :frame=>frame)
154
+ # Social Networking
155
+
156
+ # Personal Information
157
+ text_area(:favorite_books, :name=>"booksContainer:favouriteBooks", :frame=>frame)
158
+ text_area(:favorite_tv_shows, :name=>"tvContainer:favouriteTvShows", :frame=>frame)
159
+ text_area(:favorite_movies, :name=>"moviesContainer:favouriteMovies", :frame=>frame)
160
+ text_area(:favorite_quotes, :name=>"quotesContainer:favouriteQuotes", :frame=>frame)
161
+ end
7
162
  end
8
163
 
9
164
  #
@@ -11,33 +166,187 @@ class Profile2Preferences
11
166
  include PageObject
12
167
  include ToolsMenu
13
168
  include Profile2Nav
14
- include Profile2PreferencesMethods
169
+
15
170
  end
16
171
 
17
172
  class Profile2Privacy
18
173
  include PageObject
19
174
  include ToolsMenu
20
175
  include Profile2Nav
21
- include Profile2PrivacyMethods
176
+ in_frame(:class=>"portletMainIframe") do |frame|
177
+
178
+ select_list(:profile_image, :name=>"profileImageContainer:profileImage", :frame=>frame)
179
+ select_list(:basic_info, :name=>"basicInfoContainer:basicInfo", :frame=>frame)
180
+ select_list(:contact_info, :name=>"contactInfoContainer:contactInfo", :frame=>frame)
181
+ select_list(:staff_info, :name=>"staffInfoContainer:staffInfo", :frame=>frame)
182
+ select_list(:student_info, :name=>"studentInfoContainer:studentInfo", :frame=>frame)
183
+ select_list(:social_info, :name=>"socialNetworkingInfoContainer:socialNetworkingInfo", :frame=>frame)
184
+ select_list(:personal_info, :name=>"personalInfoContainer:personalInfo", :frame=>frame)
185
+ select_list(:view_connections, :name=>"myFriendsContainer:myFriends", :frame=>frame)
186
+ select_list(:see_status, :name=>"myStatusContainer:myStatus", :frame=>frame)
187
+ select_list(:view_pictures, :name=>"myPicturesContainer:myPictures", :frame=>frame)
188
+ select_list(:send_messages, :name=>"messagesContainer:messages", :frame=>frame)
189
+ select_list(:see_kudos_rating, :name=>"myKudosContainer:myKudos", :frame=>frame)
190
+ checkbox(:show_birth_year, :name=>"birthYearContainer:birthYear", :frame=>frame)
191
+ button(:save_settings, :value=>"Save settings", :frame=>frame)
192
+
193
+ end
22
194
  end
23
195
 
24
196
  class Profile2Search
25
197
  include PageObject
26
198
  include ToolsMenu
27
199
  include Profile2Nav
28
- include Profile2SearchMethods
200
+ def search_by_name_or_email
201
+ frm.button(:value=>"Search by name or email").click
202
+ sleep 0.5
203
+ Profile2Search.new(@browser)
204
+ end
205
+
206
+ def search_by_common_interest
207
+ frm.button(:value=>"Search by common interest").click
208
+ sleep 0.5
209
+ Profile2Search.new(@browser)
210
+ end
211
+
212
+ def add_as_connection(name)
213
+ frm.div(:class=>"search-result", :text=>/#{Regexp.escape(name)}/).link(:class=>"icon connection-add").click
214
+ frm.div(:class=>"modalWindowButtons").wait_until_present
215
+ frm.div(:class=>"modalWindowButtons").button(:value=>"Add connection").click
216
+ frm.div(:class=>"modalWindowButtons").wait_while_present
217
+ sleep 0.5
218
+ Profile2Search.new @browser
219
+ end
220
+
221
+ def view(name)
222
+ frm.link(:text=>name).click
223
+ Profile2View.new(@browser)
224
+ end
225
+
226
+ # Returns an array containing strings of the names of the users returned
227
+ # in the search.
228
+ def results
229
+ results = []
230
+ frm.div(:class=>"portletBody").spans.each do |span|
231
+ if span.class_name == "search-result-info-name"
232
+ results << span.text
233
+ end
234
+ end
235
+ return results
236
+ end
237
+
238
+ def clear_results
239
+ frm.button(:value=>"Clear results").click
240
+ Profile2Search.new(@browser)
241
+ end
242
+
243
+ in_frame(:class=>"portletMainIframe") do |frame|
244
+ text_field(:persons_name_or_email, :name=>"searchName", :frame=>frame)
245
+ text_field(:common_interest, :name=>"searchInterest", :frame=>frame)
246
+
247
+ end
29
248
  end
30
249
 
31
250
  class Profile2Connections
32
251
  include PageObject
33
252
  include ToolsMenu
34
253
  include Profile2Nav
35
- include Profile2ConnectionsMethods
254
+ def confirm_request(name)
255
+ frm.div(:class=>"connection", :text=>name).link(:title=>"Confirm connection request").click
256
+ frm.div(:class=>"modalWindowButtons").wait_until_present
257
+ frm.div(:class=>"modalWindowButtons").button(:value=>"Confirm connection request").click
258
+ frm.div(:class=>"modalWindowButtons").wait_while_present
259
+ sleep 0.5
260
+ Profile2Connections.new @browser
261
+ end
262
+
263
+ # Returns an array containing the names of the connected users.
264
+ def connections
265
+ results = []
266
+ frm.div(:class=>"portletBody").spans.each do |span|
267
+ if span.class_name == "connection-info-name"
268
+ results << span.text
269
+ end
270
+ end
271
+ return results
272
+ end
273
+
274
+ in_frame(:class=>"portletMainIframe") do |frame|
275
+
276
+ end
36
277
  end
37
278
 
38
279
  class Profile2View
39
280
  include PageObject
40
281
  include ToolsMenu
41
282
  include Profile2Nav
42
- include Profile2ViewMethods
283
+ #
284
+ def connection
285
+ frm.div(:class=>"leftPanel").span(:class=>/instruction icon/).text
286
+ end
287
+
288
+ #
289
+ def basic_information
290
+ hash = {}
291
+ begin
292
+ frm.div(:class=>"mainSection", :text=>/Basic Information/).table(:class=>"profileContent").rows.each do |row|
293
+ hash.store(row[0].text, row[1].text)
294
+ end
295
+ rescue Watir::Exception::UnknownObjectException
296
+
297
+ end
298
+ return hash
299
+ end
300
+
301
+ #
302
+ def contact_information
303
+ hash = {}
304
+ begin
305
+ frm.div(:class=>"mainSection", :text=>/Contact Information/).table(:class=>"profileContent").rows.each do |row|
306
+ hash.store(row[0].text, row[1].text)
307
+ end
308
+ rescue Watir::Exception::UnknownObjectException
309
+
310
+ end
311
+ return hash
312
+ end
313
+
314
+ #
315
+ def staff_information
316
+ hash = {}
317
+ begin
318
+ frm.div(:class=>"mainSection", :text=>/Staff Information/).table(:class=>"profileContent").rows.each do |row|
319
+ hash.store(row[0].text, row[1].text)
320
+ end
321
+ rescue Watir::Exception::UnknownObjectException
322
+
323
+ end
324
+ return hash
325
+ end
326
+
327
+ #
328
+ def student_information
329
+ hash = {}
330
+ begin
331
+ frm.div(:class=>"mainSection", :text=>/Student Information/).table(:class=>"profileContent").rows.each do |row|
332
+ hash.store(row[0].text, row[1].text)
333
+ end
334
+ rescue Watir::Exception::UnknownObjectException
335
+
336
+ end
337
+ return hash
338
+ end
339
+
340
+ #
341
+ def personal_information
342
+ hash = {}
343
+ begin
344
+ frm.div(:class=>"mainSection", :text=>/Personal Information/).table(:class=>"profileContent").rows.each do |row|
345
+ hash.store(row[0].text, row[1].text)
346
+ end
347
+ rescue Watir::Exception::UnknownObjectException
348
+
349
+ end
350
+ return hash
351
+ end
43
352
  end