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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

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