sambal-cle 0.1.3 → 0.1.4
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 +3 -1
- data/lib/sambal-cle/base_page.rb +3 -1
- data/lib/sambal-cle/data_objects/announcement.rb +7 -10
- data/lib/sambal-cle/data_objects/assessment.rb +265 -9
- data/lib/sambal-cle/data_objects/assignment.rb +38 -32
- data/lib/sambal-cle/data_objects/assignment_permissions.rb +61 -0
- data/lib/sambal-cle/data_objects/assignment_submission.rb +126 -0
- data/lib/sambal-cle/data_objects/blog.rb +4 -7
- data/lib/sambal-cle/data_objects/blogger.rb +4 -10
- data/lib/sambal-cle/data_objects/chat_room.rb +5 -8
- data/lib/sambal-cle/data_objects/event.rb +6 -17
- data/lib/sambal-cle/data_objects/forum.rb +9 -19
- data/lib/sambal-cle/data_objects/lesson.rb +8 -29
- data/lib/sambal-cle/data_objects/message.rb +7 -10
- data/lib/sambal-cle/data_objects/poll.rb +6 -11
- data/lib/sambal-cle/data_objects/resource.rb +28 -37
- data/lib/sambal-cle/data_objects/site.rb +6 -17
- data/lib/sambal-cle/data_objects/syllabus.rb +6 -8
- data/lib/sambal-cle/data_objects/user.rb +88 -0
- data/lib/sambal-cle/data_objects/web_content_tool.rb +5 -6
- data/lib/sambal-cle/data_objects/wiki.rb +6 -6
- data/lib/sambal-cle/page_objects/account.rb +0 -2
- data/lib/sambal-cle/page_objects/announcements.rb +0 -1
- data/lib/sambal-cle/page_objects/assessments.rb +57 -87
- data/lib/sambal-cle/page_objects/assignments.rb +117 -337
- data/lib/sambal-cle/page_objects/calendar.rb +0 -2
- data/lib/sambal-cle/page_objects/login.rb +3 -9
- data/lib/sambal-cle/page_objects/sections.rb +2 -3
- data/lib/sambal-cle/page_objects/site_setup.rb +9 -19
- data/lib/sambal-cle/rich_text.rb +6 -0
- data/lib/sambal-cle/utilities.rb +4 -10
- data/lib/sambal-cle/workflows.rb +1 -5
- data/lib/sambal-cle.rb +2 -10
- data/sambal-cle.gemspec +7 -8
- data/test/add_assignment_to_calendar_spec.rb +14 -15
- data/test/assessment_create_spec.rb +355 -0
- data/test/assignment_announcements_spec.rb +14 -15
- data/test/assignment_duplicate_spec.rb +56 -0
- data/test/assignment_gradebook_spec.rb +16 -15
- data/test/assignment_permissions_spec.rb +77 -0
- data/test/assignments_grading_spec.rb +123 -0
- data/test/assignments_submission_spec.rb +143 -0
- data/test/config.yml +3 -0
- data/test/directory.yml +120 -0
- data/test/duplicate_site_spec.rb +5 -3
- data/test/import_site_content_spec.rb +248 -0
- metadata +22 -31
- data/lib/sambal-cle/core-ext.rb +0 -90
- data/lib/sambal-cle/date_makers.rb +0 -118
- data/lib/sambal-cle/gem_ext.rb +0 -23
- data/lib/sambal-cle/page_helper.rb +0 -22
- data/lib/sambal-cle/page_maker.rb +0 -48
- data/lib/sambal-cle/randomizers.rb +0 -117
@@ -0,0 +1,123 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'sambal-cle'
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
describe "Assignments grading" do
|
6
|
+
|
7
|
+
include Utilities
|
8
|
+
include Workflows
|
9
|
+
include Foundry
|
10
|
+
include StringFactory
|
11
|
+
include DateFactory
|
12
|
+
|
13
|
+
before :all do
|
14
|
+
|
15
|
+
# Get the test configuration data
|
16
|
+
@config = YAML.load_file("config.yml")
|
17
|
+
@directory = YAML.load_file("directory.yml")
|
18
|
+
@sakai = SakaiCLE.new(@config['browser'], @config['url'])
|
19
|
+
@browser = @sakai.browser
|
20
|
+
|
21
|
+
@student = make UserObject, :id=>@directory['person1']['id'], :password=>@directory['person1']['password'],
|
22
|
+
:first_name=>@directory['person1']['firstname'], :last_name=>@directory['person1']['lastname']
|
23
|
+
@instructor1 = make UserObject, :id=>@directory['person3']['id'], :password=>@directory['person3']['password'],
|
24
|
+
:first_name=>@directory['person3']['firstname'], :last_name=>@directory['person3']['lastname'],
|
25
|
+
:type=>"Instructor"
|
26
|
+
@instructor2 = make UserObject, :id=>@directory['person4']['id'], :password=>@directory['person4']['password'],
|
27
|
+
:first_name=>@directory['person4']['firstname'], :last_name=>@directory['person4']['lastname'],
|
28
|
+
:type=>"Instructor"
|
29
|
+
@instructor1.log_in
|
30
|
+
|
31
|
+
@site = make SiteObject
|
32
|
+
@site.create
|
33
|
+
@site.add_official_participants :role=>@student.type, :participants=>[@student.id]
|
34
|
+
@site.add_official_participants :role=>@instructor2.type, :participants=>[@instructor2.id]
|
35
|
+
|
36
|
+
@assignment = make AssignmentObject, :site=>@site.name, :title=>random_string(25),
|
37
|
+
:open=>an_hour_ago, :grade_scale=>"Pass",
|
38
|
+
:instructions=>random_multiline(50, 15, :string)
|
39
|
+
@submission = make AssignmentSubmissionObject, :site=>@site.name, :title=>@assignment.title,
|
40
|
+
:student=>@student
|
41
|
+
@assignment2 = make AssignmentObject, :site=>@site.name, :title=>random_string(25),
|
42
|
+
:open=>an_hour_ago, :grade_scale=>"Letter grade"
|
43
|
+
@submission2 = make AssignmentSubmissionObject, :site=>@site.name, :title=>@assignment2.title,
|
44
|
+
:student=>@student
|
45
|
+
@assignment.create
|
46
|
+
@assignment2.create
|
47
|
+
|
48
|
+
@instructor1.log_out
|
49
|
+
|
50
|
+
@student.log_in
|
51
|
+
|
52
|
+
@submission.submit
|
53
|
+
@submission2.submit
|
54
|
+
|
55
|
+
@student.log_out
|
56
|
+
|
57
|
+
end
|
58
|
+
=begin
|
59
|
+
after :all do
|
60
|
+
# Close the browser window
|
61
|
+
@sakai.browser.close
|
62
|
+
end
|
63
|
+
=end
|
64
|
+
it "Assignment can be graded" do
|
65
|
+
@instructor1.log_in
|
66
|
+
@submission.grade_submission :summary_comment=>random_alphanums, :grade=>"Fail",
|
67
|
+
:inline_comment=>random_alphanums, :allow_resubmission=>:set,
|
68
|
+
:release_to_student=>"yes"
|
69
|
+
@submission2.grade_submission :grade=>"C", :inline_comment=>random_alphanums,
|
70
|
+
:summary_comment=>random_alphanums
|
71
|
+
@instructor1.log_out
|
72
|
+
end
|
73
|
+
|
74
|
+
it "The graded assignment's status is based on whether it was released" do
|
75
|
+
@student.log_in
|
76
|
+
open_my_site_by_name @submission.site
|
77
|
+
assignments
|
78
|
+
on AssignmentsList do |list|
|
79
|
+
list.status_of(@submission2).should=="#{@submission2.status} #{@submission2.submission_date}"
|
80
|
+
list.status_of(@submission).should=="Returned"
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
it "Assignment grade can be released to the student" do
|
85
|
+
|
86
|
+
@submission.open
|
87
|
+
on AssignmentStudentView do |view|
|
88
|
+
view.summary_info["Grade"].should==@submission.grade
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
it "Assignments can be resubmitted if instructor allows" do
|
93
|
+
on AssignmentStudentView do |view|
|
94
|
+
view.summary_info["Status"].should=="Return #{@submission.returned[:sakai]}"
|
95
|
+
view.summary_info["Number of resubmissions allowed"].should==@submission.num_resubmissions
|
96
|
+
view.summary_info["Accept Resubmission Until"].should==@submission.accept_until[:sakai_rounded]
|
97
|
+
view.resubmit_button.should_be present
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
it "Student can read instructor comments for returned assignments" do
|
102
|
+
on AssignmentStudentView do |view|
|
103
|
+
view.instructions.should==@assignment.instructions
|
104
|
+
view.instructor_comments.should==@submission.summary_comment
|
105
|
+
view.submission_text.should include @submission.inline_comment
|
106
|
+
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
it "Students can't see grade or instructor comments until released" do
|
111
|
+
@submission2.open
|
112
|
+
on AssignmentStudentView do |view|
|
113
|
+
view.summary_info["Grade"].should==nil
|
114
|
+
view.instructor_comment_field.should_not be_present
|
115
|
+
view.submission_text.should_not include @submission2.inline_comment
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
# TODO: Other tests to add:
|
120
|
+
# - Assignment resubmissions from the Grade page are per student, not global
|
121
|
+
# - Tests of the second submission: Does it not allow any more?
|
122
|
+
|
123
|
+
end
|
@@ -0,0 +1,143 @@
|
|
1
|
+
# coding: UTF-8
|
2
|
+
require 'rspec'
|
3
|
+
require 'sambal-cle'
|
4
|
+
require 'yaml'
|
5
|
+
|
6
|
+
describe "Assignments Submission" do
|
7
|
+
|
8
|
+
include Utilities
|
9
|
+
include Workflows
|
10
|
+
include Foundry
|
11
|
+
include StringFactory
|
12
|
+
include DateFactory
|
13
|
+
|
14
|
+
before :all do
|
15
|
+
|
16
|
+
# Get the test configuration data
|
17
|
+
@config = YAML.load_file("config.yml")
|
18
|
+
@directory = YAML.load_file("directory.yml")
|
19
|
+
@sakai = SakaiCLE.new(@config['browser'], @config['url'])
|
20
|
+
@browser = @sakai.browser
|
21
|
+
|
22
|
+
@student = make UserObject, :id=>@directory['person1']['id'], :password=>@directory['person1']['password'],
|
23
|
+
:first_name=>@directory['person1']['firstname'], :last_name=>@directory['person1']['lastname']
|
24
|
+
@instructor1 = make UserObject, :id=>@directory['person3']['id'], :password=>@directory['person3']['password'],
|
25
|
+
:first_name=>@directory['person3']['firstname'], :last_name=>@directory['person3']['lastname'],
|
26
|
+
:type=>"Instructor"
|
27
|
+
@instructor2 = make UserObject, :id=>@directory['person4']['id'], :password=>@directory['person4']['password'],
|
28
|
+
:first_name=>@directory['person4']['firstname'], :last_name=>@directory['person4']['lastname'],
|
29
|
+
:type=>"Instructor"
|
30
|
+
@instructor1.log_in
|
31
|
+
|
32
|
+
@site = make SiteObject
|
33
|
+
@site.create
|
34
|
+
@site.add_official_participants :role=>@student.type, :participants=>[@student.id]
|
35
|
+
@site.add_official_participants :role=>@instructor2.type, :participants=>[@instructor2.id]
|
36
|
+
|
37
|
+
@assignment = make AssignmentObject, :site=>@site.name, :title=>random_string(25),
|
38
|
+
:open=>an_hour_ago, :grade_scale=>"Pass",
|
39
|
+
:instructions=>random_multiline(100, 15, :string)
|
40
|
+
@submission = make AssignmentSubmissionObject, :site=>@site.name, :title=>@assignment.title,
|
41
|
+
:student=>@student
|
42
|
+
@assignment2 = make AssignmentObject, :site=>@site.name, :title=>random_string(25),
|
43
|
+
:open=>an_hour_ago, :grade_scale=>"Points", :max_points=>"111",
|
44
|
+
:allow_resubmission=>:set
|
45
|
+
@submission2 = make AssignmentSubmissionObject, :site=>@site.name, :title=>@assignment2.title,
|
46
|
+
:student=>@student
|
47
|
+
@assignment.create
|
48
|
+
@assignment2.create
|
49
|
+
|
50
|
+
@instructor1.log_out
|
51
|
+
@student.log_in
|
52
|
+
end
|
53
|
+
|
54
|
+
after :all do
|
55
|
+
# Close the browser window
|
56
|
+
@sakai.browser.close
|
57
|
+
end
|
58
|
+
|
59
|
+
it "Student can save an assignment as 'In progress'" do
|
60
|
+
@submission.save_draft
|
61
|
+
on SubmissionConfirmation do |confirm|
|
62
|
+
confirm.submission_text.should==@submission.text
|
63
|
+
confirm.confirmation_text.should=="You have successfully saved your work but NOT submitted yet. To complete submission, you must select the Submit button."
|
64
|
+
confirm.back_to_list
|
65
|
+
end
|
66
|
+
on AssignmentsList do |list|
|
67
|
+
list.status_of(@submission.title).should==@submission.status
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
it "Blank submissions throw a warning and aren't submitted" do
|
72
|
+
@submission.text="" # Typically we want to avoid doing this!
|
73
|
+
@submission.submit
|
74
|
+
on AssignmentStudentView do |assignment|
|
75
|
+
assignment.instructions.should==@assignment.instructions
|
76
|
+
assignment.alert_box.should=="Alert: You must either type in your answer in the text input or attach at least one document before submission."
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
it "Student can submit an assignment" do
|
81
|
+
@submission.text=random_alphanums
|
82
|
+
@submission.submit
|
83
|
+
on SubmissionConfirmation do |confirm|
|
84
|
+
confirm.summary_info["Class site:"].should==@submission.site
|
85
|
+
confirm.summary_info["User:"].should==@student.long_name
|
86
|
+
confirm.summary_info["Assignment:"].should==@submission.title
|
87
|
+
confirm.submission_text.should==@submission.text
|
88
|
+
confirm.confirmation_text.should=="You have successfully submitted your work. You will receive an email confirmation containing this information."
|
89
|
+
# TODO Need to add validation of attachments
|
90
|
+
confirm.back_to_list
|
91
|
+
end
|
92
|
+
on AssignmentsList do |list|
|
93
|
+
list.status_of(@submission.title).should=="#{@submission.status} #{@submission.submission_date}"
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
it "Assignments by default do not allow resubmission" do
|
98
|
+
@submission.view
|
99
|
+
on AssignmentStudentView do |view|
|
100
|
+
view.summary_info["Submitted Date"].should==@submission.submission_date
|
101
|
+
view.summary_info["Title"].should==@submission.title
|
102
|
+
view.submit_button.should_not be_present
|
103
|
+
view.save_draft_button.should_not be_present
|
104
|
+
view.back_to_list
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
it "Assignments that allow resubmission can be" do
|
109
|
+
@submission2.submit
|
110
|
+
on SubmissionConfirmation do |confirm|
|
111
|
+
confirm.back_to_list
|
112
|
+
end
|
113
|
+
on AssignmentsList do |list|
|
114
|
+
list.status_of(@submission2.title).should=="#{@submission2.status} #{@submission2.submission_date}"
|
115
|
+
list.open_assignment @submission2.title
|
116
|
+
end
|
117
|
+
on AssignmentStudentView do |assignment|
|
118
|
+
assignment.resubmit_button.should be_present
|
119
|
+
assignment.resubmit
|
120
|
+
end
|
121
|
+
on SubmissionConfirmation do |confirm|
|
122
|
+
confirm.summary_info["Class site:"].should==@submission2.site
|
123
|
+
confirm.summary_info["User:"].should==@student.long_name
|
124
|
+
confirm.summary_info["Assignment:"].should==@submission2.title
|
125
|
+
confirm.summary_info["Submitted on:"].should==@submission2.submission_date # TODO: "resubmission" date? This needs testing.
|
126
|
+
confirm.submission_text.should==@submission2.text
|
127
|
+
confirm.confirmation_text.should=="You have successfully submitted your work. You will receive an email confirmation containing this information."
|
128
|
+
confirm.back_to_list
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
it "Assignments only allow one resubmission by default" do
|
133
|
+
@assignment2.num_resubmissions.should=="1"
|
134
|
+
on AssignmentsList do |list|
|
135
|
+
list.open_assignment @submission2.title
|
136
|
+
end
|
137
|
+
on AssignmentStudentView do |assignment|
|
138
|
+
assignment.resubmit_button.should_not be_present
|
139
|
+
end
|
140
|
+
|
141
|
+
end
|
142
|
+
|
143
|
+
end
|
data/test/config.yml
ADDED
data/test/directory.yml
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
---
|
2
|
+
admin:
|
3
|
+
username: admin
|
4
|
+
password: admin
|
5
|
+
person1:
|
6
|
+
id: student01
|
7
|
+
firstname: Sañdra
|
8
|
+
lastname: Chëeks
|
9
|
+
email: dfhlese@rsmart.com
|
10
|
+
password: password
|
11
|
+
type: registered
|
12
|
+
person2:
|
13
|
+
id: student02
|
14
|
+
firstname: Billy
|
15
|
+
lastname: Bob
|
16
|
+
email: teulkf@rsmart.com
|
17
|
+
password: password
|
18
|
+
type: registered
|
19
|
+
person3:
|
20
|
+
id: instructor1
|
21
|
+
firstname: Joel
|
22
|
+
lastname: Instructor
|
23
|
+
email: ew6elyjk@rsmart.com
|
24
|
+
password: password
|
25
|
+
type: maintain
|
26
|
+
person4:
|
27
|
+
id: instructor2
|
28
|
+
firstname: Joanne
|
29
|
+
lastname: Instructor
|
30
|
+
email: deyrel567km@rsmart.com
|
31
|
+
password: password
|
32
|
+
type: maintain
|
33
|
+
person5:
|
34
|
+
id: student03
|
35
|
+
firstname: Achilles
|
36
|
+
lastname: Punks
|
37
|
+
email: thjlsert46@rsmart.com
|
38
|
+
password: password
|
39
|
+
type: registered
|
40
|
+
person6:
|
41
|
+
id: student04
|
42
|
+
firstname: Wilma
|
43
|
+
lastname: Legrobach
|
44
|
+
email: aherljkhg@rsmart.com
|
45
|
+
password: password
|
46
|
+
type: registered
|
47
|
+
person7:
|
48
|
+
id: student05
|
49
|
+
firstname: Jason
|
50
|
+
lastname: Elbate
|
51
|
+
email: te5hsw@rsmart.com
|
52
|
+
password: password
|
53
|
+
type: registered
|
54
|
+
person8:
|
55
|
+
id: student06
|
56
|
+
firstname: Jain
|
57
|
+
lastname: Linkvence
|
58
|
+
email: fgsdlfghrte4@rsmart.com
|
59
|
+
password: password
|
60
|
+
type: registered
|
61
|
+
person9:
|
62
|
+
id: student07
|
63
|
+
firstname: Dirk
|
64
|
+
lastname: Dogooder
|
65
|
+
email: stslethsrt7@rsmart.com
|
66
|
+
password: password
|
67
|
+
type: registered
|
68
|
+
person10:
|
69
|
+
id: student08
|
70
|
+
firstname: Sally
|
71
|
+
lastname: Malnilla
|
72
|
+
email: rtjyldryry@rsmart.com
|
73
|
+
password: password
|
74
|
+
type: registered
|
75
|
+
person11:
|
76
|
+
id: student09
|
77
|
+
firstname: Bo
|
78
|
+
lastname: Gart
|
79
|
+
email: srltjsy7@rsmart.com
|
80
|
+
password: password
|
81
|
+
type: registered
|
82
|
+
person12:
|
83
|
+
id: student10
|
84
|
+
firstname: Apnand
|
85
|
+
lastname: SluperNinja
|
86
|
+
email: pouhlyoiuh@rsmart.com
|
87
|
+
password: password
|
88
|
+
type: registered
|
89
|
+
person13:
|
90
|
+
id: peezel
|
91
|
+
firstname: Jack
|
92
|
+
lastname: O'Gallywag
|
93
|
+
email: agfslagbhnt@rsmart.com
|
94
|
+
password: password
|
95
|
+
type: registered
|
96
|
+
person14:
|
97
|
+
id: punky
|
98
|
+
firstname: Clark
|
99
|
+
lastname: Klent
|
100
|
+
email: clark@rsmart.com
|
101
|
+
password: password
|
102
|
+
type: guest
|
103
|
+
site1:
|
104
|
+
type: course
|
105
|
+
name: p?_;fYam >sMmRi0* ;<ynvhuZ Fall 2012 1st 5 weeks
|
106
|
+
id: 1b2b4917-1d77-484d-b339-a3bf7befcb34
|
107
|
+
assignment1: me'x^YXGSA
|
108
|
+
assignment2: _vLkTWdCqn-MBbd
|
109
|
+
assignment3: <A HREF="http://1113982867/">XSS</A>
|
110
|
+
assignment4: "#TE}d*AnSj{E)BtkA2nGj+,Le"
|
111
|
+
assignment5: n1AKqbx!TMz^".So`NNO<goL)=n@\q
|
112
|
+
quiz1: oJsiT->,_L
|
113
|
+
quiz2: LLgBjXd0GV
|
114
|
+
group0: "]83%?!MgB*K*;o}xe&zZ4K,Zrc<-t9vC#Boq.|jdQsQH-WQQ:/m>`KC2'peXG$^%AlA_|wGh:Y.8%}\"TI.0\" - 201209170951"
|
115
|
+
group1: g"//INr.]/:OdZQq'^$6LT@1HXGV}sLvxh<JmnOqC<w_aaA&(G;*"gdOg^1vP[R_$),6UuT.?vq&=&u|u]rw - 201209170951
|
116
|
+
section1: LB%!K#DqeB
|
117
|
+
section2: "\"<IMG SRC=\"jav\tascript:alert('XSS');\">"
|
118
|
+
site2:
|
119
|
+
type: portfolio
|
120
|
+
name: uzGKQL6T5A
|
data/test/duplicate_site_spec.rb
CHANGED
@@ -6,7 +6,7 @@ describe "Duplicate Site" do
|
|
6
6
|
|
7
7
|
include Utilities
|
8
8
|
include Workflows
|
9
|
-
include
|
9
|
+
include Foundry
|
10
10
|
|
11
11
|
before :all do
|
12
12
|
|
@@ -16,6 +16,8 @@ describe "Duplicate Site" do
|
|
16
16
|
@sakai = SakaiCLE.new(@config['browser'], @config['url'])
|
17
17
|
@browser = @sakai.browser
|
18
18
|
# This test case uses the logins of several users
|
19
|
+
@instructor = @directory['person3']['id']
|
20
|
+
@ipassword = @directory['person3']['password']
|
19
21
|
@file_path = @config['data_directory']
|
20
22
|
@source_site_string = "Links to various items in this site:"
|
21
23
|
|
@@ -134,12 +136,12 @@ describe "Duplicate Site" do
|
|
134
136
|
@new_assignment.get_info
|
135
137
|
|
136
138
|
end
|
137
|
-
|
139
|
+
=begin
|
138
140
|
after :all do
|
139
141
|
# Close the browser window
|
140
142
|
@browser.close
|
141
143
|
end
|
142
|
-
|
144
|
+
=end
|
143
145
|
def check_this_stuff(thing)
|
144
146
|
thing.should match /Site ID: #{@site2.id}/
|
145
147
|
thing.should match /\(y\) <a href..#{@new_assignment.direct_url}/
|
@@ -0,0 +1,248 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'sambal-cle'
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
describe "Import Site" do
|
6
|
+
|
7
|
+
include Utilities
|
8
|
+
include Workflows
|
9
|
+
include Foundry
|
10
|
+
|
11
|
+
before :all do
|
12
|
+
|
13
|
+
# Get the test configuration data
|
14
|
+
@config = YAML.load_file("config.yml")
|
15
|
+
@directory = YAML.load_file("directory.yml")
|
16
|
+
@sakai = SakaiCLE.new(@config['browser'], @config['url'])
|
17
|
+
@browser = @sakai.browser
|
18
|
+
# This test case uses the logins of several users
|
19
|
+
@instructor = @directory['person3']['id']
|
20
|
+
@ipassword = @directory['person3']['password']
|
21
|
+
|
22
|
+
@file_path = @config['data_directory']
|
23
|
+
@source_site_string = "Links to various items in this site:"
|
24
|
+
|
25
|
+
# Log in to Sakai
|
26
|
+
@sakai.page.login(@instructor, @ipassword)
|
27
|
+
|
28
|
+
@site1 = make SiteObject, :description=>"Original Site"
|
29
|
+
@site1.create
|
30
|
+
|
31
|
+
@source_site_string << "<br />\n<br />\nSite ID: #{@site1.id}<br />\n<br />\n"
|
32
|
+
|
33
|
+
@assignment = make AssignmentObject, :site=>@site1.name, :instructions=>@source_site_string
|
34
|
+
@assignment.create
|
35
|
+
@assignment.get_info
|
36
|
+
|
37
|
+
@source_site_string << "Assignment...<br />\nID:(n) #{@assignment.id}<br />\n"
|
38
|
+
@source_site_string << "Link (made 'by hand'): <a href=\"#{@assignment.link}\">#{@assignment.title}</a><br />\n"
|
39
|
+
@source_site_string << "URL from Entity picker:(x) <a href=\"#{@assignment.url}\">#{@assignment.title}</a><br />\n"
|
40
|
+
@source_site_string << "<em>Direct</em> URL from Entity picker:(y) <a href=\"#{@assignment.direct_url}\">#{@assignment.title}</a><br />\n<br />\n#{@assignment.direct_url}<br />\n<br />\n"
|
41
|
+
@source_site_string << "<em>Portal</em> URL from Entity picker:(z) <a href=\"#{@assignment.portal_url}\">#{@assignment.title}</a><br />\n<br />\n#{@assignment.portal_url}<br />\n<br />\n"
|
42
|
+
|
43
|
+
@announcement = make AnnouncementObject, :site=>@site1.name, :body=>@assignment.link
|
44
|
+
@announcement.create
|
45
|
+
|
46
|
+
@source_site_string << "<br />\nAnnouncement link: <a href=\"#{@announcement.link}\">#{@announcement.title}</a><br />\n"
|
47
|
+
|
48
|
+
@file = make FileObject, :site=>@site1.name, :name=>"flower02.jpg", :source_path=>@file_path+"images/"
|
49
|
+
@file.create
|
50
|
+
|
51
|
+
@source_site_string << "<br />\nUploaded file: <a href=\"#{@file.href}\">#{@file.name}</a><br />\n"
|
52
|
+
|
53
|
+
@htmlpage = make HTMLPageObject, :site=>@site1.name, :folder=>"#{@site1.name} Resources", :html=>@source_site_string
|
54
|
+
@htmlpage.create
|
55
|
+
|
56
|
+
@source_site_string << "<br />\nHTML Page: <a href=\"#{@htmlpage.url}\">#{@htmlpage.name}</a><br />\n"
|
57
|
+
|
58
|
+
@folder = make FolderObject, :site=>@site1.name, :parent_folder=>"#{@site1.name} Resources"
|
59
|
+
@folder.create
|
60
|
+
|
61
|
+
@nestedhtmlpage = make HTMLPageObject, :site=>@site1.name, :folder=>@folder.name, :html=>@source_site_string
|
62
|
+
@nestedhtmlpage.create
|
63
|
+
|
64
|
+
@source_site_string << "<br />\nNested HTML Page: <a href=\"#{@nestedhtmlpage.url}\">#{@nestedhtmlpage.name}</a><br />\n"
|
65
|
+
|
66
|
+
@web_content1 = make WebContentObject, :title=>@htmlpage.name, :source=>@htmlpage.url, :site=>@htmlpage.site
|
67
|
+
@web_content1.create
|
68
|
+
|
69
|
+
@web_content2 = make WebContentObject, :title=>@nestedhtmlpage.name, :source=>@nestedhtmlpage.url, :site=>@nestedhtmlpage.site
|
70
|
+
@web_content2.create
|
71
|
+
|
72
|
+
@module = make ModuleObject, :site=>@site1.name
|
73
|
+
@module.create
|
74
|
+
|
75
|
+
@source_site_string << "<br />\nModule: <a href=\"#{@module.href}\">#{@module.name}</a><br />\n"
|
76
|
+
|
77
|
+
@section1 = make ContentSectionObject, :site=>@site1.name, :module=>@module.title, :content_type=>"Compose content with editor",
|
78
|
+
:editor_content=>@source_site_string
|
79
|
+
@section1.create
|
80
|
+
|
81
|
+
@source_site_string << "<br />\nSection 1: <a href=\"#{@section1.href}\">#{@section1.name}</a><br />\n"
|
82
|
+
|
83
|
+
@section2 = make ContentSectionObject, :site=>@site1.name, :module=>@module.title, :content_type=>"Upload or link to a file",
|
84
|
+
:file_name=>"flower01.jpg", :file_path=>@file_path+"images/"
|
85
|
+
@section2.create
|
86
|
+
|
87
|
+
@source_site_string << "<br />Section 2: <a href=\"#{@section2.href}\">#{@section2.name}</a><br />"
|
88
|
+
|
89
|
+
@section3 = make ContentSectionObject, :site=>@site1.name, :module=>@module.title, :content_type=>"Link to new or existing URL resource on server",
|
90
|
+
:url=>@htmlpage.url, :url_title=>@htmlpage.name
|
91
|
+
@section3.create
|
92
|
+
|
93
|
+
@section4 = make ContentSectionObject, :site=>@site1.name, :module=>@module.title, :content_type=>"Upload or link to a file in Resources",
|
94
|
+
:file_name=>@nestedhtmlpage.name, :file_folder=>@nestedhtmlpage.folder
|
95
|
+
@section4.create
|
96
|
+
|
97
|
+
@wiki = make WikiObject, :site=>@site1.name, :content=>"{image:worksite:/#{@file.name}}\n\n{worksiteinfo}\n\n{sakai-sections}"
|
98
|
+
@wiki.create
|
99
|
+
|
100
|
+
@source_site_string << "<br />Wiki: <a href=\"#{@wiki.href}\">#{@wiki.title}</a><br />"
|
101
|
+
|
102
|
+
@syllabus = make SyllabusObject, :content=>@source_site_string, :site=>@site1.name
|
103
|
+
@syllabus.create
|
104
|
+
|
105
|
+
@forum = make ForumObject, :site=>@site1.name, :short_description=>random_alphanums, :description=>@source_site_string
|
106
|
+
@forum.create
|
107
|
+
@forum.get_entity_info
|
108
|
+
|
109
|
+
@source_site_string << "<br />\nForum link: <a href=\"#{@forum.direct_link}\">#{@forum.title}</a><br />\n"
|
110
|
+
|
111
|
+
@topic = make TopicObject, :site=>@site1.name, :forum=>@forum.title, :description=>@source_site_string
|
112
|
+
@topic.create
|
113
|
+
@topic.get_entity_info
|
114
|
+
|
115
|
+
@source_site_string << "<br />\nTopic link: <a href=\"#{@topic.direct_link}\">#{@topic.title}</a><br />\n"
|
116
|
+
|
117
|
+
@event = make EventObject, :site=>@site1.name, :message=>@source_site_string
|
118
|
+
@event.create
|
119
|
+
|
120
|
+
@forum.edit :description=>@source_site_string
|
121
|
+
|
122
|
+
@topic.edit :description=>@source_site_string
|
123
|
+
|
124
|
+
@assignment.edit :instructions=>@source_site_string
|
125
|
+
|
126
|
+
@announcement.edit :body=>@source_site_string
|
127
|
+
|
128
|
+
@htmlpage.edit_content @source_site_string
|
129
|
+
|
130
|
+
@nestedhtmlpage.edit_content @source_site_string
|
131
|
+
|
132
|
+
@section1.edit :editor_content=>@source_site_string
|
133
|
+
|
134
|
+
@site2 = make SiteObject
|
135
|
+
@site2.create_and_reuse_site @site1.name
|
136
|
+
|
137
|
+
@new_assignment = make AssignmentObject, :site=>@site2.name, :status=>"Draft", :title=>@assignment.title
|
138
|
+
@new_assignment.get_info
|
139
|
+
|
140
|
+
end
|
141
|
+
|
142
|
+
after :all do
|
143
|
+
# Close the browser window
|
144
|
+
@browser.close
|
145
|
+
end
|
146
|
+
|
147
|
+
def check_this_stuff(thing)
|
148
|
+
thing.should match /Site ID: #{@site2.id}/
|
149
|
+
thing.should match /\(y\) <a href..#{@new_assignment.direct_url}/
|
150
|
+
thing.should_not match /Announcement link:.+#{@announcement.id}.+#{@announcement.title}/
|
151
|
+
thing.should match /Uploaded file:.+#{@site2.id}.+#{@file.name}/
|
152
|
+
thing.should match /#{@site2.id}\/#{@htmlpage.name}/
|
153
|
+
thing.should match /#{@site2.id}\/#{@folder.name}\/#{@nestedhtmlpage.name}/
|
154
|
+
thing.should match /Wiki:.+#{@site2.id}.+#{@wiki.name}/
|
155
|
+
thing.should_not match /Forum link:.+#{@forum.direct_link}.+#{@forum.title}/
|
156
|
+
thing.should_not match /Topic link:.+#{@topic.direct_link}.+#{@topic.title}/
|
157
|
+
|
158
|
+
# These are not expected to work:
|
159
|
+
#puts "Assignment ID updated? " + (thing[/ID:\(n\) #{@new_assignment.id}/]==nil ? "no" : "yes")
|
160
|
+
#puts "Assignment Link updated? " + (thing[/hand.\): <a href.+#{@new_assignment.link}.+doView_assignment/]==nil ? "no" : "yes")
|
161
|
+
#puts "Entity picker Assignment URL updated? " + (thing[/\(x\) <a href.+#{@new_assignment.url}.+doView_submission/]==nil ? "no" : "yes")
|
162
|
+
#puts "Assignment Portal Link updated? " + (thing[/\(z\) <a href..#{@new_assignment.portal_url}/]==nil ? "no" : "yes")
|
163
|
+
#puts "Module Link updated? " + (thing[/Module:.+#{@site2.id}.+#{@module.name}/]==nil ? "no" : "yes")
|
164
|
+
#puts "Section 1 Link updated? " + (thing[/Section 1:.+#{@site2.id}.+#{@section1.name}/]==nil ? "no" : "yes")
|
165
|
+
#puts "Section 2 Link updated? " + (thing[/Section 2:.+#{@site2.id}.+#{@section2.name}/]==nil ? "no" : "yes")
|
166
|
+
#puts "Wiki link updated? " + (thing[/#{@site2.id}/]==nil ? "no" : "yes")
|
167
|
+
#puts "Syllabus Link updated? " + (thing[/Syllabus: #{@site2.id}/]==nil ? "no" : "yes")
|
168
|
+
end
|
169
|
+
|
170
|
+
it "imports Assignments correctly" do
|
171
|
+
|
172
|
+
check_this_stuff(@new_assignment.instructions)
|
173
|
+
end
|
174
|
+
|
175
|
+
it "imports Web Content pages correctly" do
|
176
|
+
open_my_site_by_name @site2.name unless @browser.title=~/#{@site2.name}/
|
177
|
+
@browser.link(:text=>@web_content1.title, :href=>/#{@site2.id}/).should be_present
|
178
|
+
@browser.link(:text=>@web_content2.title, :href=>/#{@site2.id}/).should be_present
|
179
|
+
|
180
|
+
end
|
181
|
+
|
182
|
+
it "imports Announcements correctly" do
|
183
|
+
@new_announcement = make AnnouncementObject, :site=>@site2.name, :title=>@announcement.title
|
184
|
+
@new_announcement.view
|
185
|
+
|
186
|
+
check_this_stuff(@new_announcement.message_html)
|
187
|
+
end
|
188
|
+
|
189
|
+
it "imports Forums correctly" do
|
190
|
+
@new_forum = make ForumObject, :site=>@site2.name, :title=>@forum.title
|
191
|
+
@new_forum.view
|
192
|
+
|
193
|
+
check_this_stuff(@new_forum.description_html)
|
194
|
+
end
|
195
|
+
|
196
|
+
it "imports Topics correctly" do
|
197
|
+
@new_topic = make TopicObject, :site=>@site2.name, :forum=>@forum.title, :title=>@topic.title
|
198
|
+
@new_topic.view
|
199
|
+
check_this_stuff(@new_topic.description_html)
|
200
|
+
end
|
201
|
+
|
202
|
+
xit "imports Lessons correctly" do
|
203
|
+
lessons
|
204
|
+
on Lessons do |lessons|
|
205
|
+
lessons.lessons_list.should include @module.title
|
206
|
+
lessons.sections_list(@module.title).should include @section1.title
|
207
|
+
lessons.sections_list(@module.title).should include @section2.title
|
208
|
+
lessons.sections_list(@module.title).should include @section3.title
|
209
|
+
lessons.sections_list(@module.title).should include @section4.title
|
210
|
+
lessons.open_section @section1.title
|
211
|
+
end
|
212
|
+
on AddEditContentSection do |section|
|
213
|
+
@text = section.get_source_text section.content_editor
|
214
|
+
end
|
215
|
+
|
216
|
+
check_this_stuff @text
|
217
|
+
end
|
218
|
+
|
219
|
+
it "imports Syllabi correctly" do
|
220
|
+
@new_syllabus = make SyllabusObject, :site=>@site2.name, :title=>@syllabus.title
|
221
|
+
@new_syllabus.get_properties
|
222
|
+
|
223
|
+
check_this_stuff @new_syllabus.content
|
224
|
+
end
|
225
|
+
|
226
|
+
it "imports Wikis correctly" do
|
227
|
+
@new_wiki = make WikiObject, :site=>@site2.name, :title=>@wiki.title
|
228
|
+
@new_wiki.get_content
|
229
|
+
|
230
|
+
@new_wiki.content.should == @wiki.content
|
231
|
+
end
|
232
|
+
|
233
|
+
it "imports Resources correctly" do
|
234
|
+
resources
|
235
|
+
on Resources do |resources|
|
236
|
+
resources.folder_names.should include @folder.name
|
237
|
+
resources.file_names.should include @file.name
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
it "imports Events correctly" do
|
242
|
+
@new_event = make EventObject, :title=>@event.title, :site=>@site2.name
|
243
|
+
@new_event.view
|
244
|
+
|
245
|
+
check_this_stuff @new_event.message_html
|
246
|
+
end
|
247
|
+
|
248
|
+
end
|