Class: Announcements
- Defined in:
- lib/sakai-cle-test-api/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
Methods inherited from PageMaker
element, expected_element, expected_title, #initialize, #method_missing, page_url
Constructor Details
This class inherits a constructor from PageMaker
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class PageMaker
Instance Method Details
#edit(subject) ⇒ Object
Edits the specified announcement in the list.
11 12 13 |
# File 'lib/sakai-cle-test-api/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/sakai-cle-test-api/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/sakai-cle-test-api/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/sakai-cle-test-api/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 55 |
# File 'lib/sakai-cle-test-api/page_objects/announcements.rb', line 52 def preview_announcement(subject) frm.link(:text=>subject).click PreviewAnnouncements.new(@browser) 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/sakai-cle-test-api/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/sakai-cle-test-api/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.
59 60 61 |
# File 'lib/sakai-cle-test-api/page_objects/announcements.rb', line 59 def view=(list_item) frm.select(:id=>"view").set(list_item) end |