sakai-cle-test-api 0.0.9 → 0.0.75

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. data/lib/sakai-cle-test-api.rb +2 -7
  2. data/lib/sakai-cle-test-api/admin_page_elements.rb +2 -6
  3. data/lib/sakai-cle-test-api/announcements.rb +7 -274
  4. data/lib/sakai-cle-test-api/assessments.rb +27 -930
  5. data/lib/sakai-cle-test-api/assignments.rb +13 -769
  6. data/lib/sakai-cle-test-api/basic_lti.rb +1 -5
  7. data/lib/sakai-cle-test-api/blogs.rb +2 -54
  8. data/lib/sakai-cle-test-api/calendar.rb +8 -423
  9. data/lib/sakai-cle-test-api/common_page_elements.rb +172 -69
  10. data/lib/sakai-cle-test-api/drop_box.rb +0 -21
  11. data/lib/sakai-cle-test-api/email_archive.rb +1 -15
  12. data/lib/sakai-cle-test-api/forums.rb +8 -282
  13. data/lib/sakai-cle-test-api/gradebook.rb +1 -19
  14. data/lib/sakai-cle-test-api/gradebook2.rb +1 -15
  15. data/lib/sakai-cle-test-api/messages.rb +15 -551
  16. data/lib/sakai-cle-test-api/news.rb +1 -3
  17. data/lib/sakai-cle-test-api/polls.rb +3 -65
  18. data/lib/sakai-cle-test-api/profile.rb +2 -36
  19. data/lib/sakai-cle-test-api/profile2.rb +6 -315
  20. data/lib/sakai-cle-test-api/sections.rb +8 -198
  21. data/lib/sakai-cle-test-api/site_page_elements.rb +441 -4
  22. data/lib/sakai-cle-test-api/syllabus.rb +7 -149
  23. data/lib/sakai-cle-test-api/tools_menu.rb +20 -3
  24. data/lib/sakai-cle-test-api/utilities.rb +0 -260
  25. data/sakai-cle-test-api.gemspec +3 -2
  26. metadata +19 -21
  27. data/lib/sakai-cle-test-api/add_files.rb +0 -198
  28. data/lib/sakai-cle-test-api/chat_room.rb +0 -0
  29. data/lib/sakai-cle-test-api/core-ext.rb +0 -90
  30. data/lib/sakai-cle-test-api/data_objects/announcement.rb +0 -38
  31. data/lib/sakai-cle-test-api/data_objects/assessment.rb +0 -32
  32. data/lib/sakai-cle-test-api/data_objects/assignment.rb +0 -62
  33. data/lib/sakai-cle-test-api/data_objects/event.rb +0 -86
  34. data/lib/sakai-cle-test-api/data_objects/lesson.rb +0 -137
  35. data/lib/sakai-cle-test-api/data_objects/resource.rb +0 -174
  36. data/lib/sakai-cle-test-api/data_objects/site.rb +0 -213
  37. data/lib/sakai-cle-test-api/data_objects/syllabus.rb +0 -7
  38. data/lib/sakai-cle-test-api/data_objects/topic.rb +0 -0
  39. data/lib/sakai-cle-test-api/data_objects/web_content_tool.rb +0 -52
  40. data/lib/sakai-cle-test-api/data_objects/wiki.rb +0 -7
  41. data/lib/sakai-cle-test-api/gem_ext.rb +0 -45
  42. data/lib/sakai-cle-test-api/lessons.rb +0 -440
  43. data/lib/sakai-cle-test-api/resources.rb +0 -138
  44. data/lib/sakai-cle-test-api/rich_text.rb +0 -13
@@ -5,7 +5,5 @@
5
5
  class News
6
6
  include PageObject
7
7
  include ToolsMenu
8
- in_frame(:class=>"portletMainIframe") do |frame|
9
-
10
- end
8
+ include NewsMethods
11
9
  end
@@ -6,81 +6,19 @@
6
6
  class Polls
7
7
  include PageObject
8
8
  include ToolsMenu
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
9
+ include PollsMethods
41
10
  end
42
11
 
43
12
  #
44
13
  class AddEditPoll
45
14
  include PageObject
46
15
  include ToolsMenu
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
-
16
+ include AddEditPollMethods
67
17
  end
68
18
 
69
19
  #
70
20
  class AddAnOption
71
21
  include PageObject
72
22
  include ToolsMenu
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
23
+ include AddAnOptionMethods
86
24
  end
@@ -6,46 +6,12 @@
6
6
  class Profile
7
7
  include PageObject
8
8
  include ToolsMenu
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
9
+ include ProfileMethods
27
10
  end
28
11
 
29
12
  #
30
13
  class EditProfile
31
14
  include PageObject
32
15
  include ToolsMenu
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
16
+ include EditProfileMethods
51
17
  end
@@ -1,164 +1,9 @@
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
39
1
  #
40
2
  class Profile2
41
3
  include PageObject
42
4
  include ToolsMenu
43
5
  include Profile2Nav
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
6
+ include Profile2Methods
162
7
  end
163
8
 
164
9
  #
@@ -166,187 +11,33 @@ class Profile2Preferences
166
11
  include PageObject
167
12
  include ToolsMenu
168
13
  include Profile2Nav
169
-
14
+ include Profile2PreferencesMethods
170
15
  end
171
16
 
172
17
  class Profile2Privacy
173
18
  include PageObject
174
19
  include ToolsMenu
175
20
  include Profile2Nav
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
21
+ include Profile2PrivacyMethods
194
22
  end
195
23
 
196
24
  class Profile2Search
197
25
  include PageObject
198
26
  include ToolsMenu
199
27
  include Profile2Nav
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
28
+ include Profile2SearchMethods
248
29
  end
249
30
 
250
31
  class Profile2Connections
251
32
  include PageObject
252
33
  include ToolsMenu
253
34
  include Profile2Nav
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
35
+ include Profile2ConnectionsMethods
277
36
  end
278
37
 
279
38
  class Profile2View
280
39
  include PageObject
281
40
  include ToolsMenu
282
41
  include Profile2Nav
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
42
+ include Profile2ViewMethods
352
43
  end