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.
Files changed (44) hide show
  1. data/lib/sakai-cle-test-api.rb +2 -7
  2. data/lib/sakai-cle-test-api/admin_page_elements.rb +2 -6
  3. data/lib/sakai-cle-test-api/announcements.rb +7 -274
  4. data/lib/sakai-cle-test-api/assessments.rb +27 -930
  5. data/lib/sakai-cle-test-api/assignments.rb +13 -769
  6. data/lib/sakai-cle-test-api/basic_lti.rb +1 -5
  7. data/lib/sakai-cle-test-api/blogs.rb +2 -54
  8. data/lib/sakai-cle-test-api/calendar.rb +8 -423
  9. data/lib/sakai-cle-test-api/common_page_elements.rb +172 -69
  10. data/lib/sakai-cle-test-api/drop_box.rb +0 -21
  11. data/lib/sakai-cle-test-api/email_archive.rb +1 -15
  12. data/lib/sakai-cle-test-api/forums.rb +8 -282
  13. data/lib/sakai-cle-test-api/gradebook.rb +1 -19
  14. data/lib/sakai-cle-test-api/gradebook2.rb +1 -15
  15. data/lib/sakai-cle-test-api/messages.rb +15 -551
  16. data/lib/sakai-cle-test-api/news.rb +1 -3
  17. data/lib/sakai-cle-test-api/polls.rb +3 -65
  18. data/lib/sakai-cle-test-api/profile.rb +2 -36
  19. data/lib/sakai-cle-test-api/profile2.rb +6 -315
  20. data/lib/sakai-cle-test-api/sections.rb +8 -198
  21. data/lib/sakai-cle-test-api/site_page_elements.rb +441 -4
  22. data/lib/sakai-cle-test-api/syllabus.rb +7 -149
  23. data/lib/sakai-cle-test-api/tools_menu.rb +20 -3
  24. data/lib/sakai-cle-test-api/utilities.rb +0 -260
  25. data/sakai-cle-test-api.gemspec +3 -2
  26. metadata +19 -21
  27. data/lib/sakai-cle-test-api/add_files.rb +0 -198
  28. data/lib/sakai-cle-test-api/chat_room.rb +0 -0
  29. data/lib/sakai-cle-test-api/core-ext.rb +0 -90
  30. data/lib/sakai-cle-test-api/data_objects/announcement.rb +0 -38
  31. data/lib/sakai-cle-test-api/data_objects/assessment.rb +0 -32
  32. data/lib/sakai-cle-test-api/data_objects/assignment.rb +0 -62
  33. data/lib/sakai-cle-test-api/data_objects/event.rb +0 -86
  34. data/lib/sakai-cle-test-api/data_objects/lesson.rb +0 -137
  35. data/lib/sakai-cle-test-api/data_objects/resource.rb +0 -174
  36. data/lib/sakai-cle-test-api/data_objects/site.rb +0 -213
  37. data/lib/sakai-cle-test-api/data_objects/syllabus.rb +0 -7
  38. data/lib/sakai-cle-test-api/data_objects/topic.rb +0 -0
  39. data/lib/sakai-cle-test-api/data_objects/web_content_tool.rb +0 -52
  40. data/lib/sakai-cle-test-api/data_objects/wiki.rb +0 -7
  41. data/lib/sakai-cle-test-api/gem_ext.rb +0 -45
  42. data/lib/sakai-cle-test-api/lessons.rb +0 -440
  43. data/lib/sakai-cle-test-api/resources.rb +0 -138
  44. data/lib/sakai-cle-test-api/rich_text.rb +0 -13
@@ -1,15 +1,16 @@
1
1
  spec = Gem::Specification.new do |s|
2
2
  s.name = 'sakai-cle-test-api'
3
- s.version = '0.0.9'
3
+ s.version = '0.0.75'
4
4
  s.summary = %q{Sakai-CLE functional testing API for the rSmart Collaborative Learning Environment}
5
5
  s.description = %q{The Sakai-OAE gem provides an API for interacting with pages and page elements in rSmart's deployment of the Sakai Collaborative Learning Environment.}
6
6
  s.files = Dir.glob("**/**/**")
7
7
  s.test_files = Dir.glob("test/*test_rb")
8
8
  s.authors = ["Abraham Heward"]
9
9
  s.email = %w{"aheward@rsmart.com"}
10
- s.homepage = 'https://github.com/aheward/sambal/tree/master/Sakai/CLE/API'
10
+ s.homepage = 'https://github.com/aheward/Kuali-Sakai-Functional-Test-Automation-Framework/tree/master/Sakai/CLE/API'
11
11
  s.add_dependency 'page-object', '>= 0.6.6'
12
12
  s.add_dependency 'watir-webdriver', '>= 0.5.5'
13
13
  s.add_dependency 'selenium-webdriver', '>= 2.21.2'
14
+ s.add_dependency 'kuali-sakai-common-lib', '= 0.0.7'
14
15
  s.required_ruby_version = '>= 1.9.2'
15
16
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sakai-cle-test-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.75
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-13 00:00:00.000000000 Z
12
+ date: 2012-07-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: page-object
@@ -59,6 +59,22 @@ dependencies:
59
59
  - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: 2.21.2
62
+ - !ruby/object:Gem::Dependency
63
+ name: kuali-sakai-common-lib
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - '='
68
+ - !ruby/object:Gem::Version
69
+ version: 0.0.7
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - '='
76
+ - !ruby/object:Gem::Version
77
+ version: 0.0.7
62
78
  description: The Sakai-OAE gem provides an API for interacting with pages and page
63
79
  elements in rSmart's deployment of the Sakai Collaborative Learning Environment.
64
80
  email:
@@ -68,7 +84,6 @@ extensions: []
68
84
  extra_rdoc_files: []
69
85
  files:
70
86
  - Gemfile
71
- - lib/sakai-cle-test-api/add_files.rb
72
87
  - lib/sakai-cle-test-api/admin_page_elements.rb
73
88
  - lib/sakai-cle-test-api/announcements.rb
74
89
  - lib/sakai-cle-test-api/assessments.rb
@@ -77,36 +92,19 @@ files:
77
92
  - lib/sakai-cle-test-api/blogs.rb
78
93
  - lib/sakai-cle-test-api/calendar.rb
79
94
  - lib/sakai-cle-test-api/calendar_summary.rb
80
- - lib/sakai-cle-test-api/chat_room.rb
81
95
  - lib/sakai-cle-test-api/common_page_elements.rb
82
- - lib/sakai-cle-test-api/core-ext.rb
83
- - lib/sakai-cle-test-api/data_objects/announcement.rb
84
- - lib/sakai-cle-test-api/data_objects/assessment.rb
85
- - lib/sakai-cle-test-api/data_objects/assignment.rb
86
- - lib/sakai-cle-test-api/data_objects/event.rb
87
- - lib/sakai-cle-test-api/data_objects/lesson.rb
88
- - lib/sakai-cle-test-api/data_objects/resource.rb
89
- - lib/sakai-cle-test-api/data_objects/site.rb
90
- - lib/sakai-cle-test-api/data_objects/syllabus.rb
91
- - lib/sakai-cle-test-api/data_objects/topic.rb
92
- - lib/sakai-cle-test-api/data_objects/web_content_tool.rb
93
- - lib/sakai-cle-test-api/data_objects/wiki.rb
94
96
  - lib/sakai-cle-test-api/drop_box.rb
95
97
  - lib/sakai-cle-test-api/email_archive.rb
96
98
  - lib/sakai-cle-test-api/forums.rb
97
- - lib/sakai-cle-test-api/gem_ext.rb
98
99
  - lib/sakai-cle-test-api/gradebook.rb
99
100
  - lib/sakai-cle-test-api/gradebook2.rb
100
- - lib/sakai-cle-test-api/lessons.rb
101
101
  - lib/sakai-cle-test-api/messages.rb
102
102
  - lib/sakai-cle-test-api/news.rb
103
103
  - lib/sakai-cle-test-api/polls.rb
104
104
  - lib/sakai-cle-test-api/post_em.rb
105
105
  - lib/sakai-cle-test-api/profile.rb
106
106
  - lib/sakai-cle-test-api/profile2.rb
107
- - lib/sakai-cle-test-api/resources.rb
108
107
  - lib/sakai-cle-test-api/resources_roster.rb
109
- - lib/sakai-cle-test-api/rich_text.rb
110
108
  - lib/sakai-cle-test-api/rwiki.rb
111
109
  - lib/sakai-cle-test-api/sections.rb
112
110
  - lib/sakai-cle-test-api/single_user.rb
@@ -118,7 +116,7 @@ files:
118
116
  - lib/sakai-cle-test-api.rb
119
117
  - README.md
120
118
  - sakai-cle-test-api.gemspec
121
- homepage: https://github.com/aheward/sambal/tree/master/Sakai/CLE/API
119
+ homepage: https://github.com/aheward/Kuali-Sakai-Functional-Test-Automation-Framework/tree/master/Sakai/CLE/API
122
120
  licenses: []
123
121
  post_install_message:
124
122
  rdoc_options: []
@@ -1,198 +0,0 @@
1
- # This class consolidates the code that can be shared among all the
2
- # File Upload and Attachment pages.
3
- #
4
- # Not every method in this class will be appropriate for every attachment page.
5
- class AddFiles
6
-
7
- include PageObject
8
-
9
- thing(:files_table) { |b| b.frm.table(:class=>/listHier lines/) }
10
-
11
- # Returns an array of the displayed folder names.
12
- def folder_names
13
- names = []
14
- files_table.rows.each do |row|
15
- next if row.td(:class=>"specialLink").exist? == false
16
- next if row.td(:class=>"specialLink").link(:title=>"Folder").exist? == false
17
- names << row.td(:class=>"specialLink").link(:title=>"Folder").text
18
- end
19
- names
20
- end
21
-
22
- # Returns an array of the file names currently listed
23
- # on the page.
24
- #
25
- # It excludes folder names.
26
- def file_names
27
- names = []
28
- files_table.rows.each do |row|
29
- next if row.td(:class=>"specialLink").exist? == false
30
- next if row.td(:class=>"specialLink").link(:title=>"Folder").exist?
31
- names << row.td(:class=>"specialLink").link(:href=>/access.content/, :index=>1).text
32
- end
33
- names
34
- end
35
-
36
- # Clicks the Select button next to the specified file.
37
- def select_file(filename)
38
- files_table.row(:text, /#{Regexp.escape(filename)}/).link(:text=>"Select").click
39
- end
40
-
41
- # Clicks the Remove button.
42
- action(:remove) { |b| b.frm.button(:value=>"Remove").click }
43
-
44
- # Clicks the remove link for the specified item in the attachment list.
45
- def remove_item(file_name)
46
- files_table.row(:text=>/#{Regexp.escape(file_name)}/).link(:href=>/doRemoveitem/).click
47
- end
48
-
49
- # Clicks the Move button.
50
- action(:move) { |b| b.frm.button(:value=>"Move").click }
51
-
52
- # Clicks the Show Other Sites link.
53
- action(:show_other_sites) { |b| b.frm.link(:text=>"Show other sites").click }
54
-
55
- def href(item)
56
- frm.link(:text=>item).href
57
- end
58
-
59
- # Clicks on the specified folder image, which
60
- # will open the folder tree and remain on the page.
61
- def open_folder(foldername)
62
- files_table.row(:text=>/#{Regexp.escape(foldername)}/).link(:title=>"Open this folder").click
63
- end
64
-
65
- # Clicks on the specified folder name, which should open
66
- # the folder contents on a refreshed page.
67
- def go_to_folder(foldername)
68
- frm.link(:text=>foldername).click
69
- end
70
-
71
- # Sets the URL field to the specified value.
72
- def url=(url_string)
73
- frm.text_field(:id=>"url").set(url_string)
74
- end
75
-
76
- # Clicks the Add button next to the URL field.
77
- def add
78
- frm.button(:value=>"Add").click
79
- end
80
-
81
- # Gets the value of the access level cell for the specified
82
- # file.
83
- def access_level(filename)
84
- files_table.row(:text=>/#{Regexp.escape(filename)}/)[6].text
85
- end
86
-
87
- def edit_details(name)
88
- files_table.row(:text=>/#{Regexp.escape(name)}/).li(:text=>/Action/, :class=>"menuOpen").fire_event("onclick")
89
- files_table.row(:text=>/#{Regexp.escape(name)}/).link(:text=>"Edit Details").click
90
- end
91
-
92
- # Clicks the Create Folders menu item in the
93
- # Add menu of the specified folder.
94
- def create_subfolders_in(folder_name)
95
- open_add_menu(folder_name)
96
- files_table.row(:text=>/#{Regexp.escape(folder_name)}/).link(:text=>"Create Folders").click
97
- end
98
-
99
- def create_html_page_in(folder_name)
100
- open_add_menu(folder_name)
101
- files_table.row(:text=>/#{Regexp.escape(folder_name)}/).link(:text=>"Create HTML Page").click
102
- end
103
-
104
- # Enters the specified file into the file field name (assuming it's in the
105
- # data/sakai-cle-test-api folder or a subfolder therein)
106
- #
107
- def upload_file(filename, filepath="")
108
- frm.file_field(:id=>"upload").set(filepath + filename)
109
- if frm.div(:class=>"alertMessage").exist?
110
- sleep 2
111
- upload_file(filename)
112
- end
113
- end
114
-
115
- # Enters the specified file into the file field name (assuming it's in the
116
- # data/sakai-cle-test-api folder or a subfolder therein)
117
- #
118
- # Use this method ONLY for instances where there's a file field on the page
119
- # with an "upload" id.
120
- def upload_local_file(filename, filepath="")
121
- frm.file_field(:id=>"upload").set(filepath + filename)
122
- if frm.div(:class=>"alertMessage").exist?
123
- sleep 2
124
- upload_local_file(filename)
125
- end
126
- end
127
-
128
- # Clicks the Add Menu for the specified
129
- # folder, then selects the Upload Files
130
- # command in the menu that appears.
131
- def upload_file_to_folder(folder_name)
132
- upload_files_to_folder(folder_name)
133
- end
134
-
135
- # Clicks the Add Menu for the specified
136
- # folder, then selects the Upload Files
137
- # command in the menu that appears.
138
- def upload_files_to_folder(folder_name)
139
- if frm.li(:text=>/A/, :class=>"menuOpen").exist?
140
- files_table.row(:text=>/#{Regexp.escape(folder_name)}/).li(:text=>/A/, :class=>"menuOpen").fire_event("onclick")
141
- else
142
- files_table.row(:text=>/#{Regexp.escape(folder_name)}/).link(:text=>"Start Add Menu").fire_event("onfocus")
143
- end
144
- files_table.row(:text=>/#{Regexp.escape(folder_name)}/).link(:text=>"Upload Files").click
145
- end
146
-
147
- # Clicks the "Attach a copy" link for the specified
148
- # file, then reinstantiates the Class.
149
- # If an alert box appears, the method will call itself again.
150
- # Note that this can lead to an infinite loop. Will need to fix later.
151
- def attach_a_copy(file_name)
152
- files_table.row(:text=>/#{Regexp.escape(file_name)}/).link(:href=>/doAttachitem/).click
153
- if frm.div(:class=>"alertMessage").exist?
154
- sleep 1
155
- attach_a_copy(file_name) # TODO - This can loop infinitely
156
- end
157
- end
158
-
159
- # Takes the specified array object containing pointers
160
- # to local file resources, then uploads those files to
161
- # the folder specified, checks if they all uploaded properly and
162
- # if not, re-tries the ones that failed the first time.
163
- #
164
- # Finally, it re-instantiates the appropriate page class.
165
- # Note that it expects all files to be located in the same folder (can be in subfolders of that folder).
166
- def upload_multiple_files_to_folder(folder, file_array, file_path="")
167
-
168
- upload = upload_files_to_folder folder
169
-
170
- file_array.each do |file|
171
- upload.file_to_upload(file, file_path)
172
- upload.add_another_file
173
- end
174
-
175
- resources = upload.upload_files_now
176
-
177
- file_array.each do |file|
178
- file =~ /(?<=\/).+/
179
- # puts $~.to_s # For debugging purposes
180
- unless resources.file_names.include?($~.to_s)
181
- upload_files = resources.upload_files_to_folder(folder)
182
- upload_files.file_to_upload(file, file_path)
183
- upload_files.upload_files_now
184
- end
185
- end
186
- end
187
-
188
- # Clicks the Continue button
189
- def continue
190
- frm.div(:class=>"highlightPanel").span(:id=>"submitnotifxxx").wait_while_present
191
- frm.button(:value=>"Continue").click
192
- end
193
-
194
- def open_add_menu(folder_name)
195
- files_table.row(:text=>/#{Regexp.escape(folder_name)}/).link(:text=>"Start Add Menu").fire_event("onfocus")
196
- end
197
-
198
- end
File without changes
@@ -1,90 +0,0 @@
1
- class Time
2
-
3
- # Using the :year_range option (or no option), this method creates a
4
- # Time object of a random value, within
5
- # the year range specified (default is 5 years in the past).
6
- #
7
- # Using the :series option, this method returns an array
8
- # containing a randomized Time object as its first element (limited by
9
- # the specified :year_range value). Subsequent elements will be Time objects
10
- # with values putting them later than the prior element, within the specified
11
- # range value (see examples).
12
- #
13
- # Usage Examples:
14
- # @example
15
- # a random date...
16
- # ?> Time.random
17
- # => Tue Aug 05 00:00:00 EDT 2007
18
- #
19
- # birthdays, anyone?...
20
- # 5.times { p Time.random(:year_range=>80) }
21
- # Wed Feb 06 00:00:00 EDT 1974
22
- # Tue Dec 22 00:00:00 EST 1992
23
- # Fri Apr 14 00:00:00 EWT 1944
24
- # Thu Jul 01 00:00:00 EDT 1993
25
- # Wed Oct 02 00:00:00 EDT 2002
26
- #
27
- # A series of dates are useful for account-related info...
28
- # ?> Time.random(:series=>[20.days, 3.years])
29
- # => [Sat Jan 22 00:00:00 EST 2005,
30
- # Sat Jan 29 12:58:45 EST 2005,
31
- # Fri Sep 08 09:34:58 EDT 2006]
32
- #
33
- # or maybe to simulate events during an hour?...
34
- # ?> Time.random(:series=>[1.hour,1.hour,1.hour])
35
- # => [Wed Apr 21 00:00:00 EDT 2004,
36
- # Wed Apr 21 00:45:59 EDT 2004,
37
- # Wed Apr 21 01:02:47 EDT 2004,
38
- # Wed Apr 21 01:31:00 EDT 2004]
39
- def self.random(params={})
40
- years_back = params[:year_range] || 5
41
- year = (rand * (years_back)).ceil + (Time.now.year - years_back)
42
- month = (rand * 12).ceil
43
- day = (rand * 31).ceil
44
- series = [date = Time.local(year, month, day)]
45
- if params[:series]
46
- params[:series].each do |some_time_after|
47
- series << series.last + (rand * some_time_after).ceil
48
- end
49
- return series
50
- end
51
- date
52
- end
53
-
54
- end # Time
55
-
56
- module Enumerable
57
-
58
- # Use for getting a natural sort order instead of the ASCII
59
- # sort order.
60
- def alphabetize
61
- sort { |a, b| grouped_compare(a, b) }
62
- end
63
-
64
- # Use for sorting an Enumerable object in place.
65
- def alphabetize!
66
- sort! { |a, b| grouped_compare(a, b) }
67
- end
68
-
69
- private
70
- def grouped_compare(a, b)
71
- loop {
72
- a_chunk, a = extract_alpha_or_number_group(a)
73
- b_chunk, b = extract_alpha_or_number_group(b)
74
- ret = a_chunk <=> b_chunk
75
- return -1 if a_chunk == ''
76
- return ret if ret != 0
77
- }
78
- end
79
-
80
- def extract_alpha_or_number_group(item)
81
- test_item = item.downcase
82
- matchdata = /([a-z]+|[\d]+)/.match(test_item)
83
- if matchdata.nil?
84
- ["", ""]
85
- else
86
- [matchdata[0], test_item = test_item[matchdata.offset(0)[1] .. -1]]
87
- end
88
- end
89
-
90
- end # Enumerable
@@ -1,38 +0,0 @@
1
- class AnnouncementObject
2
-
3
- include PageObject
4
- include Utilities
5
- include ToolsMenu
6
-
7
- attr_accessor :title, :body, :site, :link
8
-
9
- def initialize(browser, opts={})
10
- @browser = browser
11
-
12
- defaults = {
13
- :title=>random_alphanums,
14
- :body=>random_multiline(500, 10, :alpha)
15
- }
16
- options = defaults.merge(opts)
17
- @title=options[:title]
18
- @body=options[:body]
19
- @site=options[:site]
20
- raise "You must specify a Site for the announcement" if @site==nil
21
- end
22
-
23
- def create
24
- my_workspace.open_my_site_by_name @site unless @browser.title=~/#{@site}/
25
- announcements unless @browser.title=~/Announcements$/
26
- on_page Announcements do |page|
27
- page.add
28
- end
29
- on_page AddEditAnnouncements do |page|
30
- page.title=@title
31
- page.body=@body
32
- page.add_announcement
33
- end
34
- on_page Announcements do |page|
35
- @link = page.href(@title)
36
- end
37
- end
38
- end
@@ -1,32 +0,0 @@
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