sakai-cle-test-api 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. data/README.md +2 -5
  2. data/lib/sakai-cle-test-api.rb +4 -8
  3. data/lib/sakai-cle-test-api/admin_page_elements.rb +1 -433
  4. data/lib/sakai-cle-test-api/announcements.rb +59 -0
  5. data/lib/sakai-cle-test-api/assessments.rb +194 -0
  6. data/lib/sakai-cle-test-api/assignments.rb +113 -0
  7. data/lib/sakai-cle-test-api/basic_lti.rb +5 -0
  8. data/lib/sakai-cle-test-api/blogs.rb +5 -0
  9. data/lib/sakai-cle-test-api/calendar.rb +65 -0
  10. data/lib/sakai-cle-test-api/calendar_summary.rb +0 -0
  11. data/lib/sakai-cle-test-api/common_page_elements.rb +1 -817
  12. data/lib/sakai-cle-test-api/drop_box.rb +0 -0
  13. data/lib/sakai-cle-test-api/email_archive.rb +10 -0
  14. data/lib/sakai-cle-test-api/forums.rb +39 -0
  15. data/lib/sakai-cle-test-api/gradebook.rb +10 -0
  16. data/lib/sakai-cle-test-api/gradebook2.rb +6 -0
  17. data/lib/sakai-cle-test-api/messages.rb +119 -0
  18. data/lib/sakai-cle-test-api/news.rb +9 -0
  19. data/lib/sakai-cle-test-api/polls.rb +24 -0
  20. data/lib/sakai-cle-test-api/post_em.rb +0 -0
  21. data/lib/sakai-cle-test-api/profile.rb +17 -0
  22. data/lib/sakai-cle-test-api/profile2.rb +43 -0
  23. data/lib/sakai-cle-test-api/resources_roster.rb +0 -0
  24. data/lib/sakai-cle-test-api/rwiki.rb +0 -0
  25. data/lib/sakai-cle-test-api/sections.rb +43 -0
  26. data/lib/sakai-cle-test-api/single_user.rb +0 -0
  27. data/lib/sakai-cle-test-api/site_page_elements.rb +1236 -5017
  28. data/lib/sakai-cle-test-api/site_statistics.rb +0 -0
  29. data/lib/sakai-cle-test-api/syllabus.rb +77 -0
  30. data/lib/sakai-cle-test-api/tools_menu.rb +415 -0
  31. data/sakai-cle-test-api.gemspec +2 -2
  32. metadata +30 -6
  33. data/lib/sakai-cle-test-api/app_functions.rb +0 -753
data/README.md CHANGED
@@ -38,9 +38,6 @@ For much more extensive examples of using this API, please see the CLE Cucumber
38
38
  ## Contribute
39
39
 
40
40
  * Fork the project.
41
- * Test drive your feature addition or bug fix. Adding specs is important and I will not accept a pull request that does not have tests.
42
- * Make sure you describe your new feature with a cucumber scenario.
43
- * Make sure you provide RDoc comments for any new public method you add. Remember, others will be using this gem.
44
- * Commit, do not mess with Rakefile, version, or ChangeLog.
45
- (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
41
+ * Additional or bug-fixed Classes, Elements, or Methods should be demonstrated in accompanying tests. Pull requests that do not include test scripts that use the new code won't be accepted.
42
+ * Make sure you provide RDoc comments for any new public method or page class you add. Remember, others will be using this gem.
46
43
  * Send me a pull request. Bonus points for topic branches.
@@ -1,13 +1,9 @@
1
- require 'kuali-sakai-common-lib'
2
- require 'watir-webdriver'
3
- require 'page-object'
4
1
  require 'cgi'
5
-
6
- require 'sakai-cle-test-api/app_functions'
7
- require 'sakai-cle-test-api/admin_page_elements'
8
- require 'sakai-cle-test-api/common_page_elements'
9
- require 'sakai-cle-test-api/site_page_elements'
2
+ require 'kuali-sakai-common-lib'
10
3
  require 'sakai-cle-test-api/utilities'
4
+ require 'sakai-cle-test-api/tools_menu'
5
+ require 'sakai-cle-test-api/admin_page_elements'
6
+ Dir["#{File.dirname(__FILE__)}/sakai-cle-test-api/*.rb"].each {|f| require f }
11
7
 
12
8
  # Initialize this class at the start of your test cases to
13
9
  # open the specified test browser at the specified Sakai welcome page URL.
@@ -32,7 +32,7 @@
32
32
 
33
33
  # The Aliases page - "icon-sakai-aliases", found in the Administration Workspace
34
34
  class Aliases
35
-
35
+
36
36
  include PageObject
37
37
  include ToolsMenu
38
38
 
@@ -104,7 +104,6 @@ class Login
104
104
  frame.text_field(:id, "eid").set username
105
105
  frame.text_field(:id, "pw").set password
106
106
  frame.form(:method, "post").submit
107
- $frame_index=0
108
107
  MyWorkspace.new(@browser)
109
108
  end
110
109
  alias log_in login
@@ -174,440 +173,9 @@ class SiteSummaryPage
174
173
  end
175
174
 
176
175
 
177
- #================
178
- # Profile Pages
179
- #================
180
-
181
- #
182
- class Profile
183
-
184
- include PageObject
185
- include ToolsMenu
186
-
187
- def edit_my_profile
188
- frm.link(:text=>"Edit my Profile").click
189
- EditProfile.new(@browser)
190
- end
191
-
192
- def show_my_profile
193
- frm.link(:text=>"Show my Profile").click
194
- Profile.new @browser
195
- end
196
-
197
- def photo
198
- source = frm.image(:id=>"profileForm:image1").src
199
- return source.split("/")[-1]
200
- end
201
-
202
- def email
203
- frm.link(:id=>"profileForm:email").text
204
- end
205
-
206
- end
207
-
208
- #
209
- class EditProfile
210
-
211
- include PageObject
212
- include ToolsMenu
213
-
214
- def save
215
- frm.button(:value=>"Save").click
216
- Profile.new(@browser)
217
- end
218
-
219
- def picture_file(filename, filepath="")
220
- frm.file_field(:name=>"editProfileForm:uploadFile.uploadId").set(filepath + filename)
221
- end
222
-
223
- in_frame(:class=>"portletMainIframe") do |frame|
224
- text_field(:first_name, :id=>"editProfileForm:first_name", :frame=>frame)
225
- text_field(:last_name, :id=>"editProfileForm:lname", :frame=>frame)
226
- text_field(:nickname, :id=>"editProfileForm:nickname", :frame=>frame)
227
- text_field(:position, :id=>"editProfileForm:position", :frame=>frame)
228
- text_field(:email, :id=>"editProfileForm:email", :frame=>frame)
229
- radio_button(:upload_new_picture, :value=>"pictureUpload", :frame=>frame)
230
- end
231
- end
232
-
233
-
234
- #================
235
- # Profile2 Pages
236
- #================
237
-
238
- module Profile2Nav
239
-
240
- def preferences
241
- frm.link(:class=>"icon preferences").click
242
- Profile2Preferences.new @browser
243
- end
244
-
245
- def privacy
246
- frm.link(:text=>"Privacy").click
247
- Profile2Privacy.new @browser
248
- end
249
-
250
- def my_profile
251
- frm.link(:text=>"My profile").click
252
- Profile2.new(@browser)
253
- end
254
-
255
- def connections
256
- frm.link(:class=>"icon connections").click
257
- Profile2Connections.new @browser
258
- end
259
-
260
- def pictures
261
- frm.link(:text=>"Pictures").click
262
- Profile2Pictures.new @browser
263
- end
264
-
265
- def messages
266
- frm.link(:text=>"Messages").click
267
- Profile2Messages.new @browser
268
- end
269
-
270
- def search_for_connections
271
- frm.link(:class=>"icon search").click
272
- Profile2Search.new @browser
273
- end
274
-
275
- end
276
-
277
- #
278
- class Profile2
279
-
280
- include PageObject
281
- include ToolsMenu
282
- include Profile2Nav
283
-
284
- def edit_basic_info
285
- frm.div(:id=>"mainPanel").span(:text=>"Basic Information").fire_event("onmouseover")
286
- frm.div(:id=>"mainPanel").link(:href=>/myInfo:editButton/).click
287
- sleep 0.5
288
- Profile2.new @browser
289
- end
290
-
291
- def edit_contact_info
292
- frm.div(:id=>"mainPanel").span(:text=>"Contact Information").fire_event("onmouseover")
293
- frm.div(:id=>"mainPanel").link(:href=>/myContact:editButton/).click
294
- sleep 0.5
295
- Profile2.new @browser
296
- end
297
-
298
- def edit_staff_info
299
- frm.div(:id=>"mainPanel").span(:text=>"Staff Information").fire_event("onmouseover")
300
- frm.div(:id=>"mainPanel").link(:href=>/myStaff:editButton/).click
301
- sleep 0.5
302
- Profile2.new @browser
303
- end
304
-
305
- def edit_student_info
306
- frm.div(:id=>"mainPanel").span(:text=>"Student Information").fire_event("onmouseover")
307
- frm.div(:id=>"mainPanel").link(:href=>/myStudent:editButton/).click
308
- sleep 0.5
309
- Profile2.new @browser
310
- end
311
-
312
- def edit_social_networking
313
- frm.div(:id=>"mainPanel").span(:text=>"Social Networking").fire_event("onmouseover")
314
- frm.div(:id=>"mainPanel").link(:href=>/mySocialNetworking:editButton/).click
315
- sleep 0.5
316
- Profile2.new @browser
317
- end
318
-
319
- def edit_personal_info
320
- frm.div(:id=>"mainPanel").span(:text=>"Personal Information").fire_event("onmouseover")
321
- frm.div(:id=>"mainPanel").link(:href=>/myInterests:editButton/).click
322
- sleep 0.5
323
- Profile2.new @browser
324
- end
325
-
326
- def change_picture
327
- frm.div(:id=>"myPhoto").fire_event("onmouseover")
328
- frm.div(:id=>"myPhoto").link(:class=>"edit-image-button").click
329
- sleep 0.5
330
- Profile2.new @browser
331
- end
332
-
333
- # Enters the specified filename in the file field.
334
- #
335
- # Note that the file should be inside the data/sakai-cle-test-api folder.
336
- # The file or folder name used for the filename variable
337
- # should not include a preceding slash ("/") character.
338
- def image_file=(filename)
339
- frm.file_field(:name=>"picture").set(File.expand_path(File.dirname(__FILE__)) + "/../../data/sakai-cle-test-api/" + filename)
340
- end
341
-
342
- def upload
343
- frm.button(:value=>"Upload").click
344
- sleep 0.5
345
- Profile2.new @browser
346
- end
347
-
348
- def personal_summary=(text)
349
- frm.frame(:id=>"id1a_ifr").send_keys([:command, 'a'], :backspace)
350
- frm.frame(:id=>"id1a_ifr").send_keys(text)
351
- end
352
-
353
- def birthday(day, month, year)
354
- frm.text_field(:name=>"birthdayContainer:birthday").click
355
- frm.select(:class=>"ui-datepicker-new-year").wait_until_present
356
- frm.select(:class=>"ui-datepicker-new-year").select(year.to_i)
357
- frm.select(:class=>"ui-datepicker-new-month").select(month)
358
- frm.link(:text=>day.to_s).click
359
- end
360
-
361
- def save_changes
362
- frm.button(:value=>"Save changes").click
363
- Profile2.new @browser
364
- end
365
-
366
- # Returns the number (as a string) displayed next to
367
- # the "Connections" link in the menu. If there are no
368
- # connections then returns zero as a string object.
369
- def connection_requests
370
- begin
371
- frm.link(:class=>/icon connections/).span(:class=>"new-items-count").text
372
- rescue
373
- return "0"
374
- end
375
- end
376
-
377
- in_frame(:class=>"portletMainIframe") do |frame|
378
- text_field(:say_something, :id=>"id1", :frame=>frame)
379
- button(:say_it, :value=>"Say it", :frame=>frame)
380
- # Basic Information
381
- text_field(:nickname, :name=>"nicknameContainer:nickname", :frame=>frame)
382
- # Contact Information
383
- text_field(:email, :name=>"emailContainer:email", :frame=>frame)
384
- text_field(:home_page, :name=>"homepageContainer:homepage", :frame=>frame)
385
- text_field(:work_phone, :name=>"workphoneContainer:workphone", :frame=>frame)
386
- text_field(:home_phone, :name=>"homephoneContainer:homephone", :frame=>frame)
387
- text_field(:mobile_phone, :name=>"mobilephoneContainer:mobilephone", :frame=>frame)
388
- text_field(:facsimile, :name=>"facsimileContainer:facsimile", :frame=>frame)
389
- # Someday Staff Info fields should go here...
390
-
391
- # Student Information
392
- text_field(:degree_course, :name=>"courseContainer:course", :frame=>frame)
393
- text_field(:subjects, :name=>"subjectsContainer:subjects", :frame=>frame)
394
- # Social Networking
395
-
396
- # Personal Information
397
- text_area(:favorite_books, :name=>"booksContainer:favouriteBooks", :frame=>frame)
398
- text_area(:favorite_tv_shows, :name=>"tvContainer:favouriteTvShows", :frame=>frame)
399
- text_area(:favorite_movies, :name=>"moviesContainer:favouriteMovies", :frame=>frame)
400
- text_area(:favorite_quotes, :name=>"quotesContainer:favouriteQuotes", :frame=>frame)
401
- end
402
- end
403
-
404
- #
405
- class Profile2Preferences
406
-
407
- include PageObject
408
- include ToolsMenu
409
- include Profile2Nav
410
-
411
- def save_settings
412
- frm.button(:value=>"Save settings").click
413
- Profile2Preferences.new(@browser)
414
- end
415
-
416
- in_frame(:class=>"portletMainIframe") do |frame|
417
-
418
- end
419
- end
420
-
421
- #
422
- class Profile2Privacy
423
-
424
- include PageObject
425
- include ToolsMenu
426
- include Profile2Nav
427
-
428
- in_frame(:class=>"portletMainIframe") do |frame|
429
- select_list(:profile_image, :name=>"profileImageContainer:profileImage", :frame=>frame)
430
- select_list(:basic_info, :name=>"basicInfoContainer:basicInfo", :frame=>frame)
431
- select_list(:contact_info, :name=>"contactInfoContainer:contactInfo", :frame=>frame)
432
- select_list(:staff_info, :name=>"staffInfoContainer:staffInfo", :frame=>frame)
433
- select_list(:student_info, :name=>"studentInfoContainer:studentInfo", :frame=>frame)
434
- select_list(:social_info, :name=>"socialNetworkingInfoContainer:socialNetworkingInfo", :frame=>frame)
435
- select_list(:personal_info, :name=>"personalInfoContainer:personalInfo", :frame=>frame)
436
- select_list(:view_connections, :name=>"myFriendsContainer:myFriends", :frame=>frame)
437
- select_list(:see_status, :name=>"myStatusContainer:myStatus", :frame=>frame)
438
- select_list(:view_pictures, :name=>"myPicturesContainer:myPictures", :frame=>frame)
439
- select_list(:send_messages, :name=>"messagesContainer:messages", :frame=>frame)
440
- select_list(:see_kudos_rating, :name=>"myKudosContainer:myKudos", :frame=>frame)
441
- checkbox(:show_birth_year, :name=>"birthYearContainer:birthYear", :frame=>frame)
442
- button(:save_settings, :value=>"Save settings", :frame=>frame)
443
- end
444
- end
445
-
446
- #
447
- class Profile2Search
448
-
449
- include PageObject
450
- include ToolsMenu
451
-
452
- def search_by_name_or_email
453
- frm.button(:value=>"Search by name or email").click
454
- sleep 0.5
455
- Profile2Search.new(@browser)
456
- end
457
-
458
- def search_by_common_interest
459
- frm.button(:value=>"Search by common interest").click
460
- sleep 0.5
461
- Profile2Search.new(@browser)
462
- end
463
-
464
- def add_as_connection(name)
465
- frm.div(:class=>"search-result", :text=>/#{Regexp.escape(name)}/).link(:class=>"icon connection-add").click
466
- frm.div(:class=>"modalWindowButtons").wait_until_present
467
- frm.div(:class=>"modalWindowButtons").button(:value=>"Add connection").click
468
- frm.div(:class=>"modalWindowButtons").wait_while_present
469
- sleep 0.5
470
- Profile2Search.new @browser
471
- end
472
-
473
- def view(name)
474
- frm.link(:text=>name).click
475
- Profile2View.new(@browser)
476
- end
477
-
478
- # Returns an array containing strings of the names of the users returned
479
- # in the search.
480
- def results
481
- results = []
482
- frm.div(:class=>"portletBody").spans.each do |span|
483
- if span.class_name == "search-result-info-name"
484
- results << span.text
485
- end
486
- end
487
- return results
488
- end
489
-
490
- def clear_results
491
- frm.button(:value=>"Clear results").click
492
- Profile2Search.new(@browser)
493
- end
494
-
495
- in_frame(:class=>"portletMainIframe") do |frame|
496
- text_field(:persons_name_or_email, :name=>"searchName", :frame=>frame)
497
- text_field(:common_interest, :name=>"searchInterest", :frame=>frame)
498
- end
499
- end
500
-
501
- #
502
- class Profile2Connections
503
-
504
- include PageObject
505
- include ToolsMenu
506
- include Profile2Nav
507
-
508
- def confirm_request(name)
509
- frm.div(:class=>"connection", :text=>name).link(:title=>"Confirm connection request").click
510
- frm.div(:class=>"modalWindowButtons").wait_until_present
511
- frm.div(:class=>"modalWindowButtons").button(:value=>"Confirm connection request").click
512
- frm.div(:class=>"modalWindowButtons").wait_while_present
513
- sleep 0.5
514
- Profile2Connections.new @browser
515
- end
516
-
517
- # Returns an array containing the names of the connected users.
518
- def connections
519
- results = []
520
- frm.div(:class=>"portletBody").spans.each do |span|
521
- if span.class_name == "connection-info-name"
522
- results << span.text
523
- end
524
- end
525
- return results
526
- end
527
-
528
- in_frame(:class=>"portletMainIframe") do |frame|
529
-
530
- end
531
- end
532
-
533
- #
534
- class Profile2View
535
-
536
- include PageObject
537
- include ToolsMenu
538
- include Profile2Nav
539
-
540
- #
541
- def connection
542
- frm.div(:class=>"leftPanel").span(:class=>/instruction icon/).text
543
- end
544
-
545
- #
546
- def basic_information
547
- hash = {}
548
- begin
549
- frm.div(:class=>"mainSection", :text=>/Basic Information/).table(:class=>"profileContent").rows.each do |row|
550
- hash.store(row[0].text, row[1].text)
551
- end
552
- rescue Watir::Exception::UnknownObjectException
553
-
554
- end
555
- return hash
556
- end
557
-
558
- #
559
- def contact_information
560
- hash = {}
561
- begin
562
- frm.div(:class=>"mainSection", :text=>/Contact Information/).table(:class=>"profileContent").rows.each do |row|
563
- hash.store(row[0].text, row[1].text)
564
- end
565
- rescue Watir::Exception::UnknownObjectException
566
-
567
- end
568
- return hash
569
- end
570
-
571
- #
572
- def staff_information
573
- hash = {}
574
- begin
575
- frm.div(:class=>"mainSection", :text=>/Staff Information/).table(:class=>"profileContent").rows.each do |row|
576
- hash.store(row[0].text, row[1].text)
577
- end
578
- rescue Watir::Exception::UnknownObjectException
579
-
580
- end
581
- return hash
582
- end
583
176
 
584
- #
585
- def student_information
586
- hash = {}
587
- begin
588
- frm.div(:class=>"mainSection", :text=>/Student Information/).table(:class=>"profileContent").rows.each do |row|
589
- hash.store(row[0].text, row[1].text)
590
- end
591
- rescue Watir::Exception::UnknownObjectException
592
-
593
- end
594
- return hash
595
- end
596
177
 
597
- #
598
- def personal_information
599
- hash = {}
600
- begin
601
- frm.div(:class=>"mainSection", :text=>/Personal Information/).table(:class=>"profileContent").rows.each do |row|
602
- hash.store(row[0].text, row[1].text)
603
- end
604
- rescue Watir::Exception::UnknownObjectException
605
-
606
- end
607
- return hash
608
- end
609
178
 
610
- end
611
179
 
612
180
 
613
181