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.
- data/lib/sakai-cle-test-api.rb +2 -7
- data/lib/sakai-cle-test-api/admin_page_elements.rb +2 -6
- data/lib/sakai-cle-test-api/announcements.rb +7 -274
- data/lib/sakai-cle-test-api/assessments.rb +27 -930
- data/lib/sakai-cle-test-api/assignments.rb +13 -769
- data/lib/sakai-cle-test-api/basic_lti.rb +1 -5
- data/lib/sakai-cle-test-api/blogs.rb +2 -54
- data/lib/sakai-cle-test-api/calendar.rb +8 -423
- data/lib/sakai-cle-test-api/common_page_elements.rb +172 -69
- data/lib/sakai-cle-test-api/drop_box.rb +0 -21
- data/lib/sakai-cle-test-api/email_archive.rb +1 -15
- data/lib/sakai-cle-test-api/forums.rb +8 -282
- data/lib/sakai-cle-test-api/gradebook.rb +1 -19
- data/lib/sakai-cle-test-api/gradebook2.rb +1 -15
- data/lib/sakai-cle-test-api/messages.rb +15 -551
- data/lib/sakai-cle-test-api/news.rb +1 -3
- data/lib/sakai-cle-test-api/polls.rb +3 -65
- data/lib/sakai-cle-test-api/profile.rb +2 -36
- data/lib/sakai-cle-test-api/profile2.rb +6 -315
- data/lib/sakai-cle-test-api/sections.rb +8 -198
- data/lib/sakai-cle-test-api/site_page_elements.rb +441 -4
- data/lib/sakai-cle-test-api/syllabus.rb +7 -149
- data/lib/sakai-cle-test-api/tools_menu.rb +20 -3
- data/lib/sakai-cle-test-api/utilities.rb +0 -260
- data/sakai-cle-test-api.gemspec +3 -2
- metadata +19 -21
- data/lib/sakai-cle-test-api/add_files.rb +0 -198
- data/lib/sakai-cle-test-api/chat_room.rb +0 -0
- data/lib/sakai-cle-test-api/core-ext.rb +0 -90
- data/lib/sakai-cle-test-api/data_objects/announcement.rb +0 -38
- data/lib/sakai-cle-test-api/data_objects/assessment.rb +0 -32
- data/lib/sakai-cle-test-api/data_objects/assignment.rb +0 -62
- data/lib/sakai-cle-test-api/data_objects/event.rb +0 -86
- data/lib/sakai-cle-test-api/data_objects/lesson.rb +0 -137
- data/lib/sakai-cle-test-api/data_objects/resource.rb +0 -174
- data/lib/sakai-cle-test-api/data_objects/site.rb +0 -213
- data/lib/sakai-cle-test-api/data_objects/syllabus.rb +0 -7
- data/lib/sakai-cle-test-api/data_objects/topic.rb +0 -0
- data/lib/sakai-cle-test-api/data_objects/web_content_tool.rb +0 -52
- data/lib/sakai-cle-test-api/data_objects/wiki.rb +0 -7
- data/lib/sakai-cle-test-api/gem_ext.rb +0 -45
- data/lib/sakai-cle-test-api/lessons.rb +0 -440
- data/lib/sakai-cle-test-api/resources.rb +0 -138
- data/lib/sakai-cle-test-api/rich_text.rb +0 -13
@@ -1,213 +0,0 @@
|
|
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
|
@@ -1,52 +0,0 @@
|
|
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
|
@@ -1,45 +0,0 @@
|
|
1
|
-
# Methods to extend the page-object gem...
|
2
|
-
module PageObject
|
3
|
-
module Elements
|
4
|
-
class Element
|
5
|
-
def disabled?
|
6
|
-
@element.disabled?
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
10
|
-
module Accessors
|
11
|
-
def thing element_name
|
12
|
-
raise "#{element_name} is being defined twice in #{self}!" if self.instance_methods.include?(element_name.to_sym)
|
13
|
-
define_method element_name.to_s do
|
14
|
-
yield self
|
15
|
-
end
|
16
|
-
end
|
17
|
-
alias item thing
|
18
|
-
alias value thing
|
19
|
-
alias action thing
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
# Need this to extend Watir to be able to attach to Sakai's non-standard tags...
|
24
|
-
module Watir
|
25
|
-
class Element
|
26
|
-
# attaches to the "headers" tags inside of the assignments table.
|
27
|
-
def headers
|
28
|
-
@how = :ole_object
|
29
|
-
return @o.headers
|
30
|
-
end
|
31
|
-
|
32
|
-
# attaches to the "for" tags in "label" tags.
|
33
|
-
def for
|
34
|
-
@how = :ole_object
|
35
|
-
return @o.for
|
36
|
-
end
|
37
|
-
|
38
|
-
# attaches to the "summary" tag
|
39
|
-
def summary
|
40
|
-
@how = :ole_object
|
41
|
-
return @o.summary
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
45
|
-
end
|
@@ -1,440 +0,0 @@
|
|
1
|
-
|
2
|
-
#================
|
3
|
-
# Lesson Pages
|
4
|
-
#================
|
5
|
-
|
6
|
-
# Contains items common to most Lessons pages.
|
7
|
-
module LessonsMenu
|
8
|
-
|
9
|
-
# Clicks on the Preferences link on the Lessons page,
|
10
|
-
# then instantiates the LessonPreferences class.
|
11
|
-
def preferences
|
12
|
-
frm.link(:text=>"Preferences").click
|
13
|
-
LessonPreferences.new(@browser)
|
14
|
-
end
|
15
|
-
|
16
|
-
def view
|
17
|
-
frm.link(:text=>"View").click
|
18
|
-
if frm.div(:class=>"meletePortletToolBarMessage").text=="Viewing student side..."
|
19
|
-
ViewModuleList.new(@browser)
|
20
|
-
else
|
21
|
-
#FIXME
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def manage
|
26
|
-
frm.link(:text=>"Manage").click
|
27
|
-
LessonManage.new(@browser)
|
28
|
-
end
|
29
|
-
|
30
|
-
def author
|
31
|
-
#FIXME
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
35
|
-
|
36
|
-
# The Lessons page in a site ("icon-sakai-melete")
|
37
|
-
#
|
38
|
-
# Note that this class is inclusive of both the
|
39
|
-
# Instructor/Admin and the Student views of this page
|
40
|
-
# many methods will error out if used when in the
|
41
|
-
# Student view.
|
42
|
-
class Lessons
|
43
|
-
|
44
|
-
include PageObject
|
45
|
-
include ToolsMenu
|
46
|
-
include LessonsMenu
|
47
|
-
|
48
|
-
# Clicks the Add Module link, then
|
49
|
-
# instantiates the AddModule class.
|
50
|
-
#
|
51
|
-
# Assumes the Add Module link is present
|
52
|
-
# and will error out if it is not.
|
53
|
-
def add_module
|
54
|
-
frm.link(:text=>"Add Module").click
|
55
|
-
AddEditModule.new(@browser)
|
56
|
-
end
|
57
|
-
|
58
|
-
# Clicks on the link that matches the supplied
|
59
|
-
# name value, then instantiates the
|
60
|
-
# AddEditLesson, or ViewLesson class, depending
|
61
|
-
# on which page loads.
|
62
|
-
#
|
63
|
-
# Will error out if there is no
|
64
|
-
# matching link in the list.
|
65
|
-
def open_lesson(name)
|
66
|
-
frm.link(:text=>name).click
|
67
|
-
if frm.div(:class=>"meletePortletToolBarMessage").exist? && frm.div(:class=>"meletePortletToolBarMessage").text=="Editing module..."
|
68
|
-
AddEditModule.new(@browser)
|
69
|
-
else
|
70
|
-
ViewModule.new(@browser)
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
# Returns an array of the Module titles displayed on the page.
|
75
|
-
def lessons_list
|
76
|
-
list = []
|
77
|
-
frm.table(:id=>/lis.+module.+form:table/).links.each do |link|
|
78
|
-
if link.id=~/lis.+module.+form:table:.+:(edit|view)Mod/
|
79
|
-
list << link.text
|
80
|
-
end
|
81
|
-
end
|
82
|
-
return list
|
83
|
-
end
|
84
|
-
|
85
|
-
# Returns and array containing the list of section titles for the
|
86
|
-
# specified module.
|
87
|
-
def sections_list(module_name)
|
88
|
-
list = []
|
89
|
-
if frm.table(:id=>/lis.+module.+form:table/).row(:text=>/#{Regexp.escape(module_name)}/).table(:id=>/tablesec/).exist?
|
90
|
-
frm.table(:id=>/lis.+module.+form:table/).row(:text=>/#{Regexp.escape(module_name)}/).table(:id=>/tablesec/).links.each do |link|
|
91
|
-
if link.id=~/Sec/
|
92
|
-
list << link.text
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
return list
|
97
|
-
end
|
98
|
-
|
99
|
-
end
|
100
|
-
|
101
|
-
# The student user's view of a Lesson Module or Section.
|
102
|
-
class ViewModule
|
103
|
-
|
104
|
-
include PageObject
|
105
|
-
include ToolsMenu
|
106
|
-
|
107
|
-
def sections_list
|
108
|
-
list = []
|
109
|
-
frm.table(:id=>"viewmoduleStudentform:tablesec").links.each { |link| list << link.text }
|
110
|
-
return list
|
111
|
-
end
|
112
|
-
|
113
|
-
def next
|
114
|
-
frm.link(:text=>"Next").click
|
115
|
-
ViewModule.new(@browser)
|
116
|
-
end
|
117
|
-
|
118
|
-
# Returns the text of the Module title row
|
119
|
-
def module_title
|
120
|
-
frm.span(:id=>/modtitle/).text
|
121
|
-
end
|
122
|
-
|
123
|
-
# Returns the text of the Section title row
|
124
|
-
def section_title
|
125
|
-
frm.span(:id=>/form:title/).text
|
126
|
-
end
|
127
|
-
|
128
|
-
def content_include?(content)
|
129
|
-
frm.form(:id=>"viewsectionStudentform").text.include?(content)
|
130
|
-
end
|
131
|
-
|
132
|
-
end
|
133
|
-
|
134
|
-
# This is the Instructor's preview of the Student's view
|
135
|
-
# of the list of Lesson Modules.
|
136
|
-
class ViewModuleList
|
137
|
-
|
138
|
-
include PageObject
|
139
|
-
include ToolsMenu
|
140
|
-
|
141
|
-
def open_lesson(name)
|
142
|
-
frm.link(:text=>name).click
|
143
|
-
LessonStudentSide.new(@browser)
|
144
|
-
end
|
145
|
-
|
146
|
-
def open_section(name)
|
147
|
-
frm.link(:text=>name).click
|
148
|
-
SectionStudentSide.new(@browser)
|
149
|
-
end
|
150
|
-
|
151
|
-
end
|
152
|
-
|
153
|
-
# The instructor's preview of the student view of the lesson.
|
154
|
-
class LessonStudentSide
|
155
|
-
|
156
|
-
include PageObject
|
157
|
-
include ToolsMenu
|
158
|
-
include LessonsMenu
|
159
|
-
|
160
|
-
end
|
161
|
-
|
162
|
-
# The instructor's preview of the student's view of the section.
|
163
|
-
class SectionStudentSide
|
164
|
-
|
165
|
-
include PageObject
|
166
|
-
include ToolsMenu
|
167
|
-
include LessonsMenu
|
168
|
-
|
169
|
-
end
|
170
|
-
|
171
|
-
# The Managing Options page for Lessons
|
172
|
-
class LessonManage
|
173
|
-
|
174
|
-
include PageObject
|
175
|
-
include ToolsMenu
|
176
|
-
include LessonsMenu
|
177
|
-
|
178
|
-
def manage_content
|
179
|
-
frm.link(:text=>"Manage Content").click
|
180
|
-
LessonManageContent.new(@browser)
|
181
|
-
end
|
182
|
-
|
183
|
-
def sort
|
184
|
-
frm.link(:text=>"Sort").click
|
185
|
-
LessonManageSort.new(@browser)
|
186
|
-
end
|
187
|
-
|
188
|
-
# Clicks the Import/Export button and
|
189
|
-
# instantiates the LessonImportExport class.
|
190
|
-
def import_export
|
191
|
-
frm.link(:text=>"Import/Export").click
|
192
|
-
LessonImportExport.new(@browser)
|
193
|
-
end
|
194
|
-
|
195
|
-
end
|
196
|
-
|
197
|
-
# The Sorting Modules and Sections page in Lessons
|
198
|
-
class LessonManageSort
|
199
|
-
|
200
|
-
include PageObject
|
201
|
-
include ToolsMenu
|
202
|
-
|
203
|
-
def view
|
204
|
-
frm.link(:text=>"View").click
|
205
|
-
if frm.div(:class=>"meletePortletToolBarMessage").text=="Viewing student side..."
|
206
|
-
ViewModuleList.new(@browser)
|
207
|
-
else
|
208
|
-
#FIXME
|
209
|
-
end
|
210
|
-
end
|
211
|
-
|
212
|
-
in_frame(:index=>1) do |frame|
|
213
|
-
link(:sort_modules, :id=>"SortSectionForm:sortmod", :frame=>frame)
|
214
|
-
link(:sort_sections, :id=>"SortModuleForm:sortsec", :frame=>frame)
|
215
|
-
|
216
|
-
end
|
217
|
-
end
|
218
|
-
|
219
|
-
# The Import/Export page in Manage Lessons for a Site
|
220
|
-
class LessonImportExport
|
221
|
-
|
222
|
-
include PageObject
|
223
|
-
include ToolsMenu
|
224
|
-
include LessonsMenu
|
225
|
-
|
226
|
-
# Uploads the file specified - meaning that it enters
|
227
|
-
# the target file information, then clicks the import
|
228
|
-
# button.
|
229
|
-
#
|
230
|
-
# The file path is an optional parameter.
|
231
|
-
def upload_IMS(file_name, file_path="")
|
232
|
-
frm.file_field(:name, "impfile").set(file_path + file_name)
|
233
|
-
frm.link(:id=>"importexportform:importModule").click
|
234
|
-
frm.table(:id=>"AutoNumber1").div(:text=>"Processing...").wait_while_present
|
235
|
-
end
|
236
|
-
|
237
|
-
# Returns the text of the alert box.
|
238
|
-
def alert_text
|
239
|
-
frm.span(:class=>"BlueClass").text
|
240
|
-
end
|
241
|
-
|
242
|
-
end
|
243
|
-
|
244
|
-
# The User preference options page for Lessons.
|
245
|
-
#
|
246
|
-
# Note that this class is inclusive of Student
|
247
|
-
# and Instructor views of the page. Thus,
|
248
|
-
# not all methods in the class will work
|
249
|
-
# at all times.
|
250
|
-
class LessonPreferences
|
251
|
-
|
252
|
-
include PageObject
|
253
|
-
include ToolsMenu
|
254
|
-
|
255
|
-
# Clicks the View button
|
256
|
-
# then instantiates the Lessons class.
|
257
|
-
def view
|
258
|
-
frm.link(:text=>"View").click
|
259
|
-
Lessons.new(@browser)
|
260
|
-
end
|
261
|
-
|
262
|
-
in_frame(:index=>1) do |frame|
|
263
|
-
radio_button(:expanded) { |page| page.radio_button_element(:name=>"UserPreferenceForm:_id5", :index=>0, :frame=>frame) }
|
264
|
-
radio_button(:collapsed) { |page| page.radio_button_element(:name=>"UserPreferenceForm:_id5", :index=>1, :frame=>frame) }
|
265
|
-
link(:set, :id=>"UserPreferenceForm:SetButton", :frame=>frame)
|
266
|
-
end
|
267
|
-
end
|
268
|
-
|
269
|
-
# This Class encompasses methods for both the Add and the Edit pages for Lesson Modules.
|
270
|
-
class AddEditModule
|
271
|
-
|
272
|
-
include PageObject
|
273
|
-
include ToolsMenu
|
274
|
-
|
275
|
-
# Clicks the Add button for the Lesson Module
|
276
|
-
# then instantiates the ConfirmModule class.
|
277
|
-
def add
|
278
|
-
frm.link(:id=>/ModuleForm:submitsave/).click
|
279
|
-
ConfirmModule.new(@browser)
|
280
|
-
end
|
281
|
-
|
282
|
-
def add_content_sections
|
283
|
-
frm.link(:id=>/ModuleForm:sectionButton/).click
|
284
|
-
AddEditContentSection.new(@browser)
|
285
|
-
end
|
286
|
-
|
287
|
-
in_frame(:index=>1) do |frame|
|
288
|
-
text_field(:title, :id=>/ModuleForm:title/, :frame=>frame)
|
289
|
-
text_area(:description, :id=>/ModuleForm:description/, :frame=>frame)
|
290
|
-
text_area(:keywords, :id=>/ModuleForm:keywords/, :frame=>frame)
|
291
|
-
text_field(:start_date, :id=>/ModuleForm:startDate/, :frame=>frame)
|
292
|
-
text_field(:end_date, :id=>/ModuleForm:endDate/, :frame=>frame)
|
293
|
-
end
|
294
|
-
end
|
295
|
-
|
296
|
-
# The confirmation page when you are saving a Lesson Module.
|
297
|
-
class ConfirmModule
|
298
|
-
|
299
|
-
include PageObject
|
300
|
-
include ToolsMenu
|
301
|
-
|
302
|
-
# Clicks the Add Content Sections button and
|
303
|
-
# instantiates the AddEditSection class.
|
304
|
-
def add_content_sections
|
305
|
-
frm.link(:id=>/ModuleConfirmForm:sectionButton/).click
|
306
|
-
AddEditSection.new(@browser)
|
307
|
-
end
|
308
|
-
|
309
|
-
# Clicks the Return to Modules button, then
|
310
|
-
# instantiates the AddEditModule class.
|
311
|
-
def return_to_modules
|
312
|
-
frm.link(:id=>/ModuleConfirmForm:returnButton/).click
|
313
|
-
AddEditModule.new(@browser)
|
314
|
-
end
|
315
|
-
|
316
|
-
end
|
317
|
-
|
318
|
-
# Page for adding a section to a Lesson.
|
319
|
-
class AddEditContentSection
|
320
|
-
|
321
|
-
include PageObject
|
322
|
-
include ToolsMenu
|
323
|
-
include FCKEditor
|
324
|
-
|
325
|
-
# Clicks the Add button on the page
|
326
|
-
# then instantiates the ConfirmSectionAdd class.
|
327
|
-
def add
|
328
|
-
frm.link(:id=>/SectionForm:submitsave/).click
|
329
|
-
ConfirmSectionAdd.new(@browser)
|
330
|
-
end
|
331
|
-
|
332
|
-
# Pointer to the Edit Text box of the FCKEditor
|
333
|
-
# on the page.
|
334
|
-
def content_editor
|
335
|
-
frm.frame(:id, "AddSectionForm:fckEditorView:otherMeletecontentEditor_inputRichText___Frame")
|
336
|
-
end
|
337
|
-
|
338
|
-
def add_content=(text)
|
339
|
-
content_editor.td(:id, "xEditingArea").frame(:index=>0).send_keys(text)
|
340
|
-
end
|
341
|
-
|
342
|
-
def source=(text)
|
343
|
-
content_editor.td(:id, "xEditingArea").text_field(:class=>"SourceField").set text
|
344
|
-
end
|
345
|
-
|
346
|
-
def clear_content
|
347
|
-
frm.frame(:id, "AddSectionForm:fckEditorView:otherMeletecontentEditor_inputRichText___Frame").div(:title=>"Select All").fire_event("onclick")
|
348
|
-
content_editor.send_keys :backspace
|
349
|
-
end
|
350
|
-
|
351
|
-
def select_url
|
352
|
-
frm.link(:id=>"AddSectionForm:ContentLinkView:serverViewButton").click
|
353
|
-
SelectingContent.new(@browser)
|
354
|
-
end
|
355
|
-
|
356
|
-
# This method clicks the Select button that appears on the page
|
357
|
-
# then calls the LessonAddAttachment class.
|
358
|
-
#
|
359
|
-
# It assumes that the Content Type selection box has
|
360
|
-
# already been updated to "Upload or link to a file in Resources".
|
361
|
-
def select_or_upload_file
|
362
|
-
frm.link(:id=>"AddSectionForm:ResourceHelperLinkView:serverViewButton").click
|
363
|
-
LessonAddAttachment.new(@browser)
|
364
|
-
end
|
365
|
-
|
366
|
-
# Clicks the select button for "Upload or link to a file"
|
367
|
-
# NOT for "Upload or link to a file in Resources"!
|
368
|
-
def select_a_file
|
369
|
-
frm.link(:id=>"AddSectionForm:ContentUploadView:serverViewButton").click
|
370
|
-
end
|
371
|
-
|
372
|
-
in_frame(:index=>1) do |frame|
|
373
|
-
text_field(:title, :id=>"AddSectionForm:title", :frame=>frame)
|
374
|
-
text_field(:instructions, :id=>"AddSectionForm:instr", :frame=>frame)
|
375
|
-
select_list(:content_type, :id=>"AddSectionForm:contentType", :frame=>frame)
|
376
|
-
select_list(:copyright_status, :id=>/SectionForm:ResourcePropertiesPanel:licenseCodes/, :frame=>frame)
|
377
|
-
checkbox(:auditory, :id=>"AddSectionForm:contentaudio", :frame=>frame)
|
378
|
-
checkbox(:textual, :id=>"AddSectionForm:contentext", :frame=>frame)
|
379
|
-
checkbox(:visual, :id=>"AddSectionForm:contentaudio", :frame=>frame)
|
380
|
-
text_field(:url_title, :id=>"AddSectionForm:ResourcePropertiesPanel:res_name", :frame=>frame)
|
381
|
-
text_field(:url_description, :id=>"AddSectionForm:ResourcePropertiesPanel:res_desc", :frame=>frame)
|
382
|
-
text_field(:file_description, :id=>"AddSectionForm:ResourcePropertiesPanel:res_desc", :frame=>frame)
|
383
|
-
end
|
384
|
-
end
|
385
|
-
|
386
|
-
# Confirmation page for Adding (or Editing)
|
387
|
-
# a Section to a Module in Lessons.
|
388
|
-
class ConfirmSectionAdd
|
389
|
-
|
390
|
-
include PageObject
|
391
|
-
include ToolsMenu
|
392
|
-
|
393
|
-
# Clicks the Add Another Section button
|
394
|
-
# then instantiates the AddSection class.
|
395
|
-
def add_another_section
|
396
|
-
frm.link(:id=>/SectionConfirmForm:saveAddAnotherbutton/).click
|
397
|
-
AddEditContentSection.new(@browser)
|
398
|
-
end
|
399
|
-
|
400
|
-
# Clicks the Finish button
|
401
|
-
# then instantiates the Lessons class.
|
402
|
-
def finish
|
403
|
-
frm.link(:id=>/Form:FinishButton/).click
|
404
|
-
Lessons.new(@browser)
|
405
|
-
end
|
406
|
-
|
407
|
-
end
|
408
|
-
|
409
|
-
#
|
410
|
-
class SelectingContent
|
411
|
-
|
412
|
-
include PageObject
|
413
|
-
include ToolsMenu
|
414
|
-
|
415
|
-
def continue
|
416
|
-
frm.link(:id=>"ServerViewForm:addButton").click
|
417
|
-
AddEditContentSection.new(@browser)
|
418
|
-
end
|
419
|
-
|
420
|
-
in_frame(:index=>1) do |frame|
|
421
|
-
text_field(:new_url, :id=>"ServerViewForm:link", :frame=>frame)
|
422
|
-
text_field(:url_title, :id=>"ServerViewForm:link_title", :frame=>frame)
|
423
|
-
end
|
424
|
-
end
|
425
|
-
|
426
|
-
#
|
427
|
-
class LessonAddAttachment
|
428
|
-
|
429
|
-
include ToolsMenu
|
430
|
-
include PageObject
|
431
|
-
|
432
|
-
def continue
|
433
|
-
frm.link(:id=>"UploadServerViewForm:addButton").click
|
434
|
-
end
|
435
|
-
|
436
|
-
def upload_local_file(filename, filepath="")
|
437
|
-
frm.file_field(:id=>"file1").set(filepath + filename)
|
438
|
-
end
|
439
|
-
|
440
|
-
end
|