Module: AddContentContainer

Includes:
PageObject
Defined in:
lib/sakai-oae-test-api/pop_up_dialogs.rb

Overview

Page objects in the Add content dialog box

Instance Method Summary collapse

Methods included from PageObject

#method_missing, #name_li, #name_link

Dynamic Method Handling

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

Instance Method Details

#addObject

Clicks the “Add” button that moves items into the “Collected Items” list.



330
331
332
333
334
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 330

def add
  active_content_div.button(:text=>"Add").click
  sleep 0.1
  self.wait_until { self.done_add_collected_button_element.enabled? }
end

#check_content(item) ⇒ Object Also known as: check_item, check_document

Checks the checkbox for the specified item.



357
358
359
360
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 357

def check_content(item)
  name_li(item).wait_until_present
  name_li(item).checkbox.set
end

#done_add_collectedObject

Clicks the “Done, add collected” button, then waits for the page to refresh and any ajax calls to complete.



377
378
379
380
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 377

def done_add_collected
  self.done_add_collected_button
  self.progress_indicator_element.wait_while_present
end

#remove(item) ⇒ Object

Removes the item from the selected list.



344
345
346
347
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 344

def remove(item)
  name_li(item).button(:title=>"Remove").click
  self.wait_for_ajax
end

#search_for_content=(text) ⇒ Object

Enters the specified text in the Search field. Note that the method appends a line feed on the string, so the search will happen immediately when it is invoked.



352
353
354
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 352

def search_for_content=(text)
  self.text_field(:class=>"newaddcontent_existingitems_search").set("#{text}\n")
end

#tags_and_categories=(text) ⇒ Object

Works to enter text into any of the “Tags and Categories” fields on the “Add Content” dialog.



338
339
340
341
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 338

def tags_and_categories=(text)
  active_content_div.text_field(:id=>/as-input-\d+/).set("#{text}\n")
  self.wait_for_ajax
end

#upload_file=(file_name, file_path = "") ⇒ Object

Enters the specified filename in the file field.

The method takes an optional file_path parameter. This allows the file_name parameter to be a variable distinct from the path containing the file.



370
371
372
373
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 370

def upload_file=(file_name, file_path="")
  self.file_field(:name=>"fileData").wait_until_present
  self.file_field(:name=>"fileData").set(file_path + file_name)
end