Class: Announcements

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

Overview

The Announcements list page for a Site.

Instance Method Summary collapse

Methods inherited from BasePage

basic_page_elements, button, damballa, frame_element, link

Instance Method Details

#has_attachment?(subject) ⇒ Boolean

Returns true or false depending on whether the specified announcement has an attachment.

Parameters:

  • subject (String)

    the text of the announcement listing link.

Returns:

  • (Boolean)


28
29
30
31
32
33
34
35
# File 'lib/sambal-cle/page_objects/announcements.rb', line 28

def has_attachment?(subject)
  if frm.table(:class=>"listHier").row(:text=>/#{Regexp.escape(subject)}/).exist?
    return frm.table(:class=>"listHier").row(:text=>/#{Regexp.escape(subject)}/).image(:alt=>"attachment").exist?
  else
    puts "Can't find your target row. Your test is faulty."
    return false
  end
end

#subjectsObject

Returns an array of the subject strings of the announcements listed on the page.



17
18
19
20
21
22
# File 'lib/sambal-cle/page_objects/announcements.rb', line 17

def subjects
  links = frm.table(:class=>"listHier").links.find_all { |link| link.title=~/View announcement/ }
  subjects = []
  links.each { |link| subjects << link.text }
  return subjects
end

#view=(list_item) ⇒ Object

Selects the specified list item from the View selection list.

Parameters:

  • list_item (String)

    the text of the option in the selection list.



48
49
50
# File 'lib/sambal-cle/page_objects/announcements.rb', line 48

def view=(list_item)
  frm.select(:id=>"view").set(list_item)
end