sambal-cle 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +7 -0
- data/Gemfile.lock +44 -0
- data/lib/sambal-cle/data_objects/announcement.rb +7 -7
- data/lib/sambal-cle/data_objects/assessment.rb +26 -77
- data/lib/sambal-cle/data_objects/assessment_submission.rb +26 -0
- data/lib/sambal-cle/data_objects/assignment.rb +40 -40
- data/lib/sambal-cle/data_objects/assignment_permissions.rb +4 -4
- data/lib/sambal-cle/data_objects/assignment_submission.rb +4 -4
- data/lib/sambal-cle/data_objects/blog.rb +2 -2
- data/lib/sambal-cle/data_objects/blogger.rb +3 -3
- data/lib/sambal-cle/data_objects/chat_room.rb +2 -2
- data/lib/sambal-cle/data_objects/{site.rb → course.rb} +24 -20
- data/lib/sambal-cle/data_objects/event.rb +4 -4
- data/lib/sambal-cle/data_objects/forum.rb +21 -22
- data/lib/sambal-cle/data_objects/glossary_term.rb +71 -0
- data/lib/sambal-cle/data_objects/lesson.rb +10 -9
- data/lib/sambal-cle/data_objects/matrix.rb +142 -0
- data/lib/sambal-cle/data_objects/message.rb +2 -2
- data/lib/sambal-cle/data_objects/poll.rb +2 -2
- data/lib/sambal-cle/data_objects/portfolio.rb +120 -0
- data/lib/sambal-cle/data_objects/questions.rb +690 -0
- data/lib/sambal-cle/data_objects/resource.rb +12 -12
- data/lib/sambal-cle/data_objects/syllabus.rb +7 -7
- data/lib/sambal-cle/data_objects/web_content_tool.rb +2 -2
- data/lib/sambal-cle/data_objects/wiki.rb +6 -6
- data/lib/sambal-cle/page_objects/assessments.rb +165 -157
- data/lib/sambal-cle/page_objects/assignments.rb +17 -17
- data/lib/sambal-cle/page_objects/glossary.rb +14 -64
- data/lib/sambal-cle/page_objects/matrix.rb +77 -113
- data/lib/sambal-cle/page_objects/portfolios.rb +0 -2
- data/lib/sambal-cle/page_objects/resources.rb +4 -4
- data/lib/sambal-cle/page_objects/site_setup.rb +31 -23
- data/lib/sambal-cle/page_objects/sites.rb +2 -12
- data/lib/sambal-cle/utilities.rb +0 -6
- data/lib/sambal-cle/workflows.rb +77 -76
- data/lib/sambal-cle.rb +2 -2
- data/sambal-cle.gemspec +2 -2
- data/test/add_assignment_to_calendar_spec.rb +4 -4
- data/test/assessment_create_spec.rb +1 -1
- data/test/assessment_feedback_spec.rb +78 -0
- data/test/assessment_publish_spec.rb +102 -0
- data/test/assignment_announcements_spec.rb +4 -4
- data/test/assignment_duplicate_spec.rb +4 -4
- data/test/assignment_gradebook_spec.rb +4 -4
- data/test/assignment_permissions_spec.rb +5 -5
- data/test/assignments_grading_spec.rb +4 -4
- data/test/assignments_submission_spec.rb +4 -4
- data/test/duplicate_site_spec.rb +2 -2
- data/test/glossary_term_create_spec.rb +71 -0
- data/test/import_site_content_spec.rb +3 -3
- data/test/test_spec.rb +51 -0
- metadata +16 -5
@@ -24,28 +24,28 @@ class ForumObject
|
|
24
24
|
alias :name :title
|
25
25
|
|
26
26
|
def create
|
27
|
-
open_my_site_by_name
|
28
|
-
forums
|
27
|
+
open_my_site_by_name
|
28
|
+
forums
|
29
29
|
on Forums do |forums|
|
30
30
|
forums.new_forum
|
31
31
|
end
|
32
32
|
on EditForum do |edit|
|
33
33
|
edit.title.set @title
|
34
|
-
edit.short_description.
|
34
|
+
edit.short_description.fit @short_description
|
35
35
|
edit.enter_source_text(edit.editor, @description) unless @description==nil
|
36
36
|
edit.save
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
40
|
def edit opts={}
|
41
|
-
open_my_site_by_name @site
|
41
|
+
open_my_site_by_name @site
|
42
42
|
forums unless @browser.title=~/Forums$/
|
43
43
|
on Forums do |forum|
|
44
44
|
forum.forum_settings @title
|
45
45
|
end
|
46
46
|
on EditForum do |edit|
|
47
|
-
edit.title.
|
48
|
-
edit.short_description.
|
47
|
+
edit.title.fit opts[:title]
|
48
|
+
edit.short_description.fit opts[:short_description]
|
49
49
|
unless opts[:description] == nil
|
50
50
|
edit.enter_source_text edit.editor, opts[:description]
|
51
51
|
end
|
@@ -55,8 +55,8 @@ class ForumObject
|
|
55
55
|
end
|
56
56
|
|
57
57
|
def view
|
58
|
-
open_my_site_by_name @site
|
59
|
-
forums
|
58
|
+
open_my_site_by_name @site
|
59
|
+
forums
|
60
60
|
on Forums do |forum|
|
61
61
|
forum.open_forum @title
|
62
62
|
end
|
@@ -72,8 +72,8 @@ class ForumObject
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def get_entity_info
|
75
|
-
open_my_site_by_name @site
|
76
|
-
forums
|
75
|
+
open_my_site_by_name @site
|
76
|
+
forums
|
77
77
|
# TODO: Something will probably be needed here, in case we're currently
|
78
78
|
# on a Forum page already.
|
79
79
|
on Forums do |forum|
|
@@ -117,15 +117,14 @@ class TopicObject
|
|
117
117
|
options = defaults.merge(opts)
|
118
118
|
|
119
119
|
set_options(options)
|
120
|
-
|
121
|
-
raise "You must specify an existing Forum for your Topic" if @forum==nil
|
120
|
+
requires @site, @forum
|
122
121
|
end
|
123
122
|
|
124
123
|
alias :name :title
|
125
124
|
|
126
125
|
def create
|
127
|
-
open_my_site_by_name @site
|
128
|
-
forums
|
126
|
+
open_my_site_by_name @site
|
127
|
+
forums
|
129
128
|
on Forums do |forums|
|
130
129
|
forums.new_topic_for_forum @forum
|
131
130
|
end
|
@@ -138,15 +137,15 @@ class TopicObject
|
|
138
137
|
end
|
139
138
|
|
140
139
|
def edit opts={}
|
141
|
-
open_my_site_by_name @site
|
142
|
-
forums
|
140
|
+
open_my_site_by_name @site
|
141
|
+
forums
|
143
142
|
on Forums do |forum|
|
144
143
|
reset
|
145
144
|
forum.topic_settings @title
|
146
145
|
end
|
147
146
|
on AddEditTopic do |edit|
|
148
|
-
edit.title.
|
149
|
-
edit.short_description.
|
147
|
+
edit.title.fit opts[:title]
|
148
|
+
edit.short_description.fit opts[:short_description]
|
150
149
|
unless opts[:description] == nil
|
151
150
|
edit.enter_source_text edit.editor, opts[:description]
|
152
151
|
end
|
@@ -156,8 +155,8 @@ class TopicObject
|
|
156
155
|
end
|
157
156
|
|
158
157
|
def view
|
159
|
-
open_my_site_by_name @site
|
160
|
-
forums
|
158
|
+
open_my_site_by_name @site
|
159
|
+
forums
|
161
160
|
on Forums do |forum|
|
162
161
|
reset
|
163
162
|
forum.open_topic @title
|
@@ -174,8 +173,8 @@ class TopicObject
|
|
174
173
|
end
|
175
174
|
|
176
175
|
def get_entity_info
|
177
|
-
open_my_site_by_name @site
|
178
|
-
forums
|
176
|
+
open_my_site_by_name @site
|
177
|
+
forums
|
179
178
|
on Forums do |forums|
|
180
179
|
forums.topic_settings @title
|
181
180
|
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
class GlossaryTermObject
|
2
|
+
|
3
|
+
include Foundry
|
4
|
+
include DataFactory
|
5
|
+
include StringFactory
|
6
|
+
include Workflows
|
7
|
+
|
8
|
+
attr_accessor :term, :short_description, :long_description, :portfolio
|
9
|
+
|
10
|
+
def initialize(browser, opts={})
|
11
|
+
@browser = browser
|
12
|
+
|
13
|
+
defaults = {
|
14
|
+
:term=>random_alphanums,
|
15
|
+
:short_description=>random_alphanums,
|
16
|
+
:long_description=>random_alphanums
|
17
|
+
}
|
18
|
+
options = defaults.merge(opts)
|
19
|
+
|
20
|
+
set_options(options)
|
21
|
+
requires @portfolio
|
22
|
+
end
|
23
|
+
|
24
|
+
def create
|
25
|
+
open_my_site_by_name @portfolio
|
26
|
+
glossary
|
27
|
+
on Glossary do |list|
|
28
|
+
list.add
|
29
|
+
end
|
30
|
+
on AddEditTerm do |term|
|
31
|
+
term.term.set @term
|
32
|
+
term.short_description.set @short_description
|
33
|
+
term.long_description=@long_description
|
34
|
+
term.add_term
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def edit opts={}
|
39
|
+
open_my_site_by_name @portfolio
|
40
|
+
glossary
|
41
|
+
on Glossary do |list|
|
42
|
+
list.edit @term
|
43
|
+
end
|
44
|
+
on AddEditTerm do |term|
|
45
|
+
term.term.fit opts[:term]
|
46
|
+
term.short_description.fit opts[:short_description]
|
47
|
+
term.long_description=opts[:long_description] unless opts[:long_description]==nil
|
48
|
+
term.save_changes
|
49
|
+
end
|
50
|
+
set_options(opts)
|
51
|
+
end
|
52
|
+
|
53
|
+
def open
|
54
|
+
open_my_site_by_name @portfolio
|
55
|
+
glossary
|
56
|
+
on Glossary do |list|
|
57
|
+
list.open @term
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def delete
|
62
|
+
open_my_site_by_name @portfolio
|
63
|
+
glossary
|
64
|
+
on Glossary do |list|
|
65
|
+
list.delete @term
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
|
@@ -21,8 +21,8 @@ class ModuleObject
|
|
21
21
|
alias :name :title
|
22
22
|
|
23
23
|
def create
|
24
|
-
open_my_site_by_name @site
|
25
|
-
lessons
|
24
|
+
open_my_site_by_name @site
|
25
|
+
lessons
|
26
26
|
reset
|
27
27
|
on_page Lessons do |page|
|
28
28
|
page.add_module
|
@@ -74,8 +74,8 @@ class ContentSectionObject
|
|
74
74
|
alias :name :title
|
75
75
|
|
76
76
|
def create
|
77
|
-
open_my_site_by_name @site
|
78
|
-
lessons
|
77
|
+
open_my_site_by_name @site
|
78
|
+
lessons
|
79
79
|
reset
|
80
80
|
on_page Lessons do |page|
|
81
81
|
page.open_lesson @module
|
@@ -89,12 +89,13 @@ class ContentSectionObject
|
|
89
89
|
@modality.each do |content|
|
90
90
|
page.send(content)
|
91
91
|
end
|
92
|
-
page.content_type.
|
92
|
+
page.content_type.fit @content_type
|
93
93
|
end
|
94
94
|
|
95
95
|
on AddEditContentSection do |page| # Note we are reinstantiating the class here because of
|
96
96
|
# an issue with Selenium Webdriver throwing a
|
97
97
|
# WeakReference error, given the partial page reload.
|
98
|
+
# TODO: Figure out if there's a better solution for this
|
98
99
|
case @content_type
|
99
100
|
when "Compose content with editor"
|
100
101
|
page.enter_source_text page.content_editor, @editor_content
|
@@ -135,16 +136,16 @@ class ContentSectionObject
|
|
135
136
|
end
|
136
137
|
|
137
138
|
def edit opts={}
|
138
|
-
open_my_site_by_name @site
|
139
|
-
lessons
|
139
|
+
open_my_site_by_name @site
|
140
|
+
lessons
|
140
141
|
reset
|
141
142
|
on Lessons do |list|
|
142
143
|
list.check_section @title
|
143
144
|
list.edit
|
144
145
|
end
|
145
146
|
on AddEditContentSection do |edit|
|
146
|
-
edit.title.
|
147
|
-
edit.instructions.
|
147
|
+
edit.title.fit opts[:title]
|
148
|
+
edit.instructions.fit opts[:instructions]
|
148
149
|
if opts[:modality].class==Array
|
149
150
|
opts[:modality].each do |item|
|
150
151
|
edit.send(item)
|
@@ -0,0 +1,142 @@
|
|
1
|
+
class MatrixObject
|
2
|
+
|
3
|
+
include Foundry
|
4
|
+
include DataFactory
|
5
|
+
include StringFactory
|
6
|
+
include Workflows
|
7
|
+
|
8
|
+
attr_accessor :portfolio, :title, :description, :columns, :rows, :status, :cells
|
9
|
+
|
10
|
+
def initialize(browser, opts={})
|
11
|
+
@browser = browser
|
12
|
+
|
13
|
+
defaults = {
|
14
|
+
:title=>random_alphanums,
|
15
|
+
:description=>random_alphanums,
|
16
|
+
:columns=>[
|
17
|
+
{:name=>random_alphanums, :bg_color=>random_hex_color, :font_color=>random_hex_color},
|
18
|
+
{:name=>random_alphanums, :bg_color=>random_hex_color, :font_color=>random_hex_color},
|
19
|
+
{:name=>random_alphanums, :bg_color=>random_hex_color, :font_color=>random_hex_color}
|
20
|
+
],
|
21
|
+
:rows=>[
|
22
|
+
{:name=>random_alphanums, :bg_color=>random_hex_color, :font_color=>random_hex_color},
|
23
|
+
{:name=>random_alphanums, :bg_color=>random_hex_color, :font_color=>random_hex_color},
|
24
|
+
{:name=>random_alphanums, :bg_color=>random_hex_color, :font_color=>random_hex_color}
|
25
|
+
],
|
26
|
+
:cells=>[]
|
27
|
+
}
|
28
|
+
options = defaults.merge(opts)
|
29
|
+
set_options(options)
|
30
|
+
requires @portfolio
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
def create
|
35
|
+
open_my_site_by_name @portfolio
|
36
|
+
matrices
|
37
|
+
on Matrices do |list|
|
38
|
+
list.add
|
39
|
+
end
|
40
|
+
on AddEditMatrix do |add|
|
41
|
+
add.title.set @title
|
42
|
+
|
43
|
+
# TODO Add filling in the non-essential fields.
|
44
|
+
|
45
|
+
end
|
46
|
+
@columns.each do |column|
|
47
|
+
on AddEditMatrix do |add|
|
48
|
+
add.add_column
|
49
|
+
end
|
50
|
+
on AddEditColumn do |add|
|
51
|
+
add.name.set column[:name]
|
52
|
+
add.background_color.set column[:bg_color]
|
53
|
+
add.font_color.set column[:font_color]
|
54
|
+
add.update
|
55
|
+
end
|
56
|
+
end
|
57
|
+
@rows.each do |row|
|
58
|
+
on AddEditMatrix do |add|
|
59
|
+
add.add_row
|
60
|
+
end
|
61
|
+
on AddEditRow do |add|
|
62
|
+
add.name.set row[:name]
|
63
|
+
add.background_color.set row[:bg_color]
|
64
|
+
add.font_color.set row[:font_color]
|
65
|
+
add.update
|
66
|
+
end
|
67
|
+
end
|
68
|
+
on AddEditMatrix do |add|
|
69
|
+
add.save_changes
|
70
|
+
end
|
71
|
+
on EditMatrixCells do |matrix|
|
72
|
+
matrix.return_to_list
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def edit opts={}
|
77
|
+
|
78
|
+
set_options(opts)
|
79
|
+
end
|
80
|
+
|
81
|
+
def view
|
82
|
+
|
83
|
+
end
|
84
|
+
|
85
|
+
def delete
|
86
|
+
|
87
|
+
end
|
88
|
+
|
89
|
+
def publish
|
90
|
+
|
91
|
+
end
|
92
|
+
|
93
|
+
def export
|
94
|
+
|
95
|
+
end
|
96
|
+
|
97
|
+
end
|
98
|
+
|
99
|
+
class CellObject
|
100
|
+
|
101
|
+
include Foundry
|
102
|
+
include DataFactory
|
103
|
+
include StringFactory
|
104
|
+
include Workflows
|
105
|
+
|
106
|
+
attr_accessor :title, :instructions, :rationale, :examples, :matrix, :row, :column, :id
|
107
|
+
|
108
|
+
def initialize(browser, opts={})
|
109
|
+
@browser = browser
|
110
|
+
|
111
|
+
defaults = {
|
112
|
+
:title=>random_alphanums,
|
113
|
+
:instructions=>random_alphanums,
|
114
|
+
:rationale=>random_alphanums,
|
115
|
+
:examples=>random_alphanums
|
116
|
+
}
|
117
|
+
options = defaults.merge(opts)
|
118
|
+
|
119
|
+
set_options(options)
|
120
|
+
requires @matrix, @row, @column
|
121
|
+
end
|
122
|
+
|
123
|
+
def create
|
124
|
+
#:id=>cell.html[/(?<=hrefViewCell\(\').+(?=')/]
|
125
|
+
end
|
126
|
+
|
127
|
+
def edit opts={}
|
128
|
+
|
129
|
+
set_options(opts)
|
130
|
+
end
|
131
|
+
|
132
|
+
def view
|
133
|
+
|
134
|
+
end
|
135
|
+
|
136
|
+
def delete
|
137
|
+
|
138
|
+
end
|
139
|
+
|
140
|
+
end
|
141
|
+
|
142
|
+
|
@@ -0,0 +1,120 @@
|
|
1
|
+
class PortfolioSiteObject
|
2
|
+
|
3
|
+
include Foundry
|
4
|
+
include DataFactory
|
5
|
+
include DateFactory
|
6
|
+
include StringFactory
|
7
|
+
include Workflows
|
8
|
+
|
9
|
+
attr_accessor :title, :description, :short_description, :contact_email, :site_email,
|
10
|
+
:site_contact_name, :access, :default_role, :creator, :status,
|
11
|
+
:creation_date, :id, :participants
|
12
|
+
|
13
|
+
def initialize(browser, opts={})
|
14
|
+
@browser = browser
|
15
|
+
|
16
|
+
defaults = {
|
17
|
+
:title=>random_alphanums,
|
18
|
+
:site_email=>random_nicelink(32),
|
19
|
+
:participants=>{}
|
20
|
+
}
|
21
|
+
options = defaults.merge(opts)
|
22
|
+
|
23
|
+
set_options(options)
|
24
|
+
requires @title
|
25
|
+
end
|
26
|
+
|
27
|
+
def create
|
28
|
+
my_workspace
|
29
|
+
site_setup
|
30
|
+
on_page SiteSetup do |page|
|
31
|
+
page.new
|
32
|
+
end
|
33
|
+
on SiteType do |page|
|
34
|
+
# Select the Portfolio Site radio button
|
35
|
+
page.portfolio_site.set
|
36
|
+
page.continue
|
37
|
+
end
|
38
|
+
on PortfolioSiteInfo do |info|
|
39
|
+
info.title.set @title
|
40
|
+
info.description=@description unless @description==nil
|
41
|
+
info.short_description.fit @short_description
|
42
|
+
#TODO Add support for other fields here
|
43
|
+
info.continue
|
44
|
+
end
|
45
|
+
on PortfolioSiteTools do |tools|
|
46
|
+
# TODO Add support for individual tool selection and reuse of material from other sites
|
47
|
+
tools.all_tools.set
|
48
|
+
tools.continue
|
49
|
+
end
|
50
|
+
on PortfolioConfigureToolOptions do |options|
|
51
|
+
options.email.set @site_email
|
52
|
+
# TODO Add support for other fields here
|
53
|
+
options.continue
|
54
|
+
end
|
55
|
+
on SiteAccess do |access|
|
56
|
+
# TODO Support non-default selections here
|
57
|
+
access.continue
|
58
|
+
end
|
59
|
+
on ConfirmSiteSetup do |confirm|
|
60
|
+
if confirm.request_button.present?
|
61
|
+
confirm.request_site
|
62
|
+
else
|
63
|
+
confirm.create_site
|
64
|
+
end
|
65
|
+
end
|
66
|
+
# TODO: Add definition of @participants variable here
|
67
|
+
# Create a string that will match the new Site's "creation date" string
|
68
|
+
@creation_date = right_now[:sakai]
|
69
|
+
|
70
|
+
on SiteSetup do |site_setup|
|
71
|
+
site_setup.search(Regexp.escape(@title))
|
72
|
+
|
73
|
+
# Get the site id for storage
|
74
|
+
@browser.frame(:class=>"portletMainIframe").link(:href=>/xsl-portal.site/, :index=>0).href =~ /(?<=\/site\/).+/
|
75
|
+
@id = $~.to_s
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def edit opts={}
|
80
|
+
|
81
|
+
set_options(opts)
|
82
|
+
end
|
83
|
+
|
84
|
+
def view
|
85
|
+
|
86
|
+
end
|
87
|
+
|
88
|
+
def delete
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
def add_official_participants(role, *participants)
|
93
|
+
list_of_ids=participants.join("\n")
|
94
|
+
open_my_site_by_name @title
|
95
|
+
site_editor
|
96
|
+
on SiteEditor do |site|
|
97
|
+
site.add_participants
|
98
|
+
end
|
99
|
+
on SiteSetupAddParticipants do |add|
|
100
|
+
add.official_participants.set list_of_ids
|
101
|
+
add.continue
|
102
|
+
end
|
103
|
+
on SiteSetupChooseRole do |choose|
|
104
|
+
choose.radio_button(role).set
|
105
|
+
choose.continue
|
106
|
+
end
|
107
|
+
on SiteSetupParticipantEmail do |send|
|
108
|
+
send.continue
|
109
|
+
end
|
110
|
+
on SiteSetupParticipantConfirm do |confirm|
|
111
|
+
confirm.finish
|
112
|
+
end
|
113
|
+
if @participants.has_key?(role)
|
114
|
+
@participants[role].insert(-1, participants).flatten!
|
115
|
+
else
|
116
|
+
@participants.store(role, participants)
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
end
|