Class: Announcements
- Defined in:
- lib/sambal-cle/page_objects/announcements.rb
Overview
The Announcements list page for a Site.
Instance Method Summary collapse
-
#edit(subject) ⇒ Object
Edits the specified announcement in the list.
-
#for_column(subject) ⇒ Object
Returns the text of the “For” column for the specified announcement.
-
#has_attachment?(subject) ⇒ Boolean
Returns true or false depending on whether the specified announcement has an attachment.
- #href(subject) ⇒ Object
-
#preview_announcement(subject) ⇒ Object
Clicks the specified announcement link and instantiates the PreviewAnnouncements class.
-
#subjects ⇒ Object
Returns an array of the subject strings of the announcements listed on the page.
- #view(title) ⇒ Object
-
#view=(list_item) ⇒ Object
Selects the specified list item from the View selection list.
Methods inherited from BasePage
basic_page_elements, frame_element
Instance Method Details
#edit(subject) ⇒ Object
Edits the specified announcement in the list.
11 12 13 |
# File 'lib/sambal-cle/page_objects/announcements.rb', line 11 def edit(subject) frm.table(:class=>"listHier").row(:text=>/#{Regexp.escape(subject)}/).link(:text=>"Edit").click end |
#for_column(subject) ⇒ Object
Returns the text of the “For” column for the specified announcement.
46 47 48 |
# File 'lib/sambal-cle/page_objects/announcements.rb', line 46 def for_column(subject) frm.table(:class=>"listHier").row(:text=>/#{Regexp.escape(subject)}/)[4].text end |
#has_attachment?(subject) ⇒ Boolean
Returns true or false depending on whether the specified announcement has an attachment.
34 35 36 37 38 39 40 41 |
# File 'lib/sambal-cle/page_objects/announcements.rb', line 34 def (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 |
#href(subject) ⇒ Object
28 29 30 |
# File 'lib/sambal-cle/page_objects/announcements.rb', line 28 def href(subject) frm.link(:text=>subject).href end |
#preview_announcement(subject) ⇒ Object
Clicks the specified announcement link and instantiates the PreviewAnnouncements class.
52 53 54 |
# File 'lib/sambal-cle/page_objects/announcements.rb', line 52 def preview_announcement(subject) frm.link(:text=>subject).click end |
#subjects ⇒ Object
Returns an array of the subject strings of the announcements listed on the page.
21 22 23 24 25 26 |
# File 'lib/sambal-cle/page_objects/announcements.rb', line 21 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(title) ⇒ Object
15 16 17 |
# File 'lib/sambal-cle/page_objects/announcements.rb', line 15 def view(title) frm.link(:text=>title).click end |
#view=(list_item) ⇒ Object
Selects the specified list item from the View selection list.
58 59 60 |
# File 'lib/sambal-cle/page_objects/announcements.rb', line 58 def view=(list_item) frm.select(:id=>"view").set(list_item) end |