sakai-cle-test-api 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -92,7 +92,7 @@ class Login
92
92
  include ToolsMenu
93
93
 
94
94
  def search_public_courses_and_projects
95
- self.frame(:index=>0).link(:text=>"Search Public Courses and Projects").click
95
+ @browser.frame(:index=>0).link(:text=>"Search Public Courses and Projects").click
96
96
  SearchPublic.new(@browser)
97
97
  end
98
98
 
@@ -216,8 +216,8 @@ class EditProfile
216
216
  Profile.new(@browser)
217
217
  end
218
218
 
219
- def picture_file=(filename)
220
- frm.file_field(:name=>"editProfileForm:uploadFile.uploadId").set(File.expand_path(File.dirname(__FILE__)) + "/../../data/sakai-cle-test-api/" + filename)
219
+ def picture_file(filename, filepath="")
220
+ frm.file_field(:name=>"editProfileForm:uploadFile.uploadId").set(filepath + filename)
221
221
  end
222
222
 
223
223
  in_frame(:class=>"portletMainIframe") do |frame|
@@ -631,13 +631,14 @@ class AttachPageTools
631
631
  # the folder specified, checks if they all uploaded properly and
632
632
  # if not, re-tries the ones that failed the first time.
633
633
  #
634
- # Finally, it re-instantiates the AnnouncementsAttach page class.
635
- def upload_multiple_files_to_folder(folder, file_array)
634
+ # Finally, it re-instantiates the appropriate page class.
635
+ # Note that it expects all files to be located in the same folder (can be in subfolders of that folder).
636
+ def upload_multiple_files_to_folder(folder, file_array, file_path="")
636
637
 
637
638
  upload = upload_files_to_folder folder
638
639
 
639
640
  file_array.each do |file|
640
- upload.file_to_upload=file
641
+ upload.file_to_upload(file, file_path)
641
642
  upload.add_another_file
642
643
  end
643
644
 
@@ -648,7 +649,7 @@ class AttachPageTools
648
649
  # puts $~.to_s # For debugging purposes
649
650
  unless resources.file_names.include?($~.to_s)
650
651
  upload_files = resources.upload_files_to_folder(folder)
651
- upload_files.file_to_upload=file
652
+ upload_files.file_to_upload(file, file_path)
652
653
  resources = upload_files.upload_files_now
653
654
  end
654
655
  end
@@ -775,11 +775,10 @@ class ImportStepTwo
775
775
 
776
776
  # Enters the specified filename in the file field.
777
777
  #
778
- # Note that the file should be inside the data/sakai-cle-test-api folder.
779
- # The file or folder name used for the filename variable
780
- # should not include a preceding / character.
781
- def import_file(filename)
782
- frm.file_field(:name=>"importFile").set(File.expand_path(File.dirname(__FILE__)) + "/../../data/sakai-cle-test-api/" + filename)
778
+ # Note that the file path is an optional second parameter, if you do not want to
779
+ # include the full path in the filename.
780
+ def import_file(filename, filepath="")
781
+ frm.file_field(:name=>"importFile").set(filepath + filename)
783
782
  end
784
783
 
785
784
  end
@@ -911,11 +911,9 @@ class PoolImport
911
911
  include ToolsMenu
912
912
 
913
913
  # Enters the target file into the Choose File
914
- # file field. Note that it assumes the file is in
915
- # the data/sakai-cle-test-api folder in the expected resources
916
- # tree.
917
- def choose_file=(file_name)
918
- frm.file_field(:name=>"importPoolForm:_id6.upload").set(File.expand_path(File.dirname(__FILE__)) + "/../../data/sakai-cle-test-api/" + file_name)
914
+ # file field. Including the file path separately is optional.
915
+ def choose_file(file_name, file_path="")
916
+ frm.file_field(:name=>"importPoolForm:_id6.upload").set(file_path + file_name)
919
917
  end
920
918
 
921
919
  # Clicks the Import button, then
@@ -1075,9 +1073,10 @@ class BeginAssessment
1075
1073
  frm.select(:name=>/deliverMatching/, :index=>index).select(answer)
1076
1074
  end
1077
1075
 
1078
- # Enters the specified file name (and subdirectory below the expected target Sakai-CLE path) in the file field.
1079
- def file_answer(file_name)
1080
- frm.file_field(:name=>/deliverFileUpload/).set(File.expand_path(File.dirname(__FILE__)) + "/../../data/sakai-cle-test-api/" + file_name)
1076
+ # Enters the specified file name in the file field. You can include the path to the file
1077
+ # as an optional second parameter.
1078
+ def file_answer(file_name, file_path="")
1079
+ frm.file_field(:name=>/deliverFileUpload/).set(file_path + file_name)
1081
1080
  frm.button(:value=>"Upload").click
1082
1081
  end
1083
1082
 
@@ -1109,6 +1108,10 @@ class ConfirmSubmission
1109
1108
  SubmissionSummary.new(@browser)
1110
1109
  end
1111
1110
 
1111
+ in_frame(:class=>"portletMainIframe") do |frame|
1112
+ span(:validation, :class=>"validation", :frame=>frame)
1113
+ end
1114
+
1112
1115
  end
1113
1116
 
1114
1117
  # The summary page that appears when an Assessment has been submitted.
@@ -1124,6 +1127,10 @@ class SubmissionSummary
1124
1127
  TakeAssessmentList.new(@browser)
1125
1128
  end
1126
1129
 
1130
+ in_frame(:class=>"portletMainIframe") do |frame|
1131
+ div(:summary_info, :class=>"tier1", :frame=>frame)
1132
+ end
1133
+
1127
1134
  end
1128
1135
 
1129
1136
 
@@ -1661,15 +1668,14 @@ class AssignmentStudent
1661
1668
  # selecting the file and clicking the add more files button
1662
1669
  @@file_number = 0
1663
1670
 
1664
- # Enters the specified file name into the file field (the
1665
- # file is assumed to be in the data/sakai_cle folder in the
1666
- # correct file path relative to the script being run).
1671
+ # Enters the specified file name into the file field. Entering the path
1672
+ # separately is optional.
1667
1673
  # Once the filename is entered in the field, the
1668
1674
  # @@file_number class variable is increased by one
1669
1675
  # in case any more files need to be added to the upload
1670
1676
  # list.
1671
- def select_file=(file_name)
1672
- frm.file_field(:id=>"clonableUpload", :name=>"upload#{@@file_number}").set(File.expand_path(File.dirname(__FILE__)) + "/../../data/sakai-cle-test-api/" + file_name)
1677
+ def select_file(file_name, file_path="")
1678
+ frm.file_field(:id=>"clonableUpload", :name=>"upload#{@@file_number}").set(file_path + file_name)
1673
1679
  @@file_number += 1
1674
1680
  end
1675
1681
 
@@ -2183,16 +2189,14 @@ class CreateBloggerPost
2183
2189
 
2184
2190
  # Enters the specified filename in the file field for images.
2185
2191
  #
2186
- # Note that the file should be inside the data/sakai-cle-test-api folder.
2187
- # The file or folder name used for the filename variable
2188
- # should not include a preceding / character.
2189
- def image_file=(filename)
2190
- frm.file_field(:name=>"PostForm:tab1:_id29").set(File.expand_path(File.dirname(__FILE__)) + "/../../data/sakai-cle-test-api/" + filename)
2192
+ # The file path can be entered as an optional second parameter.
2193
+ def image_file(filename, filepath="")
2194
+ frm.file_field(:name=>"PostForm:tab1:_id29").set(filepath + filename)
2191
2195
  end
2192
2196
 
2193
2197
  # Enters the specified directory/filename in the file field.
2194
- def file_field=(filename)
2195
- frm().file_field(:name=>"PostForm:tab3:_id51").set(File.expand_path(File.dirname(__FILE__)) + "/../../data/sakai-cle-test-api/" + filename)
2198
+ def file_field(filename, filepath="")
2199
+ frm().file_field(:name=>"PostForm:tab3:_id51").set(filepath + filename)
2196
2200
  end
2197
2201
 
2198
2202
  # Clicks the Preview button and instantiates the PreviewBloggerPost Class.
@@ -2534,9 +2538,9 @@ class NewTopic
2534
2538
  PreviewDiscussionTopic.new(@browser)
2535
2539
  end
2536
2540
 
2537
- # Enters the specified filename in the file field.
2538
- def filename1(filename)
2539
- frm.file_field(:name=>"file_0").set(File.expand_path(File.dirname(__FILE__)) + "/../../data/sakai-cle-test-api/" + filename)
2541
+ # Enters the specified filename in the file field. The path to the file can be entered as an optional second parameter
2542
+ def filename1(filename, filepath="")
2543
+ frm.file_field(:name=>"file_0").set(filepath + filename)
2540
2544
  end
2541
2545
 
2542
2546
  # Enters the specified filename in the file field.
@@ -2620,11 +2624,9 @@ class DiscussionsMyProfile
2620
2624
 
2621
2625
  # Enters the specified filename in the file field.
2622
2626
  #
2623
- # Note that the file should be inside the data/sakai-cle-test-api folder.
2624
- # The file or folder name used for the filename variable
2625
- # should not include a preceding / character.
2626
- def avatar=(filename)
2627
- frm.file_field(:name=>"avatar").set(File.expand_path(File.dirname(__FILE__)) + "/../../data/sakai-cle-test-api/" + filename)
2627
+ # The method takes the filepath as an optional second parameter.
2628
+ def avatar(filename, filepath="")
2629
+ frm.file_field(:name=>"avatar").set(filepath + filename)
2628
2630
  end
2629
2631
 
2630
2632
  in_frame(:index=>1) do |frame|
@@ -3448,8 +3450,8 @@ class GlossaryFileUpload
3448
3450
  # multiple times, but it assumes
3449
3451
  # that the add_another_file method is used
3450
3452
  # before it, every time except before the first time.
3451
- def file_to_upload=(file_name)
3452
- frm.file_field(:id, "content_#{@@filex}").set(File.expand_path(File.dirname(__FILE__)) + "/../../data/sakai-cle-test-api/" + file_name)
3453
+ def file_to_upload(file_name, file_path="")
3454
+ frm.file_field(:id, "content_#{@@filex}").set(file_path + file_name)
3453
3455
  @@filex+=1
3454
3456
  end
3455
3457
 
@@ -3774,10 +3776,9 @@ class LessonImportExport
3774
3776
  # the target file information, then clicks the import
3775
3777
  # button.
3776
3778
  #
3777
- # Note that it pulls the file from the
3778
- # data/sakai-cle-test-api folder.
3779
- def upload_IMS(file_name)
3780
- frm.file_field(:name, "impfile").set(File.expand_path(File.dirname(__FILE__)) + "/../../data/sakai-cle-test-api/" + file_name)
3779
+ # The file path is an optional parameter.
3780
+ def upload_IMS(file_name, file_path="")
3781
+ frm.file_field(:name, "impfile").set(file_path + file_name)
3781
3782
  frm.link(:id=>"importexportform:importModule").click
3782
3783
  frm.table(:id=>"AutoNumber1").div(:text=>"Processing...").wait_while_present
3783
3784
  end
@@ -5336,7 +5337,7 @@ class BuildTemplate
5336
5337
  end
5337
5338
 
5338
5339
  #
5339
- class PortfoliosUploadFiles
5340
+ class PortfoliosUploadFiles # TODO - This class is not DRY. Identical methods in multiple classes
5340
5341
 
5341
5342
  include PageObject
5342
5343
  include ToolsMenu
@@ -5347,8 +5348,8 @@ class PortfoliosUploadFiles
5347
5348
  # multiple times, but it assumes
5348
5349
  # that the add_another_file method is used
5349
5350
  # before it, every time except before the first time.
5350
- def file_to_upload=(file_name)
5351
- frm.file_field(:id, "content_#{@@filex}").set(File.expand_path(File.dirname(__FILE__)) + "/../../data/sakai-cle-test-api/" + file_name)
5351
+ def file_to_upload(file_name, file_path)
5352
+ frm.file_field(:id, "content_#{@@filex}").set(file_path + file_name)
5352
5353
  @@filex+=1
5353
5354
  end
5354
5355
 
@@ -5827,8 +5828,8 @@ class StylesUploadFiles
5827
5828
  # multiple times, but it assumes
5828
5829
  # that the add_another_file method is used
5829
5830
  # before it, every time except before the first time.
5830
- def file_to_upload=(file_name)
5831
- frm.file_field(:id, "content_#{@@filex}").set(File.expand_path(File.dirname(__FILE__)) + "/../../data/sakai-cle-test-api/" + file_name)
5831
+ def file_to_upload(file_name, file_path="")
5832
+ frm.file_field(:id, "content_#{@@filex}").set(file_path + file_name)
5832
5833
  @@filex+=1
5833
5834
  end
5834
5835
 
@@ -1,6 +1,6 @@
1
1
  spec = Gem::Specification.new do |s|
2
2
  s.name = 'sakai-cle-test-api'
3
- s.version = '0.0.4'
3
+ s.version = '0.0.5'
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("**/**/**")
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.4
4
+ version: 0.0.5
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-05-30 00:00:00.000000000 Z
12
+ date: 2012-06-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: page-object