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
data/README.md ADDED
@@ -0,0 +1,4 @@
1
+ sambal-cle
2
+ ==========
3
+
4
+ Open source test automation framework for Sakai CLE
@@ -0,0 +1,20 @@
1
+ class BasePage < PageMaker
2
+
3
+ class << self
4
+
5
+ def frame_element
6
+ element(:frm) { |b| b.frame(:class=>"portletMainIframe") }
7
+ end
8
+
9
+ def basic_page_elements
10
+ # Returns the text of the error message box
11
+ value(:alert_box) { |b| b.frm.div(:class=>"alertMessage").text }
12
+ # Returns the text of the header.
13
+ value(:header) { |b| b.frm.div(:class=>"portletBody").h3.text }
14
+ end
15
+
16
+ # More element group defs go here...
17
+
18
+ end
19
+
20
+ end
@@ -0,0 +1,90 @@
1
+ class Time
2
+
3
+ # Using the :year_range option (or no option), this method creates a
4
+ # Time object of a random value, within
5
+ # the year range specified (default is 5 years in the past).
6
+ #
7
+ # Using the :series option, this method returns an array
8
+ # containing a randomized Time object as its first element (limited by
9
+ # the specified :year_range value). Subsequent elements will be Time objects
10
+ # with values putting them later than the prior element, within the specified
11
+ # range value (see examples).
12
+ #
13
+ # Usage Examples:
14
+ # @example
15
+ # a random date...
16
+ # ?> Time.random
17
+ # => Tue Aug 05 00:00:00 EDT 2007
18
+ #
19
+ # birthdays, anyone?...
20
+ # 5.times { p Time.random(:year_range=>80) }
21
+ # Wed Feb 06 00:00:00 EDT 1974
22
+ # Tue Dec 22 00:00:00 EST 1992
23
+ # Fri Apr 14 00:00:00 EWT 1944
24
+ # Thu Jul 01 00:00:00 EDT 1993
25
+ # Wed Oct 02 00:00:00 EDT 2002
26
+ #
27
+ # A series of dates are useful for account-related info...
28
+ # ?> Time.random(:series=>[20.days, 3.years])
29
+ # => [Sat Jan 22 00:00:00 EST 2005,
30
+ # Sat Jan 29 12:58:45 EST 2005,
31
+ # Fri Sep 08 09:34:58 EDT 2006]
32
+ #
33
+ # or maybe to simulate events during an hour?...
34
+ # ?> Time.random(:series=>[1.hour,1.hour,1.hour])
35
+ # => [Wed Apr 21 00:00:00 EDT 2004,
36
+ # Wed Apr 21 00:45:59 EDT 2004,
37
+ # Wed Apr 21 01:02:47 EDT 2004,
38
+ # Wed Apr 21 01:31:00 EDT 2004]
39
+ def self.random(params={})
40
+ years_back = params[:year_range] || 5
41
+ year = (rand * (years_back)).ceil + (Time.now.year - years_back)
42
+ month = (rand * 12).ceil
43
+ day = (rand * 31).ceil
44
+ series = [date = Time.local(year, month, day)]
45
+ if params[:series]
46
+ params[:series].each do |some_time_after|
47
+ series << series.last + (rand * some_time_after).ceil
48
+ end
49
+ return series
50
+ end
51
+ date
52
+ end
53
+
54
+ end # Time
55
+
56
+ module Enumerable
57
+
58
+ # Use for getting a natural sort order instead of the ASCII
59
+ # sort order.
60
+ def alphabetize
61
+ sort { |a, b| grouped_compare(a, b) }
62
+ end
63
+
64
+ # Use for sorting an Enumerable object in place.
65
+ def alphabetize!
66
+ sort! { |a, b| grouped_compare(a, b) }
67
+ end
68
+
69
+ private
70
+ def grouped_compare(a, b)
71
+ loop {
72
+ a_chunk, a = extract_alpha_or_number_group(a)
73
+ b_chunk, b = extract_alpha_or_number_group(b)
74
+ ret = a_chunk <=> b_chunk
75
+ return -1 if a_chunk == ''
76
+ return ret if ret != 0
77
+ }
78
+ end
79
+
80
+ def extract_alpha_or_number_group(item)
81
+ test_item = item.downcase
82
+ matchdata = /([a-z]+|[\d]+)/.match(test_item)
83
+ if matchdata.nil?
84
+ ["", ""]
85
+ else
86
+ [matchdata[0], test_item = test_item[matchdata.offset(0)[1] .. -1]]
87
+ end
88
+ end
89
+
90
+ end # Enumerable
@@ -0,0 +1,82 @@
1
+ class AnnouncementObject
2
+
3
+ include Utilities
4
+ include PageHelper
5
+ include Workflows
6
+
7
+ attr_accessor :title, :body, :site, :link, :access, :availability,
8
+ :subject, :saved_by, :date, :creation_date, :groups,
9
+ :message, :message_html, :id
10
+
11
+ def initialize(browser, opts={})
12
+ @browser = browser
13
+
14
+ defaults = {
15
+ :title=>random_alphanums,
16
+ :body=>random_multiline(500, 10, :alpha)
17
+ }
18
+ options = defaults.merge(opts)
19
+ @title=options[:title]
20
+ @body=options[:body]
21
+ @site=options[:site]
22
+ raise "You must specify a Site for the announcement" if @site==nil
23
+ end
24
+
25
+ alias :name :title
26
+
27
+ def create
28
+ open_my_site_by_name @site unless @browser.title=~/#{@site}/
29
+ announcements unless @browser.title=~/Announcements$/
30
+ on_page Announcements do |page|
31
+ page.add
32
+ end
33
+ on_page AddEditAnnouncements do |page|
34
+ page.title.set @title
35
+ page.enter_source_text page.editor, @body
36
+ page.add_announcement
37
+ @creation_date=make_date Time.now
38
+ end
39
+ on_page Announcements do |page|
40
+ @link = page.href(@title)
41
+ @id = @link[/(?<=msg\/).+(?=\/main\/)/]
42
+ end
43
+ end
44
+
45
+ def edit opts={}
46
+ open_my_site_by_name @site unless @browser.title=~/#{@site}/
47
+ announcements unless @browser.title=~/Announcements$/
48
+ on_page Announcements do |list|
49
+ list.edit @title
50
+ end
51
+ on AddEditAnnouncements do |edit|
52
+ edit.title.set opts[:title] unless opts[:title]==nil
53
+ edit.send(opts[:access]) unless opts[:access]==nil
54
+ edit.send(opts[:availability]) unless opts[:availability]==nil
55
+ unless opts[:body]==nil
56
+ edit.enter_source_text edit.editor, opts[:body]
57
+ end
58
+ edit.save_changes
59
+ end
60
+ @title=opts[:title] unless opts[:title]==nil
61
+ @body=opts[:body] unless opts[:body]==nil
62
+ @access=opts[:access]
63
+ @availability=opts[:availability]
64
+ end
65
+
66
+ def view
67
+ open_my_site_by_name @site unless @browser.title=~/#{@site}/
68
+ announcements unless @browser.title=~/Announcements$/
69
+ on Announcements do |list|
70
+ list.view @title
71
+ end
72
+ on ViewAnnouncement do |view|
73
+ @subject=view.subject
74
+ @saved_by=view.saved_by
75
+ @date=view.date
76
+ @groups=view.groups
77
+ @message=view.message
78
+ @message_html=view.message_html
79
+ end
80
+ end
81
+
82
+ end
@@ -0,0 +1,32 @@
1
+ class AssessmentObject
2
+
3
+ include PageHelper
4
+ include Utilities
5
+ include Workflows
6
+
7
+ attr_accessor :title, :site
8
+
9
+ def initialize(browser, opts={})
10
+ @browser = browser
11
+
12
+ defaults = {
13
+ :title=>random_alphanums,
14
+ :site=>"placeholder"
15
+ }
16
+ options = defaults.merge(opts)
17
+ @title=options[:title]
18
+ @site=options[:site]
19
+ raise "You must specify a Site for your Assessment" if @site==nil
20
+ end
21
+
22
+ def create
23
+ my_workspace.open_my_site_by_name @site unless @browser.title=~/#{@site}/
24
+ tests_and_quizzes unless @browser.title=~/Tests & Quizzes$/
25
+ on_page AssessmentsList do |page|
26
+ page.title.set @title
27
+ page.create
28
+ end
29
+ # Do more here eventually...
30
+ end
31
+
32
+ end
@@ -0,0 +1,205 @@
1
+ class AssignmentObject
2
+
3
+ include PageHelper
4
+ include Utilities
5
+ include Randomizers
6
+ include DateMakers
7
+ include Workflows
8
+
9
+ attr_accessor :title, :site, :instructions, :id, :link, :status, :grade_scale,
10
+ :max_points, :allow_resubmission, :num_resubmissions, :open,
11
+ :due, :accept_until, :student_submissions, :resubmission,
12
+ :add_due_date, :add_open_announcement, :add_to_gradebook,
13
+ # Note the following variables are taken from the Entity picker's
14
+ # Item Info list
15
+ :retract_time, :time_due, :time_modified, :url, :portal_url,
16
+ :description, :time_created, :direct_url
17
+
18
+ def initialize(browser, opts={})
19
+ @browser = browser
20
+
21
+ defaults = {
22
+ :title=>random_alphanums,
23
+ :instructions=>random_multiline(250, 10, :string),
24
+ :resubmission=>{},
25
+ :open=>{},
26
+ :due=>{},
27
+ :accept_until=>{}
28
+ }
29
+ options = defaults.merge(opts)
30
+
31
+ @title=options[:title]
32
+ @instructions=options[:instructions]
33
+ @site=options[:site]
34
+ @grade_scale=options[:grade_scale]
35
+ @max_points=options[:max_points]
36
+ @allow_resubmission=options[:allow_resubmission]
37
+ @num_resubmissions=options[:num_resubmissions]
38
+ @open=options[:open]
39
+ @due=options[:due]
40
+ @accept_until=options[:accept_until]
41
+ @resubmission=options[:resubmission]
42
+ @student_submissions=options[:student_submissions]
43
+ @add_due_date=options[:add_due_date]
44
+ @add_open_announcement=options[:add_open_announcement]
45
+ @add_to_gradebook=options[:add_to_gradebook]
46
+ @status=options[:status]
47
+ raise "You must specify a Site for your Assignment" if @site==nil
48
+ raise "You must specify max points if your grade scale is 'points'" if @max_points==nil && @grade_scale=="Points"
49
+ end
50
+
51
+ alias :name :title
52
+
53
+ def create
54
+ open_my_site_by_name @site unless @browser.title=~/#{@site}/
55
+
56
+ # Go to assignments page
57
+ assignments unless @browser.title=~/Assignments$/
58
+
59
+ on_page AssignmentsList do |list|
60
+ list.add
61
+ end
62
+ on_page AssignmentAdd do |add|
63
+ @allow_resubmission==nil ? @allow_resubmission=checkbox_setting(add.allow_resubmission) : add.allow_resubmission.send(@allow_resubmission)
64
+ if @allow_resubmission==:set
65
+ add.num_resubmissions.wait_until_present
66
+ @num_resubmissions==nil ? @num_resubmissions=add.num_resubmissions.selected_options[0].text : add.num_resubmissions.select(@num_resubmissions)
67
+ @resubmission[:MON]==nil ? @resubmission[:MON]=add.resub_until_month.selected_options[0].text : add.resub_until_month.select(@resubmission[:MON])
68
+ @resubmission[:day_of_month]==nil ? @resubmission[:day_of_month]=add.resub_until_day.selected_options[0].text : add.select(@resubmission[:day_of_month])
69
+ @resubmission[:year]==nil ? @resubmission[:year]=add.resub_until_year.selected_options[0].text : add.select(@resubmission[:year])
70
+ @resubmission[:hour]==nil ? @resubmission[:hour]=add.resub_until_hour.selected_options[0].text : add.select(@resubmission[:hour])
71
+ @resubmission[:minute_rounded]==nil ? @resubmission[:minute_rounded]=add.resub_until_minute.selected_options[0].text : add.select(@resubmission[:minute_rounded])
72
+ @resubmission[:MERIDIAN]==nil ? @resubmission[:MERIDIAN]=add.resub_until_meridian.selected_options[0].text : add.select(@resubmission[:MERIDIAN])
73
+ end
74
+ add.title.set @title
75
+ add.instructions=@instructions
76
+ @student_submissions==nil ? @student_submissions=add.student_submissions.selected_options[0].text : add.student_submissions.select(@student_submissions)
77
+ @grade_scale==nil ? @grade_scale=add.grade_scale.selected_options[0].text : add.grade_scale.select(@grade_scale)
78
+ @open[:MON]==nil ? @open[:MON]=add.open_month.selected_options[0].text : add.open_month.select(@open[:MON])
79
+ add.max_points.set(@max_points) unless @max_points==nil
80
+ @open[:year]==nil ? @open[:year]=add.open_year.selected_options[0].text : add.open_year.select(@open[:year])
81
+ @open[:day_of_month]==nil ? @open[:day_of_month]=add.open_day.selected_options[0].text : add.open_day.select(@open[:day_of_month])
82
+ @open[:hour]==nil ? @open[:hour]=add.open_hour.selected_options[0].text : add.open_hour.select(@open[:hour])
83
+ @open[:minute_rounded]==nil ? @open[:minute_rounded]=add.open_minute.selected_options[0].text : add.open_minute.select(@open[:minute_rounded])
84
+ @open[:MERIDIAN]==nil ? @open[:MERIDIAN]=add.open_meridian.selected_options[0].text : add.open_meridian.select(@open[:MERIDIAN])
85
+ @add_due_date==nil ? @add_due_date=checkbox_setting(add.add_due_date) : add.add_due_date.send(@add_due_date)
86
+ @add_open_announcement==nil ? @add_open_announcement=checkbox_setting(add.add_open_announcement) : add.add_open_announcement.send(@add_open_announcement)
87
+ @add_to_gradebook==nil ? @add_to_gradebook=radio_setting(add.add_to_gradebook) : add.add_to_gradebook.send(@add_to_gradebook)
88
+ @due[:MON]==nil ? @due[:MON]=add.due_month.selected_options[0].text : add.due_month.select(@due[:MON])
89
+ @due[:year]==nil ? @due[:year]=add.due_year.selected_options[0].text : add.due_year.select(@due[:year])
90
+ @due[:day_of_month]==nil ? @due[:day_of_month]=add.due_day.selected_options[0].text : add.due_day.select(@due[:day_of_month])
91
+ @due[:hour]==nil ? @due[:hour]=add.due_hour.selected_options[0].text : add.due_hour.select(@due[:hour])
92
+ @due[:minute_rounded]==nil ? @due[:minute_rounded]=add.due_minute.selected_options[0].text : add.due_minute.select(@due[:minute_rounded])
93
+ @due[:MERIDIAN]==nil ? @due[:MERIDIAN]=add.due_meridian.selected_options[0].text : add.due_meridian.select(@due[:MERIDIAN])
94
+ @accept_until[:MON]==nil ? @accept_until[:MON]=add.accept_month.selected_options[0].text : add.accept_month.select(@accept_until[:MON])
95
+ @accept_until[:year]==nil ? @accept_until[:year]=add.accept_year.selected_options[0].text : add.accept_year.select(@accept_until[:year])
96
+ @accept_until[:day_of_month]==nil ? @accept_until[:day_of_month]=add.accept_day.selected_options[0].text : add.accept_day.select(@accept_until[:day_of_month])
97
+ @accept_until[:hour]==nil ? @accept_until[:hour]=add.accept_hour.selected_options[0].text : add.accept_hour.select(@accept_until[:hour])
98
+ @accept_until[:minute_rounded]==nil ? @accept_until[:minute_rounded]=add.accept_minute.selected_options[0].text : add.accept_minute.select(@accept_until[:minute_rounded])
99
+ @accept_until[:MERIDIAN]==nil ? @accept_until[:MERIDIAN]=add.accept_meridian.selected_options[0].text : add.accept_meridian.select(@accept_until[:MERIDIAN])
100
+ #@do_not_add_to_gradebook==nil ? @do_not_add_to_gradebook=radio_setting(add.do_not_add_gradebook.set?) :
101
+ if @status=="Draft"
102
+ add.save_draft
103
+ else
104
+ add.post
105
+ end
106
+ end
107
+ on_page AssignmentsList do |list|
108
+ @id = list.get_assignment_id @title
109
+ @link = list.assignment_href @title
110
+ @status = list.status_of @title
111
+ end
112
+ end
113
+
114
+ def edit opts={}
115
+ open_my_site_by_name @site unless @browser.title=~/#{@site}/
116
+ assignments unless @browser.title=~/Assignments$/
117
+ on AssignmentsList do |list|
118
+ if @status=="Draft"
119
+ list.edit_assignment "Draft - #{@title}"
120
+ else
121
+ list.edit_assignment @title
122
+ end
123
+ end
124
+ on AssignmentAdd do |edit|
125
+ edit.title.set opts[:title] unless opts[:title]==nil
126
+ unless opts[:instructions]==nil
127
+ edit.enter_source_text edit.editor, opts[:instructions]
128
+ end
129
+ edit.grade_scale.select opts[:grade_scale] unless opts[:grade_scale]==nil
130
+ edit.max_points.set opts[:max_points] unless opts[:max_points]==nil
131
+ # This should be one of the last items edited...
132
+ edit.add_to_gradebook.send(opts[:add_to_gradebook]) unless opts[:add_to_gradebook]==nil
133
+
134
+ #TODO: All the rest goes here
135
+
136
+ if (@status=="Draft" && opts[:status]==nil) || opts[:status]=="Draft"
137
+ edit.save_draft
138
+ elsif opts[:status]=="Editing"
139
+ # Stay on the page
140
+ else
141
+ edit.post
142
+ end
143
+ end
144
+ @title=opts[:title] unless opts[:title] == nil
145
+ @instructions=opts[:instructions] unless opts[:instructions] == nil
146
+ @grade_scale=opts[:grade_scale] unless opts[:grade_scale] == nil
147
+ @max_points=opts[:max_points] unless opts[:title] == nil
148
+ @add_to_gradebook==opts[:add_to_gradebook]
149
+ # TODO: Add all the rest of the elements here
150
+
151
+ unless opts[:status]=="Editing"
152
+ on AssignmentsList do |list|
153
+ @status=list.status_of @title
154
+ end
155
+ end
156
+ end
157
+
158
+ def get_info
159
+ open_my_site_by_name @site unless @browser.title=~/#{@site}/
160
+ assignments unless @browser.title=~/Assignments$/
161
+ on AssignmentsList do |list|
162
+ @id = list.get_assignment_id @title
163
+ @status=list.status_of @title
164
+ @link=list.assignment_href @title
165
+ if @status=="Draft"
166
+ list.open_assignment "Draft - #{@title}"
167
+ else
168
+ list.edit_assignment @title
169
+ end
170
+ end
171
+
172
+ # TODO: Add more stuff here as needed...
173
+
174
+ on AssignmentAdd do |edit|
175
+
176
+ @instructions=edit.get_source_text edit.editor
177
+ edit.source edit.editor
178
+ edit.entity_picker(edit.editor)
179
+ end
180
+ on EntityPicker do |info|
181
+ info.view_assignment_details @title
182
+ @retract_time=info.retract_time
183
+ @time_due=info.time_due
184
+ @time_modified=info.time_modified
185
+ @url=info.url
186
+ @portal_url=info.portal_url
187
+ @description=info.description
188
+ @time_created=info.time_created
189
+ @direct_url=info.direct_link
190
+ info.close_picker
191
+ end
192
+ on AssignmentAdd do |edit|
193
+ edit.cancel
194
+ end
195
+ end
196
+
197
+ def submit
198
+ # TODO: Create this method
199
+ end
200
+
201
+ def grade
202
+ # TODO: Create this method
203
+ end
204
+
205
+ end
@@ -0,0 +1,46 @@
1
+ class BlogEntryObject
2
+
3
+ include PageHelper
4
+ include Utilities
5
+ include Workflows
6
+
7
+ attr_accessor :title, :content, :site, :permissions
8
+
9
+ def initialize(browser, opts={})
10
+ @browser = browser
11
+
12
+ defaults = {
13
+ :title=>random_alphanums,
14
+ :content=>random_alphanums,
15
+ :permissions=>:publicly_viewable
16
+ }
17
+ options = defaults.merge(opts)
18
+
19
+ @title=options[:title]
20
+ @content=options[:content]
21
+ @site=options[:site]
22
+ @permissions=options[:permissions]
23
+ raise "You need to specify a site for your blog entry" if @site==nil
24
+ end
25
+
26
+ def create
27
+ open_my_site_by_name @site unless @browser.title=~/#{@site}/
28
+ blogs unless @browser.title=~/Blogs$/
29
+ # TODO: More needed here
30
+ end
31
+
32
+ def edit opts={}
33
+
34
+ end
35
+
36
+ def view
37
+
38
+ end
39
+
40
+ def delete
41
+
42
+ end
43
+
44
+ end
45
+
46
+
@@ -0,0 +1,49 @@
1
+ class BloggerPostObject
2
+
3
+ include PageHelper
4
+ include Utilities
5
+ include Workflows
6
+
7
+ attr_accessor :title, :abstract, :site, :text, :read_only, :access, :allow_comments
8
+
9
+ def initialize(browser, opts={})
10
+ @browser = browser
11
+
12
+ defaults = {
13
+ :title=>random_alphanums,
14
+ :abstract=>random_alphanums,
15
+ :text=>random_alphanums
16
+ }
17
+ options = defaults.merge(opts)
18
+
19
+ @title=options[:title]
20
+ @abstract=options[:abstract]
21
+ @site=options[:site]
22
+ @text=options[:text]
23
+ @read_only=options[:read_only]
24
+ @access=options[:access]
25
+ @allow_comments=options[:allow_comments]
26
+ raise "You need to specify a site for your blogger post" if @site==nil
27
+ end
28
+
29
+ def create
30
+ open_my_site_by_name @site unless @browser.title=~/#{@site}/
31
+ blogs unless @browser.title=~/Blogs$/
32
+ # TODO: More needed here
33
+ end
34
+
35
+ def edit opts={}
36
+
37
+ end
38
+
39
+ def view
40
+
41
+ end
42
+
43
+ def delete
44
+
45
+ end
46
+
47
+ end
48
+
49
+
@@ -0,0 +1,54 @@
1
+ class ChatRoomObject
2
+
3
+ include PageHelper
4
+ include Utilities
5
+ include Workflows
6
+
7
+ attr_accessor :title, :description, :chat_display, :allow_change, :site
8
+
9
+ def initialize(browser, opts={})
10
+ @browser = browser
11
+
12
+ defaults = {
13
+ :title=>random_alphanums,
14
+ :description=>random_alphanums,
15
+ :chat_display=>:show_all_messages,
16
+ :allow_change=>:set
17
+ }
18
+ options = defaults.merge(opts)
19
+
20
+ @title=options[:title]
21
+ @description=options[:description]
22
+ @chat_display=options[:chat_display]
23
+ @allow_change=options[:allow_change]
24
+ @site=options[:site]
25
+ raise "You need to specify a site for your chat room" if @site==nil
26
+ end
27
+
28
+ def create
29
+ open_my_site_by_name @site unless @browser.title=~/#{@site}/
30
+ chat_room unless @browser.title=~/Chat Room$/
31
+ on ChatRoom do |chat|
32
+ chat.options
33
+ end
34
+ on ManageRooms do |manage|
35
+ manage.add_room
36
+ end
37
+ #TODO: finish this method
38
+ end
39
+
40
+ def edit opts={}
41
+
42
+ end
43
+
44
+ def view
45
+
46
+ end
47
+
48
+ def delete
49
+
50
+ end
51
+
52
+ end
53
+
54
+
@@ -0,0 +1,89 @@
1
+ class EventObject
2
+
3
+ include PageHelper
4
+ include Utilities
5
+ include Workflows
6
+
7
+ attr_accessor :title, :month, :day, :year, :start_hour, :start_minute,
8
+ :start_meridian, :duration_hours, :duration_minutes, :end_hour,
9
+ :end_minute, :end_meridian, :message, :site, :link, :message_html
10
+
11
+ def initialize(browser, opts={})
12
+ @browser = browser
13
+
14
+ defaults = {
15
+ :title=>random_alphanums,
16
+ :month=>in_15_minutes[:month_str],
17
+ :day=>in_15_minutes[:day],
18
+ :year=>in_15_minutes[:year],
19
+ :start_hour=>in_15_minutes[:hour],
20
+ :start_minute=>in_15_minutes[:minute],
21
+ :start_meridian=>in_15_minutes[:meridian],
22
+ :message=>random_multiline(400,20, :alpha)
23
+ }
24
+ options = defaults.merge(opts)
25
+
26
+ @title=options[:title]
27
+ @month=options[:month]
28
+ @day=options[:day]
29
+ @year=options[:year]
30
+ @start_hour=options[:start_hour]
31
+ @start_minute=options[:start_minute]
32
+ @start_meridian=options[:start_meridian]
33
+ @duration_hours=options[:duration_hours]
34
+ @duration_minutes=options[:duration_minutes]
35
+ @end_hour=options[:end_hour]
36
+ @end_minute=options[:end_minute]
37
+ @end_meridian=options[:end_meridian]
38
+ @message=options[:message]
39
+ @site=options[:site]
40
+ raise "You need to specify a site for your wiki" if @site==nil
41
+ end
42
+
43
+ def create
44
+ open_my_site_by_name @site unless @browser.title=~/#{@site}/
45
+ calendar unless @browser.title=~/Calendar$/
46
+ on Calendar do |cal|
47
+ cal.add_event
48
+ end
49
+ on AddEditEvent do |add_event|
50
+ add_event.enter_source_text add_event.editor, @message
51
+ add_event.title.set @title
52
+ add_event.month.select @month
53
+ add_event.day.select @day
54
+ add_event.year.select @year
55
+ add_event.start_hour.select @start_hour
56
+ add_event.start_minute.select @start_minute
57
+ add_event.start_meridian.select @start_meridian
58
+ if @end_hour == nil && @duration_hours == nil
59
+ @duration_hours = add_event.hours.value
60
+ @duration_minutes = add_event.minutes.value
61
+ @end_hour = add_event.end_hour.value
62
+ @end_minute = add_event.end_minute.value
63
+ @end_meridian = add_event.end_meridian.value
64
+ elsif @end_hour == nil
65
+ # Todo: Add this later
66
+ elsif @duration_hours == nil
67
+ # Todo: Add this later
68
+ end
69
+ add_event.save_event
70
+ end
71
+ on Calendar do |cal|
72
+ @link = cal.event_href @title
73
+ end
74
+ end
75
+
76
+ def view
77
+ open_my_site_by_name @site unless @browser.title=~/#{@site}/
78
+ calendar unless @browser.title=~/Calendar$/
79
+ on Calendar do |cal|
80
+ cal.open_event @title
81
+ end
82
+ on EventDetail do |event|
83
+ @message_html = event.message_html
84
+ # TODO: Lots of stuff to add here...
85
+ # ...event.details...
86
+ end
87
+ end
88
+
89
+ end