Class: FolderList

Inherits:
BasePage show all
Defined in:
lib/sakai-cle-test-api/page_objects/messages.rb

Overview

Page for the Contents of a Custom Folder for Messages

Instance Method Summary collapse

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

#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



242
243
244
# File 'lib/sakai-cle-test-api/page_objects/messages.rb', line 242

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.



251
252
253
254
# File 'lib/sakai-cle-test-api/page_objects/messages.rb', line 251

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

#compose_messageObject



224
225
226
227
# File 'lib/sakai-cle-test-api/page_objects/messages.rb', line 224

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

#mark_readObject

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



268
269
270
271
# File 'lib/sakai-cle-test-api/page_objects/messages.rb', line 268

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

#messagesObject

Clicks the Messages link in the Breadcrumb bar at the top of the page, then instantiates the Messages class



260
261
262
263
# File 'lib/sakai-cle-test-api/page_objects/messages.rb', line 260

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

#moveObject



288
289
290
291
# File 'lib/sakai-cle-test-api/page_objects/messages.rb', line 288

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.



231
232
233
234
# File 'lib/sakai-cle-test-api/page_objects/messages.rb', line 231

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.



275
276
277
278
279
280
281
282
# File 'lib/sakai-cle-test-api/page_objects/messages.rb', line 275

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



284
285
286
# File 'lib/sakai-cle-test-api/page_objects/messages.rb', line 284

def unread_messages
  # TODO - Write this method
end