Module: AnnouncementsMethods

Defined in:
lib/kuali-sakai-common-lib/announcements.rb

Overview

The Announcements list page for a Site.

Instance Method Summary collapse

Instance Method Details

#addObject

Clicks the add button, instantiates the AddEditAnnouncements class.



9
10
11
12
13
# File 'lib/kuali-sakai-common-lib/announcements.rb', line 9

def add
  frm.div(:class=>"portletBody").link(:title=>"Add").click
  frm.frame(:id, "body___Frame").td(:id, "xEditingArea").frame(:index=>0).wait_until_present(60)
  AddEditAnnouncements.new(@browser)
end

#edit(subject) ⇒ Object

Edits the specified announcement in the list.

Parameters:

  • subject (String)

    the text of the announcement listing link.



17
18
19
20
# File 'lib/kuali-sakai-common-lib/announcements.rb', line 17

def edit(subject)
  frm.table(:class=>"listHier").row(:text=>/#{Regexp.escape(subject)}/).link(:text=>"Edit").click
  AddEditAnnouncements.new(@browser)
end

#for_column(subject) ⇒ Object

Returns the text of the “For” column for the specified announcement.

Parameters:

  • subject (String)

    the text of the announcement listing link.



45
46
47
# File 'lib/kuali-sakai-common-lib/announcements.rb', line 45

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.

Parameters:

  • subject (String)

    the text of the announcement listing link.

Returns:

  • (Boolean)


33
34
35
36
37
38
39
40
# File 'lib/kuali-sakai-common-lib/announcements.rb', line 33

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

#mergeObject

Clicks the Merge link and instantiates the AnnouncementsMerge class.



63
64
65
66
# File 'lib/kuali-sakai-common-lib/announcements.rb', line 63

def merge
  frm.link(:text=>"Merge").click
  AnnouncementsMerge.new(@browser)
end

#preview_announcement(subject) ⇒ Object

Clicks the specified announcement link and instantiates the PreviewAnnouncements class.

Parameters:

  • subject (String)

    the text of the announcement listing link.



51
52
53
54
# File 'lib/kuali-sakai-common-lib/announcements.rb', line 51

def preview_announcement(subject)
  frm.link(:text=>subject).click
  PreviewAnnouncements.new(@browser)
end

#subjectsObject

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



24
25
26
27
28
29
# File 'lib/kuali-sakai-common-lib/announcements.rb', line 24

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.



58
59
60
# File 'lib/kuali-sakai-common-lib/announcements.rb', line 58

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