sakai-cle-test-api 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,12 @@ class AssignmentObject
4
4
  include Utilities
5
5
  include Workflows
6
6
 
7
- attr_accessor :title, :site, :instructions, :id, :link, :status
7
+ attr_accessor :title, :site, :instructions, :id, :link, :status, :grade_scale,
8
+ :max_points, :allow_resubmission, :num_resubmissions,
9
+ # Note the following variables are taken from the Entity picker's
10
+ # Item Info list
11
+ :retract_time, :time_due, :time_modified, :url, :portal_url,
12
+ :description, :time_created, :direct_url
8
13
 
9
14
  def initialize(browser, opts={})
10
15
  @browser = browser
@@ -18,7 +23,12 @@ class AssignmentObject
18
23
  @title=options[:title]
19
24
  @instructions=options[:instructions]
20
25
  @site=options[:site]
26
+ @grade_scale=options[:grade_scale]
27
+ @max_points=options[:max_points]
28
+ @allow_resubmission=options[:allow_resubmission]
29
+ @num_resubmissions=options[:num_resubmissions]
21
30
  raise "You must specify a Site for your Assignment" if @site==nil
31
+ raise "You must specify max points if your grade scale is 'points'" if @max_points==nil && @grade_scale=="Points"
22
32
  end
23
33
 
24
34
  alias :name :title
@@ -29,12 +39,16 @@ class AssignmentObject
29
39
  # Go to assignments page
30
40
  assignments unless @browser.title=~/Assignments$/
31
41
 
32
- on_page AssignmentsList do |page|
33
- page.add
42
+ on_page AssignmentsList do |list|
43
+ list.add
34
44
  end
35
45
  on_page AssignmentAdd do |add|
36
46
  add.title.set @title
37
47
  add.instructions=@instructions
48
+ add.grade_scale.select @grade_scale unless @grade_scale==nil
49
+ add.max_points.set @max_points unless @max_points==nil
50
+ add.allow_resubmission.send(@allow_resubmission) unless @allow_resubmission==nil
51
+ add.num_resubmissions.select @num_resubmissions unless @num_resubmissions==nil
38
52
  add.post
39
53
  end
40
54
  on_page AssignmentsList do |list|
@@ -63,12 +77,13 @@ class AssignmentObject
63
77
  end
64
78
  @title=opts[:title] unless opts[:title] == nil
65
79
  @instructions=opts[:instructions] unless opts[:instructions] == nil
80
+ @max_points=opts[:max_points] unless opts[:title] == nil
66
81
  on AssignmentsList do |list|
67
82
  @status=list.status_of @title
68
83
  end
69
84
  end
70
85
 
71
- def get_assignment_info
86
+ def get_info
72
87
  open_my_site_by_name @site unless @browser.title=~/#{@site}/
73
88
  assignments unless @browser.title=~/Assignments$/
74
89
  on AssignmentsList do |list|
@@ -81,10 +96,32 @@ class AssignmentObject
81
96
  list.edit_assignment @title
82
97
  end
83
98
  end
99
+
100
+ # TODO: Need to add more stuff here as needed...
101
+
84
102
  on AssignmentAdd do |edit|
85
- # TODO: Need to add more stuff here as needed...
103
+
86
104
  @instructions=edit.get_source_text edit.editor
105
+ edit.source edit.editor
106
+ edit.entity_picker(edit.editor)
107
+ end
108
+ on EntityPicker do |info|
109
+ info.view_assignment_details @title
110
+ @retract_time=info.retract_time
111
+ @time_due=info.time_due
112
+ @time_modified=info.time_modified
113
+ @url=info.url
114
+ @portal_url=info.portal_url
115
+ @description=info.description
116
+ @time_created=info.time_created
117
+ @direct_url=info.direct_link
118
+ info.close_picker
119
+ end
120
+ on AssignmentAdd do |edit|
121
+ edit.cancel
87
122
  end
88
123
  end
89
124
 
125
+
126
+
90
127
  end
@@ -0,0 +1,34 @@
1
+ class EntityPicker < BasePage
2
+
3
+ def view_assignment_details(title)
4
+ unless self.div(:class=>"title", :text=>title).present?
5
+ self.link(:text=>"Assignments").click
6
+ self.link(:text=>title).wait_until_present
7
+ self.link(:text=>title).click
8
+ end
9
+ self.div(:class=>"title", :text=>title).wait_until_present
10
+ end
11
+
12
+ def select_assignment(title)
13
+ view_assignment_details(title)
14
+ self.link(:text=>"Select this item").click
15
+ self.window(:index=>0).use
16
+ self.frame(:index=>2).button(:id=>"btnOk").click
17
+ end
18
+
19
+ def close_picker
20
+ self.window.close
21
+ self.window(:index=>0).use
22
+ self.frame(:index=>2).button(:id=>"btnCancel").click
23
+ end
24
+
25
+ value(:url) { |b| b.td(text: "url").parent.td(class: "attrValue").text }
26
+ value(:portal_url) { |b| b.td(text: "portalURL").parent.td(class: "attrValue").text }
27
+ value(:direct_link) { |b| b.link(text: "Select this item").href }
28
+ value(:retract_time) { |b| b.td(text: "Retract Time").parent.td(class: "attrValue").text }
29
+ value(:time_due) { |b| b.td(text: "Time Due").parent.td(class: "attrValue").text }
30
+ value(:time_modified) { |b| b.td(text: "Time Modified").parent.td(class: "attrValue").text }
31
+ value(:description) { |b| b.td(text: "Description").parent.td(class: "attrValue").text }
32
+ value(:time_created) { |b| b.td(text: "Time Created").parent.td(class: "attrValue").text }
33
+
34
+ end
@@ -14,14 +14,25 @@ module FCKEditor
14
14
 
15
15
  def enter_source_text(editor, text)
16
16
  source(editor)
17
- editor.text_field(:class=>"SourceField").wait_until_present
18
- editor.text_field(:class=>"SourceField").set text
17
+ source_field(editor).wait_until_present
18
+ source_field(editor).set text
19
19
  end
20
20
 
21
21
  def get_source_text(editor)
22
22
  source(editor)
23
- editor.text_field(:class=>"SourceField").wait_until_present
24
- editor.text_field(:class=>"SourceField").value
23
+ source_field(editor).wait_until_present
24
+ source_field(editor).value
25
+ end
26
+
27
+ def entity_picker(editor)
28
+ editor.div(:title=>"Sakai_Entity_Link").wait_until_present
29
+ editor.div(:title=>"Sakai_Entity_Link").click
30
+ @browser.frame(:index=>2).frame(:id=>"frmMain").button(:value=>"Browse Server").click
31
+ @browser.window(:url=>/sakai-entitybrowser-tool/).use
32
+ end
33
+
34
+ def source_field(editor)
35
+ editor.text_field(:class=>"SourceField")
25
36
  end
26
37
 
27
38
  end
@@ -1,6 +1,6 @@
1
1
  spec = Gem::Specification.new do |s|
2
2
  s.name = 'sakai-cle-test-api'
3
- s.version = '0.1.1'
3
+ s.version = '0.1.2'
4
4
  s.summary = %q{Sakai-CLE functional testing API for the rSmart Collaborative Learning Environment}
5
5
  s.description = %q{The Sakai-CLE 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.1.1
4
+ version: 0.1.2
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-24 00:00:00.000000000 Z
12
+ date: 2012-09-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: watir-webdriver
@@ -82,6 +82,7 @@ files:
82
82
  - lib/sakai-cle-test-api/page_objects/chat_room.rb
83
83
  - lib/sakai-cle-test-api/page_objects/drop_box.rb
84
84
  - lib/sakai-cle-test-api/page_objects/email_archive.rb
85
+ - lib/sakai-cle-test-api/page_objects/entity_picker.rb
85
86
  - lib/sakai-cle-test-api/page_objects/evaluations.rb
86
87
  - lib/sakai-cle-test-api/page_objects/feedback.rb
87
88
  - lib/sakai-cle-test-api/page_objects/forms.rb