sambal-cle 0.1.5 → 0.1.6

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.
Files changed (58) hide show
  1. data/Gemfile +3 -5
  2. data/Gemfile.lock +6 -9
  3. data/lib/sambal-cle/base_page.rb +21 -3
  4. data/lib/sambal-cle/data_objects/announcement.rb +1 -1
  5. data/lib/sambal-cle/data_objects/assignment.rb +3 -2
  6. data/lib/sambal-cle/data_objects/course.rb +5 -4
  7. data/lib/sambal-cle/data_objects/event.rb +7 -7
  8. data/lib/sambal-cle/data_objects/forum.rb +3 -2
  9. data/lib/sambal-cle/data_objects/lesson.rb +3 -1
  10. data/lib/sambal-cle/data_objects/resource.rb +3 -1
  11. data/lib/sambal-cle/page_objects/account.rb +15 -66
  12. data/lib/sambal-cle/page_objects/aliases.rb +3 -2
  13. data/lib/sambal-cle/page_objects/announcements.rb +16 -31
  14. data/lib/sambal-cle/page_objects/assessments.rb +22 -55
  15. data/lib/sambal-cle/page_objects/assignments.rb +1 -1
  16. data/lib/sambal-cle/page_objects/blogger.rb +21 -77
  17. data/lib/sambal-cle/page_objects/blogs.rb +3 -5
  18. data/lib/sambal-cle/page_objects/calendar.rb +22 -40
  19. data/lib/sambal-cle/page_objects/chat_room.rb +2 -2
  20. data/lib/sambal-cle/page_objects/email_archive.rb +1 -2
  21. data/lib/sambal-cle/page_objects/evaluations.rb +78 -50
  22. data/lib/sambal-cle/page_objects/feedback.rb +1 -5
  23. data/lib/sambal-cle/page_objects/forms.rb +14 -55
  24. data/lib/sambal-cle/page_objects/forums.rb +11 -24
  25. data/lib/sambal-cle/page_objects/glossary.rb +6 -12
  26. data/lib/sambal-cle/page_objects/home.rb +7 -18
  27. data/lib/sambal-cle/page_objects/jforums.rb +60 -197
  28. data/lib/sambal-cle/page_objects/job_scheduler.rb +16 -49
  29. data/lib/sambal-cle/page_objects/lessons.rb +11 -34
  30. data/lib/sambal-cle/page_objects/matrix.rb +12 -14
  31. data/lib/sambal-cle/page_objects/messages.rb +71 -466
  32. data/lib/sambal-cle/page_objects/my_workspace.rb +3 -3
  33. data/lib/sambal-cle/page_objects/podcasts.rb +1 -6
  34. data/lib/sambal-cle/page_objects/polls.rb +5 -5
  35. data/lib/sambal-cle/page_objects/portfolio_templates.rb +16 -66
  36. data/lib/sambal-cle/page_objects/portfolios.rb +17 -67
  37. data/lib/sambal-cle/page_objects/profile.rb +5 -16
  38. data/lib/sambal-cle/page_objects/profile2.rb +51 -119
  39. data/lib/sambal-cle/page_objects/public_search.rb +6 -27
  40. data/lib/sambal-cle/page_objects/realms.rb +2 -2
  41. data/lib/sambal-cle/page_objects/resources.rb +89 -116
  42. data/lib/sambal-cle/page_objects/resources_roster.rb +1 -0
  43. data/lib/sambal-cle/page_objects/rosters.rb +3 -13
  44. data/lib/sambal-cle/page_objects/rwiki.rb +2 -6
  45. data/lib/sambal-cle/page_objects/search.rb +10 -10
  46. data/lib/sambal-cle/page_objects/sections.rb +40 -81
  47. data/lib/sambal-cle/page_objects/site_setup.rb +46 -74
  48. data/lib/sambal-cle/page_objects/sites.rb +24 -110
  49. data/lib/sambal-cle/page_objects/styles.rb +6 -51
  50. data/lib/sambal-cle/page_objects/syllabus.rb +12 -26
  51. data/lib/sambal-cle/page_objects/user_membership.rb +3 -15
  52. data/lib/sambal-cle/page_objects/users.rb +9 -25
  53. data/sambal-cle.gemspec +1 -1
  54. data/test/add_assignment_to_calendar_spec.rb +55 -1
  55. data/test/config.yml +1 -1
  56. data/test/duplicate_site_spec.rb +11 -10
  57. data/test/import_site_content_spec.rb +6 -5
  58. metadata +2 -2
@@ -6,13 +6,8 @@
6
6
  class Styles < BasePage
7
7
 
8
8
  frame_element
9
-
10
- # Clicks the Add link and
11
- # instantiates the AddStyle Class.
12
- def add
13
- frm.link(:text=>"Add").click
14
- AddStyle.new(@browser)
15
- end
9
+
10
+ link("Add")
16
11
 
17
12
  end
18
13
 
@@ -20,55 +15,15 @@ end
20
15
  class AddStyle < BasePage
21
16
 
22
17
  frame_element
23
-
24
- # Clicks the Add Style button and
25
- # instantiates the Styles Class.
26
- def add_style
27
- frm.button(:value=>"Add Style").click
28
- Styles.new(@browser)
29
- end
30
-
31
- # Clicks the "Select File" link and
32
- # instantiates the StylesAddAttachment Class.
33
- def select_file
34
- frm.link(:text=>"Select File").click
35
- StylesAddAttachment.new(@browser)
36
- end
18
+
19
+ button("Add Style")
20
+
21
+ link("Select File")
37
22
 
38
23
  element(:name) { |b| b.frm.text_field(:id=>"name-id") }
39
24
  element(:description) { |b| b.frm.text_field(:id=>"descriptionTextArea") }
40
25
 
41
26
  end
42
27
 
43
- # TODO Dry this up because there can be a superclass here
44
- class StylesUploadFiles < ResourcesBase
45
-
46
- @@filex=0
47
-
48
- # Note that the file_to_upload method can be used
49
- # multiple times, but it assumes
50
- # that the add_another_file method is used
51
- # before it, every time except before the first time.
52
- def file_to_upload(file_name, file_path="")
53
- frm.file_field(:id, "content_#{@@filex}").set(file_path + file_name)
54
- @@filex+=1
55
- end
56
-
57
- # Clicks the "Upload Files Now" button
58
- # then instantiates the StylesAddAttachment Class.
59
- def upload_files_now
60
- frm.button(:value=>"Upload Files Now").click
61
- sleep 0.5
62
- @@filex=0
63
- StylesAddAttachment.new(@browser)
64
- end
65
-
66
- # Clicks the "Add Another File" link.
67
- def add_another_file
68
- frm.link(:text=>"Add Another File").click
69
- end
70
-
71
- end
72
-
73
28
 
74
29
 
@@ -10,10 +10,10 @@ class SyllabusBase < BasePage
10
10
  class << self
11
11
 
12
12
  def menu_elements
13
- action(:create_edit) { |b| b.frm.link(:text=>"Create/Edit").click }
14
- action(:add) { |b| b.frm.link(:text=>"Add").click }
15
- action(:redirect) { |b| b.frm.link(:text=>"Redirect").click }
16
- action(:preview) { |b| b.frm.link(text: "Preview").click }
13
+ link("Create/Edit")
14
+ link("Add")
15
+ link("Redirect")
16
+ link("Preview")
17
17
  end
18
18
 
19
19
  end
@@ -59,12 +59,10 @@ class SyllabusEdit < SyllabusBase
59
59
  #FIXME
60
60
  end
61
61
 
62
- action(:update) { |b| b.frm.button(:value=>"Update").click }
62
+ button("Update")
63
63
 
64
64
  # Opens the specified item
65
- def open_item(title)
66
- frm.link(:text=>title).click
67
- end
65
+ action(:open_item) { | title, b| b.frm.link(:text=>title).click }
68
66
 
69
67
  # Returns an array containing the titles of the syllabus items
70
68
  # displayed on the page.
@@ -87,24 +85,18 @@ class AddEditSyllabusItem < SyllabusBase
87
85
 
88
86
  expected_element :editor
89
87
 
90
- # Clicks the "Post" button and instantiates
91
- # the Syllabus Class.
92
- action(:post) { |b| b.frm.button(:value=>"Post").click }
88
+ button("Post")
93
89
 
94
90
  # Defines the text area of the FCKEditor that appears on the page for
95
91
  # the Syllabus content.
96
- def editor
97
- frm.frame(:id=>/_textarea___Frame/)
98
- end
92
+ element(:editor) { |b| b.frm.frame(:id=>/_textarea___Frame/) }
99
93
 
100
94
  # Sends the specified string to the FCKEditor text area on the page.
101
95
  def content=(text)
102
96
  editor.send_keys(text)
103
97
  end
104
98
 
105
- # Clicks the Add attachments button and instantiates the
106
- # SyllabusAttach class.
107
- action(:add_attachments) { |b| frm.button(:value=>"Add attachments").click }
99
+ button("Add attachments")
108
100
 
109
101
  # Returns an array of the filenames in the attachments
110
102
  # table
@@ -118,12 +110,7 @@ class AddEditSyllabusItem < SyllabusBase
118
110
  return names
119
111
  end
120
112
 
121
- # Clicks the preview button and
122
- # instantiates the SyllabusPreview class
123
- def preview
124
- frm.button(:value=>"Preview").click
125
- SyllabusPreview.new(@browser)
126
- end
113
+ button("Preview")
127
114
 
128
115
  element(:title) { |b| b.frm.text_field(:id=>"_id4:title") }
129
116
  element(:only_members_of_this_site) { |b| b.frm.radio_button(:name=>/_id\d+:_id\d+/, :value=>"no") }
@@ -136,7 +123,7 @@ class SyllabusPreview < SyllabusBase
136
123
 
137
124
  menu_elements
138
125
 
139
- action(:edit) { |b| b.frm.button(:value=>"Edit").click }
126
+ button("Edit")
140
127
 
141
128
  end
142
129
 
@@ -145,7 +132,6 @@ class SyllabusRedirect < SyllabusBase
145
132
 
146
133
  menu_elements
147
134
 
148
- action(:save) { |b| b.frm.button(:value=>"Save").click }
149
135
  element(:url) { |b| b.frm.text_field(:id=>"redirectForm:urlValue") }
150
136
 
151
137
  end
@@ -155,7 +141,7 @@ class DeleteSyllabusItems < SyllabusBase
155
141
 
156
142
  menu_elements
157
143
 
158
- action(:delete) { |b| b.frm.button(:value=>"Delete").click }
144
+ button("Delete")
159
145
 
160
146
  end
161
147
 
@@ -17,25 +17,13 @@ class UserMembership < BasePage
17
17
  return names
18
18
  end
19
19
 
20
- # Returns the user id of the specified user (assuming that person
21
- # appears in the search results list, otherwise this method will
22
- # throw an error.)
23
- def user_id(name)
24
- frm.table(:class=>/listHier/).row(:text=>/#{Regexp.escape(name)}/)[0].text
25
- end
20
+ action(:user_id) { |name, b| b.frm.table(:class=>/listHier/).row(:text=>/#{Regexp.escape(name)}/)[0].text }
26
21
 
27
- # Returns the user type of the specified user (assuming that person
28
- # appears in the search results list, otherwise this method will
29
- # throw an error.)
30
- def type(name)
31
- frm.table(:class=>/listHier/).row(:text=>/#{Regexp.escape(name)}/)[4].text
32
- end
22
+ action(:type) { |name, b| b.frm.table(:class=>/listHier/).row(:text=>/#{Regexp.escape(name)}/)[4].text }
33
23
 
34
24
  # Returns the text contents of the "instruction" paragraph that
35
25
  # appears when there are no search results.
36
- def alert_text
37
- frm.p(:class=>"instruction").text
38
- end
26
+ value(:alert_text) { |b| b.frm.p(:class=>"instruction").text }
39
27
 
40
28
  element(:user_type) { |b| b.frm.select_list(:id=>"userlistForm:selectType") }
41
29
  element(:user_authority) { |b| b.frm.select_list(:id=>"userlistForm:selectAuthority") }
@@ -9,10 +9,10 @@ class EditUser < BasePage
9
9
 
10
10
  def update_details
11
11
  frm.button(:name=>"eventSubmit_doSave").click
12
- sleep 1
12
+ frm.link(:text=>"Search").wait_until_present
13
13
  end
14
14
 
15
- action(:remove_user) { |b| b.frm.link(text=>"Remove User").click }
15
+ link "Remove User"
16
16
  element(:first_name) { |b| b.frm.text_field(:id=>"first-name") }
17
17
  element(:last_name) { |b| b.frm.text_field(:id=>"last-name") }
18
18
  element(:email) { |b| b.frm.text_field(:id=>"email") }
@@ -27,36 +27,23 @@ class Users < BasePage
27
27
 
28
28
  frame_element
29
29
 
30
- def new_user
31
- frm.link(:text=>"New User").click
32
- CreateNewUser.new @browser
33
- end
30
+ link "New User"
34
31
 
35
32
  # Returns the contents of the Name cell
36
33
  # based on the specified user ID value.
37
- def name(user_id)
38
- frm.table(:class=>"listHier lines").row(:text=>/#{Regexp.escape(user_id)}/i)[1].text
39
- end
34
+ action(:name) { |user_id, b| b.frm.table(:class=>"listHier lines").row(:text=>/#{Regexp.escape(user_id)}/i)[1].text }
40
35
 
41
36
  # Returns the contents of the Email cell
42
37
  # based on the specified user ID value.
43
- def email(user_id)
44
- frm.table(:class=>"listHier lines").row(:text=>/#{Regexp.escape(user_id)}/i)[2].text
45
- end
38
+ action(:email) { |user_id, b| b.frm.table(:class=>"listHier lines").row(:text=>/#{Regexp.escape(user_id)}/i)[2].text }
46
39
 
47
40
  # Returns the contents of the Type cell
48
41
  # based on the specified user ID value.
49
- def type(user_id)
50
- frm.table(:class=>"listHier lines").row(:text=>/#{Regexp.escape(user_id)}/i)[3].text
51
- end
42
+ action(:type) { |user_id, b| b.frm.table(:class=>"listHier lines").row(:text=>/#{Regexp.escape(user_id)}/i)[3].text }
52
43
 
53
- def search_button
54
- frm.link(:text=>"Search").click
55
- frm.table(:class=>"listHier lines").wait_until_present
56
- Users.new @browser
57
- end
44
+ action(:search_button) { |b| b.frm.link(:text=>"Search").click; b.frm.table(:class=>"listHier lines").wait_until_present }
58
45
 
59
- action(:clear_search) { |b| b.frm.link(text=>"Clear Search").click }
46
+ link "Clear Search"
60
47
  element(:search_field) { |b| b.frm.text_field(:id=>"search") }
61
48
  element(:select_page_size) { |b| b.frm.select_list(:name=>"selectPageSize") }
62
49
  action(:next) { |b| b.frm.button(:name=>"eventSubmit_doList_next").click }
@@ -72,10 +59,7 @@ class CreateNewUser < BasePage
72
59
 
73
60
  frame_element
74
61
 
75
- def save_details
76
- frm.button(:name=>"eventSubmit_doSave").click
77
- Users.new(@browser)
78
- end
62
+ action(:save_details) { |b| b.frm.button(:name=>"eventSubmit_doSave").click }
79
63
 
80
64
  element(:user_id) { |b| b.frm.text_field(:id=>"eid") }
81
65
  element(:first_name) { |b| b.frm.text_field(:id=>"first-name") }
data/sambal-cle.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  spec = Gem::Specification.new do |s|
2
2
  s.name = 'sambal-cle'
3
- s.version = '0.1.5'
3
+ s.version = '0.1.6'
4
4
  s.summary = %q{rSmart's test framework for testing Sakai-CLE}
5
5
  s.description = %q{This gem is used for creating test scripts for the Sakai Collaborative Learning Environment.}
6
6
  s.files = Dir.glob("**/**/**")
@@ -80,6 +80,60 @@ describe "Assignment Due Date on Calendar" do
80
80
  end
81
81
  end
82
82
 
83
- # TODO: Add tests for student and other instructor being able to see the assignment in the calendar
83
+ it "Students see expected assignments on the calendar" do
84
+ @student.log_in
85
+ calendar
86
+ on Calendar do |calendar|
87
+ calendar.view.select "List of Events"
88
+ calendar.show_events.select "Custom date range"
89
+ calendar.start_month.select @assignment1.due[:MON]
90
+ calendar.start_day.select @assignment1.due[:day_of_month]
91
+ calendar.start_year.select @assignment1.due[:year]
92
+ calendar.end_month.select @assignment1.due[:MON]
93
+ calendar.end_day.select @assignment1.due[:day_of_month]
94
+ calendar.end_year.select @assignment1.due[:year]
95
+ calendar.filter_events
96
+
97
+ calendar.events_list.should_not include "Due #{@assignment1.title}"
98
+
99
+ calendar.start_month.select @assignment2.due[:MON]
100
+ calendar.start_day.select @assignment2.due[:day_of_month]
101
+ calendar.start_year.select @assignment2.due[:year]
102
+ calendar.end_month.select @assignment2.due[:MON]
103
+ calendar.end_day.select @assignment2.due[:day_of_month]
104
+ calendar.end_year.select @assignment2.due[:year]
105
+ calendar.filter_events
106
+
107
+ calendar.events_list.should include "Due #{@assignment2.title}"
108
+ end
109
+ end
110
+
111
+ it "Other instructors see expected assignments on the calendar" do
112
+ @instructor2.log_in
113
+ calendar
114
+ on Calendar do |calendar|
115
+ calendar.view.select "List of Events"
116
+ calendar.show_events.select "Custom date range"
117
+ calendar.start_month.select @assignment1.due[:MON]
118
+ calendar.start_day.select @assignment1.due[:day_of_month]
119
+ calendar.start_year.select @assignment1.due[:year]
120
+ calendar.end_month.select @assignment1.due[:MON]
121
+ calendar.end_day.select @assignment1.due[:day_of_month]
122
+ calendar.end_year.select @assignment1.due[:year]
123
+ calendar.filter_events
124
+
125
+ calendar.events_list.should_not include "Due #{@assignment1.title}"
126
+
127
+ calendar.start_month.select @assignment2.due[:MON]
128
+ calendar.start_day.select @assignment2.due[:day_of_month]
129
+ calendar.start_year.select @assignment2.due[:year]
130
+ calendar.end_month.select @assignment2.due[:MON]
131
+ calendar.end_day.select @assignment2.due[:day_of_month]
132
+ calendar.end_year.select @assignment2.due[:year]
133
+ calendar.filter_events
134
+
135
+ calendar.events_list.should include "Due #{@assignment2.title}"
136
+ end
137
+ end
84
138
 
85
139
  end
data/test/config.yml CHANGED
@@ -1,3 +1,3 @@
1
1
  browser: :firefox
2
2
  url: https://cle-1.qa.rsmart.com/xsl-portal
3
- data_directory: /Users/abrahamheward/work/Sambal/data/sakai-cle/
3
+ data_directory: /Users/abrahamheward/Documents/data/
@@ -4,7 +4,7 @@ require 'yaml'
4
4
 
5
5
  describe "Duplicate Site" do
6
6
 
7
- include Utilities
7
+ include StringFactory
8
8
  include Workflows
9
9
  include Foundry
10
10
 
@@ -15,14 +15,15 @@ describe "Duplicate Site" do
15
15
  @directory = YAML.load_file("directory.yml")
16
16
  @sakai = SambalCLE.new(@config['browser'], @config['url'])
17
17
  @browser = @sakai.browser
18
- # This test case uses the logins of several users
19
- @instructor = @directory['person3']['id']
20
- @ipassword = @directory['person3']['password']
18
+
19
+ @instructor = make UserObject, :id=>@directory['person3']['id'], :password=>@directory['person3']['password'],
20
+ :first_name=>@directory['person3']['firstname'], :last_name=>@directory['person3']['lastname'],
21
+ :type=>"Instructor"
21
22
  @file_path = @config['data_directory']
22
23
  @source_site_string = "Links to various items in this site:"
23
24
 
24
25
  # Log in to Sakai
25
- @sakai.page.login(@instructor, @ipassword)
26
+ @instructor.login
26
27
 
27
28
  @site1 = make CourseSiteObject, :description=>"Original Site"
28
29
  @site1.create
@@ -47,7 +48,7 @@ describe "Duplicate Site" do
47
48
  @file = make FileObject, :site=>@site1.name, :name=>"flower02.jpg", :source_path=>@file_path+"images/"
48
49
  @file.create
49
50
 
50
- @source_site_string << "<br />\nUploaded file: <a href=\"#{@file.href}\">#{@file.name}</a><br />\n"
51
+ @source_site_string << %|<br />\nUploaded file: <a href="#{@file.href}">#{@file.name}</a><br />\n<img width="203" height="196" src="https://#{$base_url}/access/content/group/#{@site1.id}/#{@file.name}" alt="" /><br /><br />|
51
52
 
52
53
  @htmlpage = make HTMLPageObject, :site=>@site1.name, :folder=>"#{@site1.name} Resources", :html=>@source_site_string
53
54
  @htmlpage.create
@@ -136,15 +137,16 @@ describe "Duplicate Site" do
136
137
  @new_assignment.get_info
137
138
 
138
139
  end
139
- =begin
140
+
140
141
  after :all do
141
142
  # Close the browser window
142
143
  @browser.close
143
144
  end
144
- =end
145
+
145
146
  def check_this_stuff(thing)
146
147
  thing.should match /Site ID: #{@site2.id}/
147
148
  thing.should match /\(y\) <a href..#{@new_assignment.direct_url}/
149
+ thing.should match /<img.+#{@site2.id}\/#{@file.name}/
148
150
  thing.should_not match /Announcement link:.+#{@announcement.id}.+#{@announcement.title}/
149
151
  thing.should match /Uploaded file:.+#{@site2.id}.+#{@file.name}/
150
152
  thing.should match /#{@site2.id}\/#{@htmlpage.name}/
@@ -166,7 +168,6 @@ describe "Duplicate Site" do
166
168
  end
167
169
 
168
170
  it "duplicates Assignments correctly" do
169
-
170
171
  check_this_stuff(@new_assignment.instructions)
171
172
  end
172
173
 
@@ -197,7 +198,7 @@ describe "Duplicate Site" do
197
198
  check_this_stuff(@new_topic.description_html)
198
199
  end
199
200
 
200
- xit "duplicates Lessons correctly" do
201
+ it "duplicates Lessons correctly" do
201
202
  lessons
202
203
  on Lessons do |lessons|
203
204
  lessons.lessons_list.should include @module.title
@@ -4,7 +4,7 @@ require 'yaml'
4
4
 
5
5
  describe "Import Site" do
6
6
 
7
- include Utilities
7
+ include StringFactory
8
8
  include Workflows
9
9
  include Foundry
10
10
 
@@ -16,14 +16,15 @@ describe "Import Site" do
16
16
  @sakai = SambalCLE.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
+ @instructor = make UserObject, :id=>@directory['person3']['id'], :password=>@directory['person3']['password'],
20
+ :first_name=>@directory['person3']['firstname'], :last_name=>@directory['person3']['lastname'],
21
+ :type=>"Instructor"
21
22
 
22
23
  @file_path = @config['data_directory']
23
24
  @source_site_string = "Links to various items in this site:"
24
25
 
25
26
  # Log in to Sakai
26
- @sakai.page.login(@instructor, @ipassword)
27
+ @instructor.login
27
28
 
28
29
  @site1 = make CourseSiteObject, :description=>"Original Site"
29
30
  @site1.create
@@ -199,7 +200,7 @@ describe "Import Site" do
199
200
  check_this_stuff(@new_topic.description_html)
200
201
  end
201
202
 
202
- xit "imports Lessons correctly" do
203
+ it "imports Lessons correctly" do
203
204
  lessons
204
205
  on Lessons do |lessons|
205
206
  lessons.lessons_list.should include @module.title