Class: ResourcesBase

Inherits:
BasePage
  • Object
show all
Defined in:
lib/sambal-cle/page_objects/resources.rb

Overview

This class consolidates the code that can be shared among all the File Upload and Attachment pages.

Not every method in this class will be appropriate for every attachment page.

Class Method Summary collapse

Methods inherited from BasePage

basic_page_elements, button, damballa, frame_element, link

Class Method Details

.resources_elementsObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/sambal-cle/page_objects/resources.rb', line 15

def resources_elements
  element(:files_table) { |b| b.frm.table(:class=>/listHier lines/) }

  # Use this as a means of checking if the file is visible or not
  action(:item) { |name, b| b.frm.link(:text=>name) }

  # Clicks the Select button next to the specified file.
  action(:select_file) { |filename, b| b.files_table.row(:text, /#{Regexp.escape(filename)}/).link(:text=>"Select").click }

  # Clicks the Remove button.
  action(:remove) { |b| b.frm.button(:value=>"Remove").click }

  # Clicks the remove link for the specified item in the attachment list.
  action(:remove_item) { |file_name, b| b.files_table.row(:text=>/#{Regexp.escape(file_name)}/).link(:href=>/doRemoveitem/).click }

  # Clicks the Move button.
  action(:move) { |b| b.frm.button(:value=>"Move").click }

  # Clicks the Show Other Sites link.
  action(:show_other_sites) { |b| b.frm.link(:text=>"Show other sites").click }

  action(:href) { |item, b| b.frm.link(:text=>item).href }

  # Clicks on the specified folder image, which
  # will open the folder tree and remain on the page.
  action(:open_folder) { |foldername, b| b.files_table.row(:text=>/#{Regexp.escape(foldername)}/).link(:title=>"Open this folder").click }

  # Clicks on the specified folder name, which should open
  # the folder contents on a refreshed page.
  action(:go_to_folder) { |foldername, b| b.frm.link(:text=>foldername).click }

  # Sets the URL field to the specified value.
  action(:url=) { |url_string, b| b.frm.text_field(:id=>"url").set(url_string) }

  # Clicks the Add button next to the URL field.
  action(:add) { |b| b.frm.button(:value=>"Add").click }

  # Gets the value of the access level cell for the specified
  # file.
  action(:access_level) { |filename, b| b.files_table.row(:text=>/#{Regexp.escape(filename)}/)[6].text }

  element(:upload_file_field) { |b| b.frm.file_field(:id=>"upload") }

end