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.
- data/README.md +4 -0
- data/lib/sambal-cle/base_page.rb +20 -0
- data/lib/sambal-cle/core-ext.rb +90 -0
- data/lib/sambal-cle/data_objects/announcement.rb +82 -0
- data/lib/sambal-cle/data_objects/assessment.rb +32 -0
- data/lib/sambal-cle/data_objects/assignment.rb +205 -0
- data/lib/sambal-cle/data_objects/blog.rb +46 -0
- data/lib/sambal-cle/data_objects/blogger.rb +49 -0
- data/lib/sambal-cle/data_objects/chat_room.rb +54 -0
- data/lib/sambal-cle/data_objects/event.rb +89 -0
- data/lib/sambal-cle/data_objects/forum.rb +212 -0
- data/lib/sambal-cle/data_objects/lesson.rb +185 -0
- data/lib/sambal-cle/data_objects/message.rb +57 -0
- data/lib/sambal-cle/data_objects/poll.rb +74 -0
- data/lib/sambal-cle/data_objects/resource.rb +209 -0
- data/lib/sambal-cle/data_objects/site.rb +295 -0
- data/lib/sambal-cle/data_objects/syllabus.rb +73 -0
- data/lib/sambal-cle/data_objects/web_content_tool.rb +51 -0
- data/lib/sambal-cle/data_objects/wiki.rb +63 -0
- data/lib/sambal-cle/date_makers.rb +118 -0
- data/lib/sambal-cle/gem_ext.rb +23 -0
- data/lib/sambal-cle/page_helper.rb +22 -0
- data/lib/sambal-cle/page_maker.rb +48 -0
- data/lib/sambal-cle/page_objects/account.rb +111 -0
- data/lib/sambal-cle/page_objects/aliases.rb +43 -0
- data/lib/sambal-cle/page_objects/announcements.rb +190 -0
- data/lib/sambal-cle/page_objects/assessments.rb +874 -0
- data/lib/sambal-cle/page_objects/assignments.rb +770 -0
- data/lib/sambal-cle/page_objects/basic_lti.rb +6 -0
- data/lib/sambal-cle/page_objects/blogger.rb +205 -0
- data/lib/sambal-cle/page_objects/blogs.rb +60 -0
- data/lib/sambal-cle/page_objects/calendar.rb +330 -0
- data/lib/sambal-cle/page_objects/calendar_summary.rb +1 -0
- data/lib/sambal-cle/page_objects/chat_room.rb +22 -0
- data/lib/sambal-cle/page_objects/drop_box.rb +9 -0
- data/lib/sambal-cle/page_objects/email_archive.rb +22 -0
- data/lib/sambal-cle/page_objects/entity_picker.rb +62 -0
- data/lib/sambal-cle/page_objects/evaluations.rb +158 -0
- data/lib/sambal-cle/page_objects/feedback.rb +36 -0
- data/lib/sambal-cle/page_objects/forms.rb +120 -0
- data/lib/sambal-cle/page_objects/forums.rb +254 -0
- data/lib/sambal-cle/page_objects/glossary.rb +117 -0
- data/lib/sambal-cle/page_objects/gradebook.rb +29 -0
- data/lib/sambal-cle/page_objects/gradebook2.rb +17 -0
- data/lib/sambal-cle/page_objects/home.rb +36 -0
- data/lib/sambal-cle/page_objects/jforums.rb +444 -0
- data/lib/sambal-cle/page_objects/job_scheduler.rb +121 -0
- data/lib/sambal-cle/page_objects/lessons.rb +361 -0
- data/lib/sambal-cle/page_objects/login.rb +28 -0
- data/lib/sambal-cle/page_objects/matrix.rb +241 -0
- data/lib/sambal-cle/page_objects/media_gallery.rb +13 -0
- data/lib/sambal-cle/page_objects/messages.rb +622 -0
- data/lib/sambal-cle/page_objects/my_workspace.rb +44 -0
- data/lib/sambal-cle/page_objects/news.rb +8 -0
- data/lib/sambal-cle/page_objects/podcasts.rb +27 -0
- data/lib/sambal-cle/page_objects/polls.rb +69 -0
- data/lib/sambal-cle/page_objects/portfolio_templates.rb +161 -0
- data/lib/sambal-cle/page_objects/portfolios.rb +162 -0
- data/lib/sambal-cle/page_objects/post_em.rb +1 -0
- data/lib/sambal-cle/page_objects/profile.rb +51 -0
- data/lib/sambal-cle/page_objects/profile2.rb +344 -0
- data/lib/sambal-cle/page_objects/public_search.rb +61 -0
- data/lib/sambal-cle/page_objects/realms.rb +19 -0
- data/lib/sambal-cle/page_objects/resources.rb +326 -0
- data/lib/sambal-cle/page_objects/resources_roster.rb +0 -0
- data/lib/sambal-cle/page_objects/rosters.rb +70 -0
- data/lib/sambal-cle/page_objects/rwiki.rb +34 -0
- data/lib/sambal-cle/page_objects/search.rb +34 -0
- data/lib/sambal-cle/page_objects/sections.rb +295 -0
- data/lib/sambal-cle/page_objects/single_user.rb +1 -0
- data/lib/sambal-cle/page_objects/site_setup.rb +621 -0
- data/lib/sambal-cle/page_objects/site_statistics.rb +1 -0
- data/lib/sambal-cle/page_objects/sites.rb +255 -0
- data/lib/sambal-cle/page_objects/styles.rb +74 -0
- data/lib/sambal-cle/page_objects/syllabus.rb +166 -0
- data/lib/sambal-cle/page_objects/user_membership.rb +57 -0
- data/lib/sambal-cle/page_objects/users.rb +88 -0
- data/lib/sambal-cle/randomizers.rb +117 -0
- data/lib/sambal-cle/rich_text.rb +38 -0
- data/lib/sambal-cle/utilities.rb +31 -0
- data/lib/sambal-cle/workflows.rb +223 -0
- data/lib/sambal-cle.rb +31 -0
- data/sambal-cle.gemspec +14 -0
- data/test/add_assignment_to_calendar_spec.rb +86 -0
- data/test/assignment_announcements_spec.rb +71 -0
- data/test/assignment_gradebook_spec.rb +98 -0
- data/test/config.yml.template +4 -0
- data/test/directory.yml.template +123 -0
- data/test/duplicate_site_spec.rb +244 -0
- metadata +167 -0
@@ -0,0 +1,212 @@
|
|
1
|
+
# Note that this class is for icon-sakai-forums. NOT jforums.
|
2
|
+
class ForumObject
|
3
|
+
|
4
|
+
include PageHelper
|
5
|
+
include Utilities
|
6
|
+
include Workflows
|
7
|
+
|
8
|
+
attr_accessor :site, :title, :short_description, :description, :direct_link,
|
9
|
+
:description_html
|
10
|
+
|
11
|
+
def initialize(browser, opts={})
|
12
|
+
@browser = browser
|
13
|
+
|
14
|
+
defaults = {
|
15
|
+
:title=>random_alphanums
|
16
|
+
}
|
17
|
+
options = defaults.merge(opts)
|
18
|
+
|
19
|
+
@site=options[:site]
|
20
|
+
@title=options[:title]
|
21
|
+
@short_description=options[:short_description]
|
22
|
+
@description=options[:description]
|
23
|
+
raise "You need to specify a site for your Forum" if @site==nil
|
24
|
+
end
|
25
|
+
|
26
|
+
alias :name :title
|
27
|
+
|
28
|
+
def create
|
29
|
+
open_my_site_by_name @site unless @browser.title=~/#{@site}/
|
30
|
+
forums unless @browser.title=~/Forums$/
|
31
|
+
on Forums do |forums|
|
32
|
+
forums.new_forum
|
33
|
+
end
|
34
|
+
on EditForum do |edit|
|
35
|
+
edit.title.set @title
|
36
|
+
edit.short_description.set @short_description unless @short_description==nil
|
37
|
+
edit.enter_source_text(edit.editor, @description) unless @description==nil
|
38
|
+
edit.save
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def edit opts={}
|
43
|
+
open_my_site_by_name @site unless @browser.title=~/#{@site}/
|
44
|
+
forums unless @browser.title=~/Forums$/
|
45
|
+
on Forums do |forum|
|
46
|
+
forum.forum_settings @title
|
47
|
+
end
|
48
|
+
on EditForum do |edit|
|
49
|
+
edit.title.set opts[:title] unless opts[:title] == nil
|
50
|
+
edit.short_description.set opts[:short_description] unless opts[:short_description]==nil
|
51
|
+
unless opts[:description] == nil
|
52
|
+
edit.enter_source_text edit.editor, opts[:description]
|
53
|
+
end
|
54
|
+
edit.save
|
55
|
+
end
|
56
|
+
@title=opts[:title] unless opts[:title] == nil
|
57
|
+
@short_description=opts[:short_description] unless opts[:short_description] == nil
|
58
|
+
@description=opts[:description] unless opts[:description] == nil
|
59
|
+
end
|
60
|
+
|
61
|
+
def view
|
62
|
+
open_my_site_by_name @site unless @browser.title=~/#{@site}/
|
63
|
+
forums unless @browser.title=~/Forums$/
|
64
|
+
on Forums do |forum|
|
65
|
+
forum.open_forum @title
|
66
|
+
end
|
67
|
+
on ForumView do |view|
|
68
|
+
@short_description = view.short_description
|
69
|
+
view.view_full_description
|
70
|
+
@description_html = view.description_html
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def delete
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
def get_entity_info
|
79
|
+
open_my_site_by_name @site unless @browser.title=~/#{@site}/
|
80
|
+
forums unless @browser.title=~/Forums$/
|
81
|
+
# TODO: Something will probably be needed here, in case we're currently
|
82
|
+
# on a Forum page already.
|
83
|
+
on Forums do |forum|
|
84
|
+
forum.forum_settings @title
|
85
|
+
end
|
86
|
+
on EditForum do |edit|
|
87
|
+
edit.entity_picker edit.editor
|
88
|
+
end
|
89
|
+
on EntityPicker do |pick|
|
90
|
+
pick.view_forum_details @title
|
91
|
+
@direct_link = pick.direct_link
|
92
|
+
# TODO: put more entity info stuff here!!
|
93
|
+
pick.close_picker
|
94
|
+
end
|
95
|
+
on EditForum do |edit|
|
96
|
+
edit.cancel
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
101
|
+
|
102
|
+
class TopicObject
|
103
|
+
|
104
|
+
include PageHelper
|
105
|
+
include Utilities
|
106
|
+
include Workflows
|
107
|
+
|
108
|
+
attr_accessor :title, :short_description, :description, :site, :forum,
|
109
|
+
:author, :moderated, :modified_by, :date_modified,
|
110
|
+
:date_created, :direct_link, :description_html
|
111
|
+
|
112
|
+
def initialize(browser, opts={})
|
113
|
+
@browser = browser
|
114
|
+
|
115
|
+
defaults = {
|
116
|
+
:title=>random_alphanums,
|
117
|
+
:short_description=>random_alphanums,
|
118
|
+
:description=>random_alphanums,
|
119
|
+
|
120
|
+
}
|
121
|
+
options = defaults.merge(opts)
|
122
|
+
|
123
|
+
@title=options[:title]
|
124
|
+
@short_description=options[:short_description]
|
125
|
+
@description=options[:description]
|
126
|
+
@site=options[:site]
|
127
|
+
@forum=options[:forum]
|
128
|
+
raise "You must define a site for your Topic" if @site==nil
|
129
|
+
raise "You must specify an existing Forum for your Topic" if @forum==nil
|
130
|
+
end
|
131
|
+
|
132
|
+
alias :name :title
|
133
|
+
|
134
|
+
def create
|
135
|
+
open_my_site_by_name @site unless @browser.title=~/#{@site}/
|
136
|
+
forums unless @browser.title=~/Forums$/
|
137
|
+
on Forums do |forums|
|
138
|
+
forums.new_topic_for_forum @forum
|
139
|
+
end
|
140
|
+
on AddEditTopic do |add|
|
141
|
+
add.title.set @title
|
142
|
+
add.short_description.set @short_description
|
143
|
+
add.enter_source_text add.editor, @description
|
144
|
+
add.save
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
def edit opts={}
|
149
|
+
open_my_site_by_name @site unless @browser.title=~/#{@site}/
|
150
|
+
forums unless @browser.title=~/Forums$/
|
151
|
+
on Forums do |forum|
|
152
|
+
reset
|
153
|
+
forum.topic_settings @title
|
154
|
+
end
|
155
|
+
on AddEditTopic do |edit|
|
156
|
+
edit.title.set opts[:title] unless opts[:title] == nil
|
157
|
+
edit.short_description.set opts[:short_description] unless opts[:short_description]==nil
|
158
|
+
unless opts[:description] == nil
|
159
|
+
edit.enter_source_text edit.editor, opts[:description]
|
160
|
+
end
|
161
|
+
edit.save
|
162
|
+
end
|
163
|
+
@title=opts[:title] unless opts[:title] == nil
|
164
|
+
@short_description=opts[:short_description] unless opts[:short_description] == nil
|
165
|
+
@description=opts[:description] unless opts[:description] == nil
|
166
|
+
end
|
167
|
+
|
168
|
+
def view
|
169
|
+
open_my_site_by_name @site unless @browser.title=~/#{@site}/
|
170
|
+
forums unless @browser.title=~/Forums$/
|
171
|
+
on Forums do |forum|
|
172
|
+
reset
|
173
|
+
forum.open_topic @title
|
174
|
+
end
|
175
|
+
on ForumView do |view|
|
176
|
+
@short_description = view.short_description
|
177
|
+
view.view_full_description
|
178
|
+
@description_html = view.description_html
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
def delete
|
183
|
+
|
184
|
+
end
|
185
|
+
|
186
|
+
def get_entity_info
|
187
|
+
open_my_site_by_name @site unless @browser.title=~/#{@site}/
|
188
|
+
forums unless @browser.title=~/Forums$/
|
189
|
+
on Forums do |forums|
|
190
|
+
forums.topic_settings @title
|
191
|
+
end
|
192
|
+
on AddEditTopic do |topic|
|
193
|
+
topic.entity_picker topic.editor
|
194
|
+
end
|
195
|
+
on EntityPicker do |picker|
|
196
|
+
picker.view_topic_details @forum, @title
|
197
|
+
@author = picker.author
|
198
|
+
@moderated = picker.moderated
|
199
|
+
@modified_by = picker.modified_by
|
200
|
+
@date_modified = picker.date_modified
|
201
|
+
@date_created = picker.date_created
|
202
|
+
@direct_link = picker.direct_link
|
203
|
+
picker.close_picker
|
204
|
+
end
|
205
|
+
on AddEditTopic do |topic|
|
206
|
+
topic.cancel
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
end
|
211
|
+
|
212
|
+
|
@@ -0,0 +1,185 @@
|
|
1
|
+
class ModuleObject
|
2
|
+
|
3
|
+
include PageHelper
|
4
|
+
include Utilities
|
5
|
+
include Workflows
|
6
|
+
|
7
|
+
attr_accessor :title, :description, :keywords, :start_date, :end_date, :site, :href
|
8
|
+
|
9
|
+
def initialize(browser, opts={})
|
10
|
+
@browser = browser
|
11
|
+
|
12
|
+
defaults = {
|
13
|
+
:title=>random_alphanums
|
14
|
+
}
|
15
|
+
options = defaults.merge(opts)
|
16
|
+
|
17
|
+
@title=options[:title]
|
18
|
+
@description=options[:description]
|
19
|
+
@keywords=options[:keywords]
|
20
|
+
@start_date=options[:start_date]
|
21
|
+
@end_date=options[:end_date]
|
22
|
+
@site=options[:site]
|
23
|
+
raise "You must specify a Site name for your lesson" if @site==nil
|
24
|
+
end
|
25
|
+
|
26
|
+
alias :name :title
|
27
|
+
|
28
|
+
def create
|
29
|
+
open_my_site_by_name @site unless @browser.title=~/#{@site}/
|
30
|
+
lessons unless @browser.title=~/Lessons$/
|
31
|
+
reset
|
32
|
+
on_page Lessons do |page|
|
33
|
+
page.add_module
|
34
|
+
end
|
35
|
+
on_page AddEditModule do |page|
|
36
|
+
page.title.set @title
|
37
|
+
page.description.set @description
|
38
|
+
page.keywords.set @keywords
|
39
|
+
page.start_date.set @start_date
|
40
|
+
page.end_date.set @end_date
|
41
|
+
page.add
|
42
|
+
end
|
43
|
+
on_page ConfirmModule do |page|
|
44
|
+
page.return_to_modules
|
45
|
+
end
|
46
|
+
on_page Lessons do |list|
|
47
|
+
@href = list.href @title
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
class ContentSectionObject
|
54
|
+
|
55
|
+
include PageHelper
|
56
|
+
include Utilities
|
57
|
+
include Workflows
|
58
|
+
|
59
|
+
attr_accessor :site, :module, :title, :instructions, :modality, :content_type,
|
60
|
+
:copyright_status, :editor_content, :file_folder, :file_name, :file_path,
|
61
|
+
:url, :url_title, :file_description, :url_description, :href
|
62
|
+
|
63
|
+
def initialize(browser, opts={})
|
64
|
+
@browser = browser
|
65
|
+
|
66
|
+
defaults = {
|
67
|
+
:title=>random_alphanums,
|
68
|
+
:copyright_status=>"Public Domain",
|
69
|
+
:modality=>[:check_textual]
|
70
|
+
}
|
71
|
+
options = defaults.merge(opts)
|
72
|
+
|
73
|
+
@site=options[:site]
|
74
|
+
@module=options[:module]
|
75
|
+
@title=options[:title]
|
76
|
+
@instructions=options[:instructions]
|
77
|
+
@modality=options[:modality]
|
78
|
+
@content_type=options[:content_type]
|
79
|
+
@copyright_status=options[:copyright_status]
|
80
|
+
@editor_content=options[:editor_content]
|
81
|
+
@file_name=options[:file_name]
|
82
|
+
@file_path=options[:file_path]
|
83
|
+
@file_description=options[:file_description]
|
84
|
+
@file_folder=options[:file_folder]
|
85
|
+
@url=options[:url]
|
86
|
+
@url_title=options[:url_title]
|
87
|
+
@url_description=options[:url_description]
|
88
|
+
raise "Your modality variable must be an Array containing one or more keys\nthat match the checkbox methods, like this:\n[:uncheck_textual, :check_visual, :check_auditory]" unless @modality.class==Array
|
89
|
+
raise "You must specify a Site for your Section" if @site==nil
|
90
|
+
raise "You must specify a Module for your Section" if @module==nil
|
91
|
+
end
|
92
|
+
|
93
|
+
alias :name :title
|
94
|
+
|
95
|
+
def create
|
96
|
+
open_my_site_by_name @site unless @browser.title=~/#{@site}/
|
97
|
+
lessons unless @browser.title=~/Lessons$/
|
98
|
+
reset
|
99
|
+
on_page Lessons do |page|
|
100
|
+
page.open_lesson @module
|
101
|
+
end
|
102
|
+
on_page AddEditModule do |page|
|
103
|
+
page.add_content_sections
|
104
|
+
end
|
105
|
+
on_page AddEditContentSection do |page|
|
106
|
+
page.title.set @title
|
107
|
+
page.instructions.set @instructions
|
108
|
+
@modality.each do |content|
|
109
|
+
page.send(content)
|
110
|
+
end
|
111
|
+
page.content_type.select @content_type unless @content_type==nil
|
112
|
+
end
|
113
|
+
|
114
|
+
on AddEditContentSection do |page| # Note we are reinstantiating the class here because of
|
115
|
+
# an issue with Selenium Webdriver throwing a
|
116
|
+
# WeakReference error, given the partial page reload.
|
117
|
+
case @content_type
|
118
|
+
when "Compose content with editor"
|
119
|
+
page.enter_source_text page.content_editor, @editor_content
|
120
|
+
when "Upload or link to a file"
|
121
|
+
page.select_a_file
|
122
|
+
on_page LessonAddAttachment do |add|
|
123
|
+
add.upload_local_file @file_name, @file_path
|
124
|
+
add.continue
|
125
|
+
end
|
126
|
+
page.file_description.set @file_description
|
127
|
+
when "Link to new or existing URL resource on server"
|
128
|
+
page.select_url
|
129
|
+
on_page SelectingContent do |select|
|
130
|
+
select.new_url.set @url
|
131
|
+
select.url_title.set @url_title
|
132
|
+
select.continue
|
133
|
+
end
|
134
|
+
page.url_description.set @url_description
|
135
|
+
when "Upload or link to a file in Resources"
|
136
|
+
page.select_or_upload_file
|
137
|
+
on_page ResourcesBase do |add|
|
138
|
+
add.open_folder @file_folder unless @file_folder == nil
|
139
|
+
add.select_file @file_name
|
140
|
+
add.continue
|
141
|
+
end
|
142
|
+
else
|
143
|
+
raise "You have a typo in what you've specified for your Section's content type.\nIt must be one of the options contained in the dropdown."
|
144
|
+
end
|
145
|
+
page.copyright_status.select @copyright_status
|
146
|
+
page.add
|
147
|
+
end
|
148
|
+
on ConfirmSectionAdd do |confirm|
|
149
|
+
confirm.finish
|
150
|
+
end
|
151
|
+
on Lessons do |list|
|
152
|
+
@href = list.href @title
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
def edit opts={}
|
157
|
+
open_my_site_by_name @site unless @browser.title=~/#{@site}/
|
158
|
+
lessons unless @browser.title=~/Lessons$/
|
159
|
+
reset
|
160
|
+
on Lessons do |list|
|
161
|
+
list.check_section @title
|
162
|
+
list.edit
|
163
|
+
end
|
164
|
+
on AddEditContentSection do |edit|
|
165
|
+
edit.title.set opts[:title] unless opts[:title]==nil
|
166
|
+
edit.instructions.set opts[:instructions] unless opts[:instructions]==nil
|
167
|
+
if opts[:modality].class==Array
|
168
|
+
opts[:modality].each do |item|
|
169
|
+
edit.send(item)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
# TODO: Add code here for updating attached resources
|
174
|
+
|
175
|
+
edit.enter_source_text(edit.content_editor, opts[:editor_content]) unless opts[:editor_content]==nil
|
176
|
+
|
177
|
+
# TODO: Add code here for updating remaining variables
|
178
|
+
|
179
|
+
edit.finish
|
180
|
+
end
|
181
|
+
@title=opts[:title] unless opts[:title]==nil
|
182
|
+
@instructions=opts[:instructions] unless opts[:instructions]==nil
|
183
|
+
@modality=opts[:modality] unless opts[:modality]==nil
|
184
|
+
end
|
185
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
class MessageObject
|
2
|
+
|
3
|
+
include PageHelper
|
4
|
+
include Utilities
|
5
|
+
include Workflows
|
6
|
+
|
7
|
+
attr_accessor :site, :subject, :send_cc, :recipients, :message, :label
|
8
|
+
|
9
|
+
def initialize(browser, opts={})
|
10
|
+
@browser = browser
|
11
|
+
|
12
|
+
defaults = {
|
13
|
+
:subject=>random_alphanums,
|
14
|
+
:recipients=>["All Participants"]
|
15
|
+
}
|
16
|
+
options = defaults.merge(opts)
|
17
|
+
|
18
|
+
@subject=options[:subject]
|
19
|
+
@recipients=options[:recipients]
|
20
|
+
@site=options[:site]
|
21
|
+
@message=options[:message]
|
22
|
+
@label=options[:label]
|
23
|
+
raise "You need to specify a site for your web content" if @site==nil
|
24
|
+
end
|
25
|
+
|
26
|
+
def create
|
27
|
+
open_my_site_by_name @site unless @browser.title=~/#{@site}/
|
28
|
+
messages unless @browser.title=~/Messages$/
|
29
|
+
end
|
30
|
+
|
31
|
+
alias compose create
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
class MessageFolderObject
|
38
|
+
|
39
|
+
include PageHelper
|
40
|
+
include Utilities
|
41
|
+
include Workflows
|
42
|
+
|
43
|
+
attr_accessor :site
|
44
|
+
|
45
|
+
def initialize(browser, opts={})
|
46
|
+
@browser = browser
|
47
|
+
|
48
|
+
defaults = {}
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
def create
|
53
|
+
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
class PollObject
|
2
|
+
|
3
|
+
include PageHelper
|
4
|
+
include Utilities
|
5
|
+
include Workflows
|
6
|
+
|
7
|
+
attr_accessor :question, :instructions, :options, :opening_date, :closing_date,
|
8
|
+
:access, :visibility, :site
|
9
|
+
|
10
|
+
def initialize(browser, opts={})
|
11
|
+
@browser = browser
|
12
|
+
|
13
|
+
defaults = {
|
14
|
+
:question=>random_alphanums,
|
15
|
+
:options=>[random_alphanums, random_alphanums]
|
16
|
+
}
|
17
|
+
options = defaults.merge(opts)
|
18
|
+
|
19
|
+
@question=options[:question]
|
20
|
+
@options=options[:options]
|
21
|
+
@opening_date=options[:opening_date]
|
22
|
+
@closing_date=options[:closing_date]
|
23
|
+
@site=options[:site]
|
24
|
+
@instructions=options[:instructions]
|
25
|
+
@access=options[:access]
|
26
|
+
@visibility=options[:visibility]
|
27
|
+
raise "You need to specify a site for your blog entry" if @site==nil
|
28
|
+
end
|
29
|
+
|
30
|
+
def create
|
31
|
+
open_my_site_by_name @site unless @browser.title=~/#{@site}/
|
32
|
+
polls unless @browser.title=~/Polls$/
|
33
|
+
on Polls do |polls|
|
34
|
+
polls.add
|
35
|
+
end
|
36
|
+
on AddEditPoll do |add|
|
37
|
+
add.question.set @question
|
38
|
+
add.enter_source_text add.editor, @instructions
|
39
|
+
# TODO: Need to add the filling out of more fields here
|
40
|
+
add.save_and_add_options
|
41
|
+
end
|
42
|
+
on AddAnOption do |page|
|
43
|
+
if @options.length > 1
|
44
|
+
@options[0..-2].each do |option|
|
45
|
+
page.enter_source_text page.editor, option
|
46
|
+
page.save_and_add_options
|
47
|
+
end
|
48
|
+
page.enter_source_text(page.editor, @options[-1])
|
49
|
+
page.save
|
50
|
+
else
|
51
|
+
page.enter_source_text(page.editor, @options[0])
|
52
|
+
page.save
|
53
|
+
end
|
54
|
+
end
|
55
|
+
on AddEditPoll do |poll|
|
56
|
+
poll.save
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def edit opts={}
|
61
|
+
#TODO: Add stuff here
|
62
|
+
end
|
63
|
+
|
64
|
+
def view
|
65
|
+
#TODO: Add stuff here
|
66
|
+
end
|
67
|
+
|
68
|
+
def delete
|
69
|
+
#TODO: Add stuff here
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
|