sakai-cle-test-api 0.0.7 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sakai-cle-test-api.rb +7 -2
- data/lib/sakai-cle-test-api/add_files.rb +198 -0
- data/lib/sakai-cle-test-api/admin_page_elements.rb +7 -3
- data/lib/sakai-cle-test-api/announcements.rb +274 -7
- data/lib/sakai-cle-test-api/assessments.rb +930 -27
- data/lib/sakai-cle-test-api/assignments.rb +769 -13
- data/lib/sakai-cle-test-api/basic_lti.rb +5 -1
- data/lib/sakai-cle-test-api/blogs.rb +54 -2
- data/lib/sakai-cle-test-api/calendar.rb +423 -8
- data/lib/sakai-cle-test-api/chat_room.rb +0 -0
- data/lib/sakai-cle-test-api/common_page_elements.rb +69 -172
- data/lib/sakai-cle-test-api/core-ext.rb +90 -0
- data/lib/sakai-cle-test-api/data_objects/announcement.rb +38 -0
- data/lib/sakai-cle-test-api/data_objects/assessment.rb +32 -0
- data/lib/sakai-cle-test-api/data_objects/assignment.rb +62 -0
- data/lib/sakai-cle-test-api/data_objects/event.rb +86 -0
- data/lib/sakai-cle-test-api/data_objects/lesson.rb +137 -0
- data/lib/sakai-cle-test-api/data_objects/resource.rb +174 -0
- data/lib/sakai-cle-test-api/data_objects/site.rb +213 -0
- data/lib/sakai-cle-test-api/data_objects/syllabus.rb +7 -0
- data/lib/sakai-cle-test-api/data_objects/topic.rb +0 -0
- data/lib/sakai-cle-test-api/data_objects/web_content_tool.rb +52 -0
- data/lib/sakai-cle-test-api/data_objects/wiki.rb +7 -0
- data/lib/sakai-cle-test-api/drop_box.rb +21 -0
- data/lib/sakai-cle-test-api/email_archive.rb +15 -1
- data/lib/sakai-cle-test-api/forums.rb +282 -8
- data/lib/sakai-cle-test-api/gem_ext.rb +45 -0
- data/lib/sakai-cle-test-api/gradebook.rb +19 -1
- data/lib/sakai-cle-test-api/gradebook2.rb +15 -1
- data/lib/sakai-cle-test-api/lessons.rb +440 -0
- data/lib/sakai-cle-test-api/messages.rb +551 -15
- data/lib/sakai-cle-test-api/news.rb +3 -1
- data/lib/sakai-cle-test-api/polls.rb +65 -3
- data/lib/sakai-cle-test-api/profile.rb +36 -2
- data/lib/sakai-cle-test-api/profile2.rb +315 -6
- data/lib/sakai-cle-test-api/resources.rb +138 -0
- data/lib/sakai-cle-test-api/rich_text.rb +13 -0
- data/lib/sakai-cle-test-api/sections.rb +198 -8
- data/lib/sakai-cle-test-api/site_page_elements.rb +4 -441
- data/lib/sakai-cle-test-api/syllabus.rb +149 -7
- data/lib/sakai-cle-test-api/tools_menu.rb +3 -20
- data/lib/sakai-cle-test-api/utilities.rb +260 -0
- data/sakai-cle-test-api.gemspec +2 -3
- metadata +21 -19
@@ -0,0 +1,213 @@
|
|
1
|
+
class SiteObject
|
2
|
+
|
3
|
+
include PageObject
|
4
|
+
include Utilities
|
5
|
+
include ToolsMenu
|
6
|
+
|
7
|
+
attr_accessor :name, :id, :subject, :course, :section, :term, :authorizer,
|
8
|
+
:web_content_source, :email, :joiner_role, :creation_date, :web_content_title,
|
9
|
+
:description, :short_description
|
10
|
+
|
11
|
+
def initialize(browser, opts={})
|
12
|
+
@browser = browser
|
13
|
+
|
14
|
+
defaults = {
|
15
|
+
:subject => random_alphanums(8),
|
16
|
+
:course => random_alphanums(8),
|
17
|
+
:section => random_alphanums(8),
|
18
|
+
:authorizer => "admin",
|
19
|
+
:web_content_title => random_alphanums(15),
|
20
|
+
:web_content_source => "http://www.rsmart.com",
|
21
|
+
:email=>random_nicelink(32),
|
22
|
+
:joiner_role => "Student",
|
23
|
+
:description => random_alphanums(30),
|
24
|
+
:short_description => random_alphanums
|
25
|
+
}
|
26
|
+
options = defaults.merge(opts)
|
27
|
+
|
28
|
+
@subject=options[:subject]
|
29
|
+
@course=options[:course]
|
30
|
+
@section=options[:section]
|
31
|
+
@authorizer=options[:authorizer]
|
32
|
+
@web_content_source=options[:web_content_source]
|
33
|
+
@email=options[:email]
|
34
|
+
@joiner_role=options[:joiner_role]
|
35
|
+
@web_content_title=options[:web_content_title]
|
36
|
+
@description=options[:description]
|
37
|
+
@short_description=options[:short_description]
|
38
|
+
end
|
39
|
+
|
40
|
+
def create
|
41
|
+
my_workspace unless @browser.title=~/My Workspace/
|
42
|
+
site_setup unless @browser.title=~/Site Setup/
|
43
|
+
on_page SiteSetup do |page|
|
44
|
+
page.new
|
45
|
+
end
|
46
|
+
site_type = SiteType.new @browser
|
47
|
+
|
48
|
+
# Select the Course Site radio button
|
49
|
+
|
50
|
+
site_type.select_course_site
|
51
|
+
|
52
|
+
# Store the selected term value for use later
|
53
|
+
@term = site_type.academic_term_element.value
|
54
|
+
|
55
|
+
# Click continue
|
56
|
+
course_section = site_type.continue
|
57
|
+
|
58
|
+
# Fill in those fields, storing the entered values for later verification steps
|
59
|
+
course_section.subject = @subject
|
60
|
+
|
61
|
+
course_section.course = @course
|
62
|
+
|
63
|
+
course_section.section = @section
|
64
|
+
|
65
|
+
# Store site name for ease of coding and readability later
|
66
|
+
@name = "#{@subject} #{@course} #{@section} #{@term}"
|
67
|
+
|
68
|
+
# Click continue button
|
69
|
+
course_section.continue
|
70
|
+
|
71
|
+
# Add a valid instructor id
|
72
|
+
course_section.authorizers_username=@authorizer
|
73
|
+
|
74
|
+
# Click continue button
|
75
|
+
course_site = course_section.continue
|
76
|
+
course_site.editor.wait_until_present
|
77
|
+
sleep 1 #FIXME
|
78
|
+
course_site.source(course_site.editor)
|
79
|
+
course_site.source=@description
|
80
|
+
course_site.short_description=@short_description
|
81
|
+
|
82
|
+
# Click Continue
|
83
|
+
course_tools = course_site.continue
|
84
|
+
|
85
|
+
#Check All Tools
|
86
|
+
course_tools.check_all_tools
|
87
|
+
|
88
|
+
course_tools.continue
|
89
|
+
add_tools = AddMultipleTools.new @browser
|
90
|
+
add_tools.site_email_address=@email
|
91
|
+
add_tools.web_content_title=@web_content_title
|
92
|
+
add_tools.web_content_source=@web_content_source
|
93
|
+
|
94
|
+
# Click the Continue button
|
95
|
+
# Note that I am calling this element directly rather than using its Class definition
|
96
|
+
# because of an inexplicable ObsoleteElementError occuring in Selenium-Webdriver
|
97
|
+
@browser.frame(:index=>0).button(:name, "Continue").click
|
98
|
+
|
99
|
+
access = SiteAccess.new(@browser)
|
100
|
+
|
101
|
+
access.select_allow
|
102
|
+
access.joiner_role=@joiner_role
|
103
|
+
|
104
|
+
review = access.continue
|
105
|
+
|
106
|
+
site_setup = review.request_site
|
107
|
+
|
108
|
+
# Create a string that will match the new Site's "creation date" string
|
109
|
+
@creation_date = make_date(Time.now)
|
110
|
+
site_setup.search_field.wait_until_present
|
111
|
+
site_setup.search(Regexp.escape(@subject))
|
112
|
+
|
113
|
+
# Get the site id for storage
|
114
|
+
@browser.frame(:class=>"portletMainIframe").link(:href=>/xsl-portal.site/, :index=>0).href =~ /(?<=\/site\/).+/
|
115
|
+
@id = $~.to_s
|
116
|
+
|
117
|
+
end
|
118
|
+
|
119
|
+
def create_and_reuse_site(site_name)
|
120
|
+
my_workspace unless @browser.title=~/My Workspace/
|
121
|
+
site_setup unless @browser.title=~/Site Setup/
|
122
|
+
on_page SiteSetup do |page|
|
123
|
+
page.new
|
124
|
+
end
|
125
|
+
site_type = SiteType.new @browser
|
126
|
+
|
127
|
+
# Select the Course Site radio button
|
128
|
+
|
129
|
+
site_type.select_course_site
|
130
|
+
|
131
|
+
# Store the selected term value for use later
|
132
|
+
@term = site_type.academic_term_element.value
|
133
|
+
|
134
|
+
# Click continue
|
135
|
+
course_section = site_type.continue
|
136
|
+
|
137
|
+
# Fill in those fields, storing the entered values for later verification steps
|
138
|
+
course_section.subject = @subject
|
139
|
+
|
140
|
+
course_section.course = @course
|
141
|
+
|
142
|
+
course_section.section = @section
|
143
|
+
|
144
|
+
# Store site name for ease of coding and readability later
|
145
|
+
@name = "#{@subject} #{@course} #{@section} #{@term}"
|
146
|
+
|
147
|
+
# Click continue button
|
148
|
+
course_section.continue
|
149
|
+
|
150
|
+
# Add a valid instructor id
|
151
|
+
course_section.authorizers_username=@authorizer
|
152
|
+
|
153
|
+
# Click continue button
|
154
|
+
course_site = course_section.continue
|
155
|
+
course_site.editor.wait_until_present
|
156
|
+
course_site.source(course_site.editor)
|
157
|
+
course_site.source=@description
|
158
|
+
course_site.short_description=@short_description
|
159
|
+
# Click Continue
|
160
|
+
course_tools = course_site.continue
|
161
|
+
|
162
|
+
#Check All Tools
|
163
|
+
course_tools.check_all_tools
|
164
|
+
course_tools.select_yes
|
165
|
+
course_tools.import_sites=site_name
|
166
|
+
course_tools.continue
|
167
|
+
on_page ReUseMaterial do |page|
|
168
|
+
page.announcements_checkbox.set
|
169
|
+
page.calendar_checkbox.set
|
170
|
+
page.discussion_forums_checkbox.set
|
171
|
+
page.forums_checkbox.set
|
172
|
+
page.chat_room_checkbox.set
|
173
|
+
page.polls_checkbox.set
|
174
|
+
page.syllabus_checkbox.set
|
175
|
+
page.lessons_checkbox.set
|
176
|
+
page.resources_checkbox.set
|
177
|
+
page.assignments_checkbox.set
|
178
|
+
page.tests_and_quizzes_checkbox.set
|
179
|
+
page.gradebook_checkbox.set
|
180
|
+
page.gradebook2_checkbox.set
|
181
|
+
page.wiki_checkbox.set
|
182
|
+
page.news_checkbox.set
|
183
|
+
page.web_content_checkbox.set
|
184
|
+
page.site_statistics_checkbox.set
|
185
|
+
page.continue
|
186
|
+
end
|
187
|
+
on_page AddMultipleTools do |page|
|
188
|
+
page.site_email_address=@email
|
189
|
+
page.web_content_title=@web_content_title
|
190
|
+
page.web_content_source=@web_content_source
|
191
|
+
page.continue
|
192
|
+
end
|
193
|
+
on_page SiteAccess do |page|
|
194
|
+
page.select_allow
|
195
|
+
page.joiner_role=@joiner_role
|
196
|
+
page.continue
|
197
|
+
end
|
198
|
+
on_page ConfirmSiteSetup do |page|
|
199
|
+
page.request_site
|
200
|
+
end
|
201
|
+
# Create a string that will match the new Site's "creation date" string
|
202
|
+
@creation_date = make_date(Time.now)
|
203
|
+
on_page SiteSetup do |page|
|
204
|
+
page.search_field.wait_until_present
|
205
|
+
page.search(Regexp.escape(@subject))
|
206
|
+
end
|
207
|
+
# Get the site id for storage
|
208
|
+
@browser.frame(:class=>"portletMainIframe").link(:href=>/xsl-portal.site/, :index=>0).href =~ /(?<=\/site\/).+/
|
209
|
+
@id = $~.to_s
|
210
|
+
|
211
|
+
end
|
212
|
+
|
213
|
+
end
|
File without changes
|
@@ -0,0 +1,52 @@
|
|
1
|
+
class WebContentObject
|
2
|
+
|
3
|
+
include PageObject
|
4
|
+
include Utilities
|
5
|
+
include ToolsMenu
|
6
|
+
|
7
|
+
attr_accessor :title, :source, :site
|
8
|
+
|
9
|
+
def initialize(browser, opts={})
|
10
|
+
@browser = browser
|
11
|
+
|
12
|
+
defaults = {
|
13
|
+
:title=>random_alphanums,
|
14
|
+
:source=>"www.rsmart.com"
|
15
|
+
}
|
16
|
+
options = defaults.merge(opts)
|
17
|
+
|
18
|
+
@title=options[:title]
|
19
|
+
@source=options[:source]
|
20
|
+
@site=options[:site]
|
21
|
+
raise "You need to specify a site for your web content" if @site==nil
|
22
|
+
end
|
23
|
+
|
24
|
+
def create
|
25
|
+
my_workspace unless @browser.title=~/My Workspace/
|
26
|
+
site_setup unless @browser.title=~/Site Setup$/
|
27
|
+
on_page SiteSetup do |page|
|
28
|
+
page.edit @site
|
29
|
+
end
|
30
|
+
on_page SiteEditor do |page|
|
31
|
+
page.edit_tools
|
32
|
+
end
|
33
|
+
on_page EditSiteTools do |page|
|
34
|
+
page.check_web_content
|
35
|
+
page.continue
|
36
|
+
end
|
37
|
+
on_page AddMultipleTools do |page|
|
38
|
+
page.web_content_title=@title
|
39
|
+
page.web_content_source=@source
|
40
|
+
page.continue
|
41
|
+
end
|
42
|
+
on_page ConfirmSiteToolsEdits do |page|
|
43
|
+
page.finish_button.wait_until_present
|
44
|
+
page.finish
|
45
|
+
end
|
46
|
+
on_page SiteEditor do |page|
|
47
|
+
page.return_button.wait_until_present
|
48
|
+
page.return_to_sites_list
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#================
|
2
|
+
# Drop Box pages
|
3
|
+
#================
|
4
|
+
|
5
|
+
#
|
6
|
+
class DropBox < AddFiles
|
7
|
+
|
8
|
+
include ToolsMenu
|
9
|
+
|
10
|
+
def initialize(browser)
|
11
|
+
@browser = browser
|
12
|
+
|
13
|
+
@@classes = {
|
14
|
+
:this => "DropBox",
|
15
|
+
:parent => "DropBox",
|
16
|
+
:second => "",
|
17
|
+
:third => ""
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -1,7 +1,21 @@
|
|
1
1
|
#
|
2
2
|
class EmailArchive
|
3
3
|
include ToolsMenu
|
4
|
-
include
|
4
|
+
include PageObject
|
5
|
+
def options
|
6
|
+
frm.link(:text=>"Options").click
|
7
|
+
EmailArchiveOptions.new(@browser)
|
8
|
+
end
|
9
|
+
|
10
|
+
# Returns an array containing the
|
11
|
+
def email_list
|
12
|
+
end
|
13
|
+
|
14
|
+
in_frame(:class=>"portletMainIframe") do |frame|
|
15
|
+
text_field(:search_field, :id=>"search", :frame=>frame)
|
16
|
+
button(:search_button, :value=>"Search", :frame=>frame)
|
17
|
+
|
18
|
+
end
|
5
19
|
end
|
6
20
|
|
7
21
|
class EmailArchiveOptions
|
@@ -1,39 +1,313 @@
|
|
1
1
|
class Forums
|
2
2
|
include ToolsMenu
|
3
|
-
|
3
|
+
# Pass this method a string that matches
|
4
|
+
# the title of a Forum on the page, it returns
|
5
|
+
# True if the specified forum row has "DRAFT" in it.
|
6
|
+
def draft?(title)
|
7
|
+
frm.table(:id=>"msgForum:forums").row(:text=>/#{Regexp.escape(title)}/).span(:text=>"DRAFT").exist?
|
8
|
+
end
|
9
|
+
|
10
|
+
def new_forum
|
11
|
+
frm.link(:text=>"New Forum").click
|
12
|
+
EditForum.new(@browser)
|
13
|
+
end
|
14
|
+
|
15
|
+
def new_topic_for_forum(name)
|
16
|
+
index = forum_titles.index(name)
|
17
|
+
frm.link(:text=>"New Topic", :index=>index).click
|
18
|
+
AddEditTopic.new(@browser)
|
19
|
+
end
|
20
|
+
|
21
|
+
def organize
|
22
|
+
frm.link(:text=>"Organize").click
|
23
|
+
OrganizeForums.new(@browser)
|
24
|
+
end
|
25
|
+
|
26
|
+
def template_settings
|
27
|
+
frm.link(:text=>"Template Settings").click
|
28
|
+
ForumTemplateSettings.new(@browser)
|
29
|
+
end
|
30
|
+
|
31
|
+
def forums_table
|
32
|
+
frm.div(:class=>"portletBody").table(:id=>"msgForum:forums")
|
33
|
+
end
|
34
|
+
|
35
|
+
def forum_titles
|
36
|
+
titles = []
|
37
|
+
title_links = frm.div(:class=>"portletBody").links.find_all { |link| link.class_name=="title" && link.id=="" }
|
38
|
+
title_links.each { |link| titles << link.text }
|
39
|
+
return titles
|
40
|
+
end
|
41
|
+
|
42
|
+
def topic_titles
|
43
|
+
titles = []
|
44
|
+
title_links = frm.div(:class=>"portletBody").links.find_all { |link| link.class_name == "title" && link.id != "" }
|
45
|
+
title_links.each { |link| titles << link.text }
|
46
|
+
return titles
|
47
|
+
end
|
48
|
+
|
49
|
+
def forum_settings(name)
|
50
|
+
index = forum_titles.index(name)
|
51
|
+
frm.link(:text=>"Forum Settings", :index=>index).click
|
52
|
+
EditForum.new(@browser)
|
53
|
+
end
|
54
|
+
|
55
|
+
def topic_settings(name)
|
56
|
+
index = topic_titles.index(name)
|
57
|
+
frm.link(:text=>"Topic Settings", :index=>index).click
|
58
|
+
AddEditTopic.new(@browser)
|
59
|
+
end
|
60
|
+
|
61
|
+
def delete_forum(name)
|
62
|
+
index = forum_titles.index(name)
|
63
|
+
frm.link(:id=>/msgForum:forums:\d+:delete/,:text=>"Delete", :index=>index).click
|
64
|
+
EditForum.new(@browser)
|
65
|
+
end
|
66
|
+
|
67
|
+
def delete_topic(name)
|
68
|
+
index = topic_titles.index(name)
|
69
|
+
frm.link(:id=>/topics:\d+:delete_confirm/, :text=>"Delete", :index=>index).click
|
70
|
+
AddEditTopic.new(@browser)
|
71
|
+
end
|
72
|
+
|
73
|
+
def open_forum(forum_title)
|
74
|
+
frm.link(:text=>forum_title).click
|
75
|
+
# New Class def goes here.
|
76
|
+
end
|
77
|
+
|
78
|
+
def open_topic(topic_title)
|
79
|
+
frm.link(:text=>topic_title).click
|
80
|
+
TopicPage.new(@browser)
|
81
|
+
end
|
4
82
|
end
|
5
83
|
|
6
84
|
class TopicPage
|
7
85
|
include ToolsMenu
|
8
|
-
|
86
|
+
def post_new_thread
|
87
|
+
frm.link(:text=>"Post New Thread").click
|
88
|
+
ComposeForumMessage.new(@browser)
|
89
|
+
end
|
90
|
+
|
91
|
+
def thread_titles
|
92
|
+
titles = []
|
93
|
+
message_table = frm.table(:id=>"msgForum:messagesInHierDataTable")
|
94
|
+
1.upto(message_table.rows.size-1) do |x|
|
95
|
+
titles << message_table[x][1].span(:class=>"firstChild").link(:index=>0).text
|
96
|
+
end
|
97
|
+
return titles
|
98
|
+
end
|
99
|
+
|
100
|
+
def open_message(message_title)
|
101
|
+
frm.div(:class=>"portletBody").link(:text=>message_title).click
|
102
|
+
ViewForumThread.new(@browser)
|
103
|
+
end
|
104
|
+
|
105
|
+
def display_entire_message
|
106
|
+
frm.link(:text=>"Display Entire Message").click
|
107
|
+
TopicPage.new(@browser)
|
108
|
+
end
|
9
109
|
end
|
10
110
|
|
11
111
|
class ViewForumThread
|
12
112
|
include ToolsMenu
|
13
|
-
|
113
|
+
def reply_to_thread
|
114
|
+
frm.link(:text=>"Reply to Thread").click
|
115
|
+
ComposeForumMessage.new(@browser)
|
116
|
+
end
|
117
|
+
|
118
|
+
def reply_to_message(index)
|
119
|
+
frm.link(:text=>"Reply", :index=>(index.to_i - 1)).click
|
120
|
+
ComposeForumMessage.new(@browser)
|
121
|
+
end
|
14
122
|
end
|
15
123
|
|
16
124
|
class ComposeForumMessage
|
17
125
|
include ToolsMenu
|
18
|
-
include
|
126
|
+
include PageObject
|
127
|
+
def post_message
|
128
|
+
frm.button(:text=>"Post Message").click
|
129
|
+
# Not sure if we need logic here...
|
130
|
+
TopicPage.new(@browser)
|
131
|
+
end
|
132
|
+
|
133
|
+
def editor
|
134
|
+
frm.frame(:id, "dfCompose:df_compose_body_inputRichText___Frame").td(:id, "xEditingArea").frame(:index=>0)
|
135
|
+
end
|
136
|
+
|
137
|
+
def message=(text)
|
138
|
+
editor.send_keys(text)
|
139
|
+
end
|
140
|
+
|
141
|
+
def reply_text
|
142
|
+
@browser.frame(:index=>1).div(:class=>"singleMessageReply").text
|
143
|
+
end
|
144
|
+
|
145
|
+
def add_attachments
|
146
|
+
#FIXME
|
147
|
+
end
|
148
|
+
|
149
|
+
def cancel
|
150
|
+
frm.button(:value=>"Cancel").click
|
151
|
+
# Logic for picking the correct page class
|
152
|
+
if frm.link(:text=>"Reply to Thread")
|
153
|
+
ViewForumThread.new(@browser)
|
154
|
+
elsif frm.link(:text=>"Post New Thread").click
|
155
|
+
TopicPage.new(@browser)
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
in_frame(:class=>"portletMainIframe") do |frame|
|
160
|
+
text_field(:title, :id=>"dfCompose:df_compose_title", :frame=>frame)
|
161
|
+
|
162
|
+
end
|
19
163
|
end
|
20
164
|
|
21
165
|
class ForumTemplateSettings
|
22
166
|
include ToolsMenu
|
23
|
-
|
167
|
+
def page_title
|
168
|
+
frm.div(:class=>"portletBody").h3(:index=>0).text
|
169
|
+
end
|
170
|
+
|
171
|
+
def save
|
172
|
+
frm.button(:value=>"Save").click
|
173
|
+
Forums.new(@browser)
|
174
|
+
end
|
175
|
+
|
176
|
+
def cancel
|
177
|
+
frm.button(:value=>"Cancel").click
|
178
|
+
Forums.new(@browser)
|
179
|
+
end
|
180
|
+
=begin
|
181
|
+
def site_role=(role)
|
182
|
+
frm.select(:id=>"revise:role").select(role)
|
183
|
+
0.upto(frm.select(:id=>"revise:role").length - 1) do |x|
|
184
|
+
if frm.div(:class=>"portletBody").table(:class=>"permissionPanel jsfFormTable lines nolines", :index=>x).visible?
|
185
|
+
@@table_index = x
|
186
|
+
|
187
|
+
def permission_level=(value)
|
188
|
+
frm.select(:id=>"revise:perm:#{@@table_index}:level").select(value)
|
189
|
+
end
|
190
|
+
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
194
|
+
=end
|
24
195
|
end
|
25
196
|
|
26
197
|
class OrganizeForums
|
27
198
|
include ToolsMenu
|
28
|
-
|
199
|
+
def save
|
200
|
+
frm.button(:value=>"Save").click
|
201
|
+
Forums.new(@browser)
|
202
|
+
end
|
203
|
+
|
204
|
+
# These are set to so that the user
|
205
|
+
# does not have to start the list at zero...
|
206
|
+
def forum(index)
|
207
|
+
frm.select(:id, "revise:forums:#{index.to_i - 1}:forumIndex")
|
208
|
+
end
|
209
|
+
|
210
|
+
def topic(forumindex, topicindex)
|
211
|
+
frm.select(:id, "revise:forums:#{forumindex.to_i - 1}:topics:#{topicindex.to_i - 1}:topicIndex")
|
212
|
+
end
|
29
213
|
end
|
30
214
|
|
31
215
|
class EditForum
|
32
216
|
include ToolsMenu
|
33
|
-
include
|
217
|
+
include PageObject
|
218
|
+
def save
|
219
|
+
frm.button(:value=>"Save").click
|
220
|
+
Forums.new(@browser)
|
221
|
+
end
|
222
|
+
|
223
|
+
def save_and_add
|
224
|
+
frm.button(:value=>"Save Settings & Add Topic").click
|
225
|
+
AddEditTopic.new(@browser)
|
226
|
+
end
|
227
|
+
|
228
|
+
def editor
|
229
|
+
frm.div(:class=>"portletBody").frame(:id, "revise:df_compose_description_inputRichText___Frame").td(:id, "xEditingArea").frame(:index=>0)
|
230
|
+
end
|
231
|
+
|
232
|
+
def description=(text)
|
233
|
+
editor.send_keys(text)
|
234
|
+
end
|
235
|
+
|
236
|
+
def add_attachments
|
237
|
+
frm.button(:value=>/attachments/).click
|
238
|
+
ForumsAddAttachments.new(@browser)
|
239
|
+
end
|
240
|
+
|
241
|
+
in_frame(:class=>"portletMainIframe") do |frame|
|
242
|
+
text_field(:title, :id=>"revise:forum_title", :frame=>frame)
|
243
|
+
text_area(:short_description, :id=>"revise:forum_shortDescription", :frame=>frame)
|
244
|
+
|
245
|
+
end
|
34
246
|
end
|
35
247
|
|
36
248
|
class AddEditTopic
|
37
249
|
include ToolsMenu
|
38
|
-
include
|
250
|
+
include PageObject
|
251
|
+
|
252
|
+
@@table_index=0
|
253
|
+
|
254
|
+
def editor
|
255
|
+
frm.div(:class=>"portletBody").frame(:id, "revise:topic_description_inputRichText___Frame").td(:id, "xEditingArea").frame(:index=>0)
|
256
|
+
end
|
257
|
+
|
258
|
+
def description=(text)
|
259
|
+
editor.send_keys(text)
|
260
|
+
end
|
261
|
+
|
262
|
+
def save
|
263
|
+
frm.button(:value=>"Save").click
|
264
|
+
Forums.new(@browser)
|
265
|
+
end
|
266
|
+
|
267
|
+
def add_attachments
|
268
|
+
frm.button(:value=>/Add.+ttachment/).click
|
269
|
+
ForumsAddAttachments.new(@browser)
|
270
|
+
end
|
271
|
+
|
272
|
+
def roles
|
273
|
+
roles=[]
|
274
|
+
options = frm.select(:id=>"revise:role").options.to_a
|
275
|
+
options.each { |option| roles << option.text }
|
276
|
+
return roles
|
277
|
+
end
|
278
|
+
|
279
|
+
def site_role=(role)
|
280
|
+
frm.select(:id=>"revise:role").select(role)
|
281
|
+
0.upto(frm.select(:id=>"revise:role").length - 1) do |x|
|
282
|
+
if frm.div(:class=>"portletBody").table(:class=>"permissionPanel jsfFormTable lines nolines", :index=>x).visible?
|
283
|
+
@@table_index = x
|
284
|
+
|
285
|
+
def permission_level=(value)
|
286
|
+
frm.select(:id=>"revise:perm:#{@@table_index}:level").select(value)
|
287
|
+
end
|
288
|
+
|
289
|
+
end
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
293
|
+
in_frame(:class=>"portletMainIframe") do |frame|
|
294
|
+
text_field(:title, :id=>"revise:topic_title", :frame=>frame)
|
295
|
+
text_area(:short_description, :id=>"revise:topic_shortDescription", :frame=>frame)
|
296
|
+
|
297
|
+
end
|
298
|
+
end
|
299
|
+
|
300
|
+
# TODO: Determine where this should go and a better way to organize the code
|
301
|
+
class ForumsAddAttachments < AddFiles
|
302
|
+
|
303
|
+
def initialize(browser)
|
304
|
+
@browser = browser
|
305
|
+
|
306
|
+
@@classes = {
|
307
|
+
:this => "ForumsAddAttachments",
|
308
|
+
:parent => "AddEditTopic",
|
309
|
+
:second => "EditForum"
|
310
|
+
}
|
311
|
+
end
|
312
|
+
|
39
313
|
end
|