Module: MessagesReceivedListMethods

Includes:
PageObject
Defined in:
lib/kuali-sakai-common-lib/messages.rb

Overview

The page showing the list of received messages.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.page_elements(identifier) ⇒ Object



220
221
222
223
224
225
226
# File 'lib/kuali-sakai-common-lib/messages.rb', line 220

def self.page_elements(identifier)
  in_frame(identifier) do |frame|
    select_list(:view, :id=>"prefs_pvt_form:viewlist", :frame=>frame)
    link(:check_all, :text=>"Check All", :frame=>frame)
    link(:delete, :text=>"Delete", :frame=>frame)
  end
end

Instance Method Details

#alert_message_textObject

Grabs the text from the message box that appears after doing some action.

Use this method to simplify writing Test::Unit asserts



173
174
175
# File 'lib/kuali-sakai-common-lib/messages.rb', line 173

def alert_message_text
  frm.span(:class=>"success").text
end

#check_message(subject) ⇒ Object

Checks the checkbox for the specified message in the list.

Will throw an error if the specified subject is not present.



182
183
184
185
# File 'lib/kuali-sakai-common-lib/messages.rb', line 182

def check_message(subject)
  index=subjects.index(subject)
  frm.checkbox(:name=>"prefs_pvt_form:pvtmsgs:#{index}:_id122").set
end

#compose_messageObject



155
156
157
158
# File 'lib/kuali-sakai-common-lib/messages.rb', line 155

def compose_message
  frm.link(:text=>"Compose Message").click
  ComposeMessage.new(@browser)
end

#headerObject

Returns a string consisting of the content of the page header–or “breadcrumb”, as it’s called.



143
144
145
# File 'lib/kuali-sakai-common-lib/messages.rb', line 143

def header
  frm.div(:class=>"breadCrumb specialLink").text
end

#mark_readObject

Clicks the “Mark Read” link, then reinstantiates the class because the page partially refreshes.



190
191
192
193
# File 'lib/kuali-sakai-common-lib/messages.rb', line 190

def mark_read
  frm.link(:text=>"Mark Read").click
  MessagesReceivedList.new(@browser)
end

#messagesObject

Clicks the “Messages” breadcrumb link to return to the top level of Messages. Then instantiates the Messages class.



150
151
152
153
# File 'lib/kuali-sakai-common-lib/messages.rb', line 150

def messages
  frm.link(:text=>"Messages").click
  Messages.new(@browser)
end

#moveObject

Clicks the Move link, then instantiates the MoveMessageTo Class.



215
216
217
218
# File 'lib/kuali-sakai-common-lib/messages.rb', line 215

def move
  frm.link(:text, "Move").click
  MoveMessageTo.new(@browser)
end

#open_message(subject) ⇒ Object

Clicks on the specified message subject then instantiates the MessageView class.



162
163
164
165
# File 'lib/kuali-sakai-common-lib/messages.rb', line 162

def open_message(subject)
  frm.link(:text, /#{Regexp.escape(subject)}/).click
  MessageView.new(@browser)
end

#subjectsObject

Creates an array consisting of the message subject lines.



197
198
199
200
201
202
203
204
# File 'lib/kuali-sakai-common-lib/messages.rb', line 197

def subjects
  titles = []
  messages = frm.table(:id=>"prefs_pvt_form:pvtmsgs")
  1.upto(messages.rows.size-1) do |x|
    titles << messages.row(:index=>x).a.title
  end
  return titles
end

#unread_messagesObject

Returns an Array object containing the subjects of the displayed messages that are marked unread.



209
210
211
# File 'lib/kuali-sakai-common-lib/messages.rb', line 209

def unread_messages
  # TODO - Write this method
end