sakai-cle-test-api 0.0.7 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. data/lib/sakai-cle-test-api.rb +7 -2
  2. data/lib/sakai-cle-test-api/add_files.rb +198 -0
  3. data/lib/sakai-cle-test-api/admin_page_elements.rb +7 -3
  4. data/lib/sakai-cle-test-api/announcements.rb +274 -7
  5. data/lib/sakai-cle-test-api/assessments.rb +930 -27
  6. data/lib/sakai-cle-test-api/assignments.rb +769 -13
  7. data/lib/sakai-cle-test-api/basic_lti.rb +5 -1
  8. data/lib/sakai-cle-test-api/blogs.rb +54 -2
  9. data/lib/sakai-cle-test-api/calendar.rb +423 -8
  10. data/lib/sakai-cle-test-api/chat_room.rb +0 -0
  11. data/lib/sakai-cle-test-api/common_page_elements.rb +69 -172
  12. data/lib/sakai-cle-test-api/core-ext.rb +90 -0
  13. data/lib/sakai-cle-test-api/data_objects/announcement.rb +38 -0
  14. data/lib/sakai-cle-test-api/data_objects/assessment.rb +32 -0
  15. data/lib/sakai-cle-test-api/data_objects/assignment.rb +62 -0
  16. data/lib/sakai-cle-test-api/data_objects/event.rb +86 -0
  17. data/lib/sakai-cle-test-api/data_objects/lesson.rb +137 -0
  18. data/lib/sakai-cle-test-api/data_objects/resource.rb +174 -0
  19. data/lib/sakai-cle-test-api/data_objects/site.rb +213 -0
  20. data/lib/sakai-cle-test-api/data_objects/syllabus.rb +7 -0
  21. data/lib/sakai-cle-test-api/data_objects/topic.rb +0 -0
  22. data/lib/sakai-cle-test-api/data_objects/web_content_tool.rb +52 -0
  23. data/lib/sakai-cle-test-api/data_objects/wiki.rb +7 -0
  24. data/lib/sakai-cle-test-api/drop_box.rb +21 -0
  25. data/lib/sakai-cle-test-api/email_archive.rb +15 -1
  26. data/lib/sakai-cle-test-api/forums.rb +282 -8
  27. data/lib/sakai-cle-test-api/gem_ext.rb +45 -0
  28. data/lib/sakai-cle-test-api/gradebook.rb +19 -1
  29. data/lib/sakai-cle-test-api/gradebook2.rb +15 -1
  30. data/lib/sakai-cle-test-api/lessons.rb +440 -0
  31. data/lib/sakai-cle-test-api/messages.rb +551 -15
  32. data/lib/sakai-cle-test-api/news.rb +3 -1
  33. data/lib/sakai-cle-test-api/polls.rb +65 -3
  34. data/lib/sakai-cle-test-api/profile.rb +36 -2
  35. data/lib/sakai-cle-test-api/profile2.rb +315 -6
  36. data/lib/sakai-cle-test-api/resources.rb +138 -0
  37. data/lib/sakai-cle-test-api/rich_text.rb +13 -0
  38. data/lib/sakai-cle-test-api/sections.rb +198 -8
  39. data/lib/sakai-cle-test-api/site_page_elements.rb +4 -441
  40. data/lib/sakai-cle-test-api/syllabus.rb +149 -7
  41. data/lib/sakai-cle-test-api/tools_menu.rb +3 -20
  42. data/lib/sakai-cle-test-api/utilities.rb +260 -0
  43. data/sakai-cle-test-api.gemspec +2 -3
  44. metadata +21 -19
@@ -0,0 +1,32 @@
1
+ class AssessmentObject
2
+
3
+ include PageObject
4
+ include Utilities
5
+ include ToolsMenu
6
+
7
+ attr_accessor :title, :site
8
+
9
+ def initialize(browser, opts={})
10
+ @browser = browser
11
+
12
+ defaults = {
13
+ :title=>random_alphanums,
14
+ :site=>"placeholder"
15
+ }
16
+ options = defaults.merge(opts)
17
+ @title=options[:title]
18
+ @site=options[:site]
19
+ raise "You must specify a Site for your Assessment" if @site==nil
20
+ end
21
+
22
+ def create
23
+ my_workspace.open_my_site_by_name @site unless @browser.title=~/#{@site}/
24
+ tests_and_quizzes unless @browser.title=~/Tests & Quizzes$/
25
+ on_page AssessmentsList do |page|
26
+ page.title=@title
27
+ page.create
28
+ end
29
+ # Do more here eventually...
30
+ end
31
+
32
+ end
@@ -0,0 +1,62 @@
1
+ class AssignmentObject
2
+
3
+ include PageObject
4
+ include Utilities
5
+ include ToolsMenu
6
+
7
+ attr_accessor :title, :site, :instructions, :id, :link
8
+
9
+ def initialize(browser, opts={})
10
+ @browser = browser
11
+
12
+ defaults = {
13
+ :title=>random_alphanums,
14
+ :instructions=>random_multiline(500, 10, :string),
15
+ :site=>"placeholder"
16
+
17
+ }
18
+ options = defaults.merge(opts)
19
+
20
+ @title=options[:title]
21
+ @instructions=options[:instructions]
22
+ @site=options[:site]
23
+ raise "You must specify a Site for your Assignment" if @site==nil
24
+ end
25
+
26
+ def create
27
+ open_my_site_by_name @site unless @browser.title=~/#{@site}/
28
+
29
+ # Go to assignments page
30
+ assignments unless @browser.title=~/Assignments$/
31
+ on_page AssignmentsList do |page|
32
+ page.add
33
+ end
34
+ on_page AssignmentAdd do |add|
35
+ add.title=@title
36
+ add.instructions=@instructions
37
+ add.post
38
+ end
39
+ on_page AssignmentsList do |list|
40
+ @id = list.get_assignment_id @title
41
+ @link = list.assignment_href @title
42
+ end
43
+ end
44
+
45
+ def edit opts={}
46
+ open_my_site_by_name @site unless @browser.title=~/#{@site}/
47
+ assignments unless @browser.title=~/Assignments$/
48
+ list = AssignmentsList.new @browser
49
+ edit = list.edit_assignment @title
50
+ edit.title=opts[:title] unless opts[:title] == nil
51
+ unless opts[:instructions] == nil
52
+ edit.source(edit.editor)
53
+ edit.source=opts[:instructions]
54
+ end
55
+ edit.post
56
+
57
+ @title=opts[:title] unless opts[:title] == nil
58
+ @instructions=opts[:instructions] unless opts[:instructions] == nil
59
+
60
+ end
61
+
62
+ end
@@ -0,0 +1,86 @@
1
+ class EventObject
2
+
3
+ include PageObject
4
+ include Utilities
5
+ include ToolsMenu
6
+
7
+ attr_accessor :title, :month, :day, :year, :start_hour, :start_minute,
8
+ :start_meridian, :duration_hours, :duration_minutes, :end_hour,
9
+ :end_minute, :end_meridian, :message, :site, :link
10
+
11
+ def initialize(browser, opts={})
12
+ @browser = browser
13
+
14
+ defaults = {
15
+ :title=>random_alphanums,
16
+ :month=>in_15_minutes[:month_str],
17
+ :day=>in_15_minutes[:day],
18
+ :year=>in_15_minutes[:year],
19
+ :start_hour=>in_15_minutes[:hour],
20
+ :start_minute=>in_15_minutes[:minute],
21
+ :start_meridian=>in_15_minutes[:meridian],
22
+ :duration_hours=>nil,
23
+ :duration_minutes=>nil,
24
+ :end_hour=>nil,
25
+ :end_minute=>nil,
26
+ :end_meridian=>nil,
27
+ :message=>random_multiline(400,20, :alpha),
28
+ :site=>"placeholder"
29
+ }
30
+ options = defaults.merge(opts)
31
+
32
+ @title=options[:title]
33
+ @month=options[:month]
34
+ @day=options[:day]
35
+ @year=options[:year]
36
+ @start_hour=options[:start_hour]
37
+ @start_minute=options[:start_minute]
38
+ @start_meridian=options[:start_meridian]
39
+ @duration_hours=options[:duration_hours]
40
+ @duration_minutes=options[:duration_minutes]
41
+ @end_hour=options[:end_hour]
42
+ @end_minute=options[:end_minute]
43
+ @end_meridian=options[:end_meridian]
44
+ @message=options[:message]
45
+ @site=options[:site]
46
+
47
+ end
48
+
49
+ def create
50
+ open_my_site_by_name @site unless @browser.title=~/#{@site}/
51
+ calendar unless @browser.title=~/Calendar$/
52
+ cal = Calendar.new @browser
53
+ add_event = cal.add
54
+ add_event.message=@message
55
+ add_event.title=@title
56
+ add_event.month=@month
57
+ add_event.day=@day
58
+ add_event.year=@year
59
+ add_event.start_hour=@start_hour
60
+ add_event.start_minute=@start_minute
61
+ add_event.start_meridian=@start_meridian
62
+ if @end_hour == nil && @duration_hours == nil
63
+ @duration_hours = add_event.hours
64
+ @duration_minutes = add_event.minutes
65
+ @end_hour = add_event.end_hour
66
+ @end_minute = add_event.end_minute
67
+ @end_meridian = add_event.end_meridian
68
+ elsif @end_hour == nil
69
+ add_event.hours=@duration_hours
70
+ add_event.minutes=@duration_minutes
71
+ @end_hour = add_event.end_hour
72
+ @end_minute = add_event.end_minute
73
+ @end_meridian = add_event.end_meridian
74
+ elsif @duration_hours == nil
75
+
76
+ else
77
+
78
+ end
79
+
80
+ cal = add_event.save_event
81
+
82
+ @link = cal.event_href @title
83
+
84
+ end
85
+
86
+ end
@@ -0,0 +1,137 @@
1
+ class ModuleObject
2
+
3
+ include PageObject
4
+ include Utilities
5
+ include ToolsMenu
6
+
7
+ attr_accessor :title, :description, :keywords, :start_date, :end_date, :site
8
+
9
+ def initialize(browser, opts={})
10
+ @browser = browser
11
+
12
+ defaults = {
13
+ :title=>random_alphanums
14
+ }
15
+ options = defaults.merge(opts)
16
+
17
+ @title=options[:title]
18
+ @description=options[:description]
19
+ @keywords=options[:keywords]
20
+ @start_date=options[:start_date]
21
+ @end_date=options[:end_date]
22
+ @site=options[:site]
23
+ raise "You must specify a Site name for your lesson" if @site==nil
24
+ end
25
+
26
+ def create
27
+ open_my_site_by_name @site unless @browser.title=~/#{@site}/
28
+ lessons unless @browser.title=~/Lessons$/
29
+ reset
30
+ on_page Lessons do |page|
31
+ page.add_module
32
+ end
33
+ on_page AddEditModule do |page|
34
+ page.title=@title
35
+ page.description=@description
36
+ page.keywords=@keywords
37
+ page.start_date=@start_date
38
+ page.end_date=@end_date
39
+ page.add
40
+ end
41
+ on_page ConfirmModule do |page|
42
+ page.return_to_modules
43
+ end
44
+ end
45
+
46
+ end
47
+
48
+ class ContentSectionObject
49
+
50
+ include PageObject
51
+ include Utilities
52
+ include ToolsMenu
53
+
54
+ attr_accessor :site, :module, :title, :instructions, :modality, :content_type,
55
+ :copyright_status, :editor_content, :file_name, :file_path, :url, :url_title,
56
+ :file_description, :url_description
57
+
58
+ def initialize(browser, opts={})
59
+ @browser = browser
60
+
61
+ defaults = {
62
+ :title=>random_alphanums,
63
+ :copyright_status=>"Public Domain",
64
+ :modality=>[:check_textual]
65
+ }
66
+ options = defaults.merge(opts)
67
+
68
+ @site=options[:site]
69
+ @module=options[:module]
70
+ @title=options[:title]
71
+ @instructions=options[:instructions]
72
+ @modality=options[:modality]
73
+ @content_type=options[:content_type]
74
+ @copyright_status=options[:copyright_status]
75
+ @editor_content=options[:editor_content]
76
+ @file_name=options[:file_name]
77
+ @file_path=options[:file_path]
78
+ @file_description=options[:file_description]
79
+ @url=options[:url]
80
+ @url_title=options[:url_title]
81
+ @url_description=options[:url_description]
82
+ raise "Your modality variable must be an Array containing one or more keys\nthat match the checkbox methods, like this:\n[:uncheck_textual, :check_visual, :check_auditory]" unless @modality.class==Array
83
+ raise "You must specify a Site for your Section" if @site==nil
84
+ raise "You must specify a Module for your Section" if @module==nil
85
+ end
86
+
87
+ def create
88
+ open_my_site_by_name @site unless @browser.title=~/#{@site}/
89
+ lessons unless @browser.title=~/Lessons$/
90
+ reset
91
+ on_page Lessons do |page|
92
+ page.open_lesson @module
93
+ end
94
+ on_page AddEditModule do |page|
95
+ page.add_content_sections
96
+ end
97
+ on_page AddEditContentSection do |page|
98
+ page.title=@title
99
+ page.instructions=@instructions
100
+ @modality.each do |content|
101
+ page.send(content)
102
+ end
103
+ page.content_type=@content_type unless @content_type==nil
104
+ sleep 3 # Need to wait for page refresh
105
+ case @content_type
106
+ when "Compose content with editor"
107
+ page.source(page.content_editor)
108
+ page.source=@editor_content
109
+ when "Upload or link to a file"
110
+ page.select_a_file
111
+ on_page LessonAddAttachment do |subpage|
112
+ subpage.upload_local_file @file_name, @file_path
113
+ subpage.continue
114
+ end
115
+ page.file_description=@file_description
116
+ when "Link to new or existing URL resource on server"
117
+ page.select_url
118
+ on_page SelectingContent do |subpage|
119
+ subpage.new_url=@url
120
+ subpage.url_title=@url_title
121
+ subpage.continue
122
+ end
123
+ page.url_description=@url_description
124
+ when "Upload or link to a file in Resources"
125
+ page.select_or_upload_file
126
+ on_page AddFiles do |subpage|
127
+ subpage.select @file_name
128
+ subpage.continue
129
+ end
130
+ else
131
+ raise "You have a typo in what you've specified for your Section's content type.\nIt must be one of the options contained in the dropdown."
132
+ end
133
+ page.copyright_status=@copyright_status
134
+ page.add
135
+ end
136
+ end
137
+ end
@@ -0,0 +1,174 @@
1
+ class FileObject
2
+
3
+ include PageObject
4
+ include Utilities
5
+ include ToolsMenu
6
+
7
+ attr_accessor
8
+
9
+ def initialize(browser, opts={})
10
+ @browser = browser
11
+
12
+ defaults = {}
13
+ options = defaults.merge(opts)
14
+ end
15
+
16
+ def create
17
+
18
+ end
19
+
20
+ end
21
+
22
+ class FolderObject
23
+ include PageObject
24
+ include Utilities
25
+ include ToolsMenu
26
+
27
+ attr_accessor :name, :parent_folder, :site
28
+
29
+ def initialize(browser, opts={})
30
+ @browser = browser
31
+
32
+ defaults = {
33
+ :name=>random_alphanums
34
+ }
35
+ options = defaults.merge(opts)
36
+
37
+ @name = options[:name]
38
+ @parent_folder = options[:parent_folder]
39
+ @site = options[:site]
40
+ raise "You must specify a Site for your Folder" if @site==nil
41
+ end
42
+
43
+ def create
44
+ open_my_site_by_name @site unless @browser.title=~/#{@site}/
45
+ resources unless @browser.title=~/Resources$/
46
+ on_page Resources do |page|
47
+ page.create_subfolders_in @parent_folder
48
+ end
49
+ on_page CreateFolders do |page|
50
+ page.folder_name.set @name
51
+ page.create_folders_now
52
+ end
53
+ end
54
+
55
+ end
56
+
57
+ class WebLinkObject
58
+ include PageObject
59
+ include Utilities
60
+ include ToolsMenu
61
+
62
+ attr_accessor
63
+
64
+ def initialize(browser, opts={})
65
+ @browser = browser
66
+
67
+ defaults = {}
68
+ options = defaults.merge(opts)
69
+ @site = options[:site]
70
+ raise "You must specify a Site for your Web Link" if @site==nil
71
+ end
72
+
73
+ def create
74
+
75
+ end
76
+
77
+ end
78
+
79
+ class HTMLPageObject
80
+
81
+ include PageObject
82
+ include Utilities
83
+ include ToolsMenu
84
+
85
+ attr_accessor :name, :description, :site, :folder, :html, :url
86
+
87
+ def initialize(browser, opts={})
88
+ @browser = browser
89
+
90
+ defaults = {
91
+ :name=>random_alphanums,
92
+ :description=>random_multiline(500, 10, :alpha),
93
+ :html=>"<body>Body</body>"
94
+ }
95
+ options = defaults.merge(opts)
96
+
97
+ @name = options[:name]
98
+ @description = options[:description]
99
+ @site = options[:site]
100
+ @folder = options[:folder]
101
+ @html = options[:html]
102
+ @site = options[:site]
103
+ raise "You must specify a Site for your HTML Page" if @site==nil
104
+ end
105
+
106
+ def create
107
+ open_my_site_by_name @site unless @browser.title=~/#{@site}/
108
+ resources unless @browser.title=~/Resources$/
109
+ on_page Resources do |page|
110
+ page.create_html_page_in @folder
111
+ end
112
+ on_page CreateHTMLPageContent do |page|
113
+ page.source(page.editor)
114
+ page.source=@html
115
+ page.continue
116
+ end
117
+ on_page CreateHTMLPageProperties do |page|
118
+ page.name.set @name
119
+ page.description.set @description
120
+ # Put more here as needed later
121
+ page.finish
122
+ end
123
+ on_page Resources do |page|
124
+ @url = page.href(@name)
125
+ end
126
+ end
127
+
128
+ end
129
+
130
+ class TextDocumentObject
131
+ include PageObject
132
+ include Utilities
133
+ include ToolsMenu
134
+
135
+ attr_accessor
136
+
137
+ def initialize(browser, opts={})
138
+ @browser = browser
139
+
140
+ defaults = {}
141
+ options = defaults.merge(opts)
142
+ @site = options[:site]
143
+ raise "You must specify a Site for your Text Document" if @site==nil
144
+ end
145
+
146
+ def create
147
+ open_my_site_by_name @site unless @browser.title=~/#{@site}/
148
+ resources unless @browser.title=~/Resources$/
149
+ end
150
+
151
+ end
152
+
153
+ class CitationListObject
154
+ include PageObject
155
+ include Utilities
156
+ include ToolsMenu
157
+
158
+ attr_accessor
159
+
160
+ def initialize(browser, opts={})
161
+ @browser = browser
162
+
163
+ defaults = {}
164
+ options = defaults.merge(opts)
165
+ @site = options[:site]
166
+ raise "You must specify a Site for your Citations List" if @site==nil
167
+ end
168
+
169
+ def create
170
+ open_my_site_by_name @site unless @browser.title=~/#{@site}/
171
+ resources unless @browser.title=~/Resources$/
172
+ end
173
+
174
+ end