Class: ContentDetailsPage

Inherits:
Object
  • Object
show all
Includes:
DocButtons, GlobalMethods, HeaderFooterBar, LeftMenuBar, PageObject
Defined in:
lib/sakai-oae-test-api/page_classes.rb

Overview

Methods related to the Content Details page.

Instance Method Summary collapse

Methods included from LeftMenuBar

#add_new_area, #change_title_of, #delete_page, #expand, #menu_available?, #permissions_for_page, #public_pages, #view_profile_of_page

Methods included from PageObject

#method_missing, #name_li, #name_link

Methods included from DocButtons

#add_page, #edit_page, #page_revisions

Methods included from HeaderFooterBar

#acknowledgements, #add_collection, #add_content, #browse_footer, #browse_footer_link, #change_language, #change_location, #click_link, #explore_footer, #explore_footer_link, #login, #messages_container, #my_account, #sign_out, #sign_up, #toggle_collector, #user_agreement

Methods included from GlobalMethods

#close_notification, #menu_item, #open_page, #view_person

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class PageObject

Instance Method Details

#add_toObject

Clicks the “Add to…” button



156
157
158
159
# File 'lib/sakai-oae-test-api/page_classes.rb', line 156

def add_to
  add_to_button
  self.wait_for_ajax(2)
end

#add_to_libraryObject

Clicks on the “Add to library” button.



188
189
190
191
192
# File 'lib/sakai-oae-test-api/page_classes.rb', line 188

def add_to_library
  self.button(:text=>"Add to library").click
  self.wait_until { self.text.include? "Save to" }
  self.class.class_eval { include SaveContentPopUp }
end

#change_collaboratorsObject



118
119
120
# File 'lib/sakai-oae-test-api/page_classes.rb', line 118

def change_collaborators
  # TODO - Write method
end

#change_visibility_logged_inObject



102
103
104
# File 'lib/sakai-oae-test-api/page_classes.rb', line 102

def change_visibility_logged_in
       # TODO - Write method
end

#change_visibility_privateObject

Visibility…



98
99
100
# File 'lib/sakai-oae-test-api/page_classes.rb', line 98

def change_visibility_private
      # TODO - Write method
end

#change_visibility_publicObject



106
107
108
# File 'lib/sakai-oae-test-api/page_classes.rb', line 106

def change_visibility_public
     # TODO - Write method
end

#collaboration_shareObject

This method is currently not working TODO - Fix method def change_sharing

self.div(:class=>"entity_owns_actions_share has_counts ew_permissions").hover
self.div(:class=>"entity_owns_actions_share has_counts ew_permissions").click
self.execute_script(%|$('.entity_owns_actions_share.has_counts.ew_permissions').trigger("mouseover");|)
wait_for_ajax
self.div(:class=>"entity_owns_actions_share has_counts ew_permissions").button(:class=>"s3d-link-button ew_permissions").click 
self.class.class_eval { include ContentPermissionsPopUp }

end



132
133
134
135
136
# File 'lib/sakai-oae-test-api/page_classes.rb', line 132

def collaboration_share
  self.div(:id=>"entity_actions").button(:text=>"Share").click
  self.wait_until { self.text.include? "Who do you want to share with?" }
  self.class.class_eval { include ShareWithPopUp }
end

#commentObject

Clicks the Comments button



143
144
145
146
# File 'lib/sakai-oae-test-api/page_classes.rb', line 143

def comment
  comment_button
  self.wait_for_ajax(2)
end

#comment_text(text) ⇒ Object Also known as: comment_text=

Enters the specified text string into the Comment box.



149
150
151
152
# File 'lib/sakai-oae-test-api/page_classes.rb', line 149

def comment_text(text)
  comment_text_area_element.click
  comment_text_area_element.send_keys text
end

#descriptionObject

Returns the text of the description display span.



79
80
81
# File 'lib/sakai-oae-test-api/page_classes.rb', line 79

def description
  self.span(:id=>"contentmetadata_description_display").text
end

#description=(text) ⇒ Object

Enters the specified text into the description text area box. Note that this method first fires off the edit_description method because the description text area is not present by default.



86
87
88
89
# File 'lib/sakai-oae-test-api/page_classes.rb', line 86

def description=(text)
  edit_description
  self.text_area(:id=>"contentmetadata_description_description").set text
end

#edit_categoriesObject

Opens the Categories field for editing.



211
212
213
214
# File 'lib/sakai-oae-test-api/page_classes.rb', line 211

def edit_categories
  self.div(:id=>"contentmetadata_locations_container").fire_event "onclick"
  self.class.class_eval { include AddRemoveCategories }
end

Opens the Copyright field for editing.



206
207
208
# File 'lib/sakai-oae-test-api/page_classes.rb', line 206

def edit_copyright
  self.div(:id=>"contentmetadata_copyright_container").fire_event "onclick"
end

#edit_descriptionObject

Opens the description text field for editing.



195
196
197
198
# File 'lib/sakai-oae-test-api/page_classes.rb', line 195

def edit_description
  self.div(:id=>"contentmetadata_description_container").fire_event "onmouseover"
  self.div(:id=>"contentmetadata_description_container").fire_event "onclick"
end

#edit_tagsObject

Opens the tag field for editing.



201
202
203
# File 'lib/sakai-oae-test-api/page_classes.rb', line 201

def edit_tags
  self.div(:id=>"contentmetadata_tags_container").fire_event "onclick"
end

#first_commentObject

This method grabs all of the information about the first listed comment and returns it in a hash object. Relevant strings are put into the following keys: :poster, :date, :message. The delete button element is defined in the :delete_button key. Note that you’ll have to use Watir’s .click method to click the button.



255
256
257
258
259
260
261
262
263
264
# File 'lib/sakai-oae-test-api/page_classes.rb', line 255

def first_comment
  hash = {}
  comments_table = self.div(:class=>"contentcommentsTable")
  last_message = comments_table.div(:class=>"contentcomments_comment last")
  hash.store(:poster, last_message.span(:class=>"contentcomments_posterDataName s3d-regular-links").link.text)
  hash.store(:date, last_message.span(:class=>"contentcomments_dateComment").text)
  hash.store(:message, last_message.div(:class=>"contentcomments_message").text)
  hash.store(:delete_button, last_message.button(:id=>/contentcomments_delete_\d+/))
  return hash
end

#last_commentObject

This method grabs all of the information about the last listed comment and returns it in a hash object. Relevant strings are put into the following keys: :poster, :date, :message. The delete button element is defined in the :delete_button key. Note that you’ll have to use Watir’s .click method to click the button.



239
240
241
242
243
244
245
246
247
248
# File 'lib/sakai-oae-test-api/page_classes.rb', line 239

def last_comment
  hash = {}
  comments_table = self.div(:class=>"contentcommentsTable")
  last_message = comments_table.div(:class=>"contentcomments_comment last")
  hash.store(:poster, last_message.span(:class=>"contentcomments_posterDataName s3d-regular-links").link.text)
  hash.store(:date, last_message.span(:class=>"contentcomments_dateComment").text)
  hash.store(:message, last_message.div(:class=>"contentcomments_message").text)
  hash.store(:delete_button, last_message.button(:id=>/contentcomments_delete_\d+/))
  return hash
end

#permissionsObject

Clicks “Permissions” in the menu…



162
163
164
165
166
167
168
# File 'lib/sakai-oae-test-api/page_classes.rb', line 162

def permissions
  permissions_menu_button
  self.wait_for_ajax(2)
  permissions_button
  self.wait_for_ajax(2)
  self.class.class_eval { include ContentPermissionsPopUp }
end

Returns an array object containing the items displayed in “Related Content” on the page.



172
173
174
175
176
177
178
# File 'lib/sakai-oae-test-api/page_classes.rb', line 172

def related_content
  list = []
  self.div(:class=>"relatedcontent_list").links.each do |link|
    list << link.title
  end
  return list
end

#share_contentObject

Clicks on the “Share Content” button.



181
182
183
184
185
# File 'lib/sakai-oae-test-api/page_classes.rb', line 181

def share_content
  self.div(:id=>"entity_actions").span(:class=>"entity_share_content").click
  self.wait_until { @browser.text.include? "Who do you want to share with?" }
  self.class.class_eval { include ShareWithPopUp }
end

#share_with_othersObject

The “share” button next to the Download button.



226
227
228
229
230
# File 'lib/sakai-oae-test-api/page_classes.rb', line 226

def share_with_others
  self.share_button
  self.wait_for_ajax
  self.class.class_eval { include ShareWithPopUp }
end

#tags_and_categories_listObject

Returns an array containing the tags and categories listed on the page.



217
218
219
220
221
222
223
# File 'lib/sakai-oae-test-api/page_classes.rb', line 217

def tags_and_categories_list
  list =[]
  self.div(:id=>"contentmetadata_tags_container").links.each do |link|
    list << link.text
  end
  return list
end

#update_name=(new_name) ⇒ Object

Header row items…



92
93
94
95
# File 'lib/sakai-oae-test-api/page_classes.rb', line 92

def update_name=(new_name)
  name_element.click
  self.text_field(:id=>"entity_name_text").set new_name + "\n"
end

#view_collaboratorsObject



113
114
115
# File 'lib/sakai-oae-test-api/page_classes.rb', line 113

def view_collaborators
   # TODO - Write method
end