Class: Messages

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

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

#compose_messageObject

Clicks the Compose Message button, then instantiates the ComposeMessage class.



8
9
10
11
12
# File 'lib/sakai-cle-test-api/page_objects/messages.rb', line 8

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

#deletedObject



24
25
26
27
# File 'lib/sakai-cle-test-api/page_objects/messages.rb', line 24

def deleted
  frm.link(:text=>"Deleted").click
  MessagesDeletedList.new(@browser)
end

#draftObject



29
30
31
32
# File 'lib/sakai-cle-test-api/page_objects/messages.rb', line 29

def draft
  frm.link(:text=>"Draft").click
  MessagesDraftList.new(@browser)
end

#folder_settings(folder_name) ⇒ Object



73
74
75
76
# File 'lib/sakai-cle-test-api/page_objects/messages.rb', line 73

def folder_settings(folder_name)
  frm.table(:class=>"hierItemBlockWrapper").row(:text=>/#{Regexp.escape(folder_name)}/).link(:text=>"Folder Settings").click
  MessageFolderSettings.new(@browser)
end

#foldersObject

Gets all the folder names



66
67
68
69
70
71
# File 'lib/sakai-cle-test-api/page_objects/messages.rb', line 66

def folders
  links = frm.table(:class=>"hierItemBlockWrapper").links.find_all { |link| link.title != /Folder Settings/ }
  folders = []
  links.each { |link| folders << link.text }
  return folders
end

#new_folderObject



39
40
41
42
# File 'lib/sakai-cle-test-api/page_objects/messages.rb', line 39

def new_folder
  frm.link(:text=>"New Folder").click
  MessagesNewFolder.new(@browser)
end

#open_folder(foldername) ⇒ Object



34
35
36
37
# File 'lib/sakai-cle-test-api/page_objects/messages.rb', line 34

def open_folder(foldername)
  frm.link(:text=>foldername).click
  FolderList.new(@browser)
end

#receivedObject



14
15
16
17
# File 'lib/sakai-cle-test-api/page_objects/messages.rb', line 14

def received
  frm.link(:text=>"Received").click
  MessagesReceivedList.new(@browser)
end

#sentObject



19
20
21
22
# File 'lib/sakai-cle-test-api/page_objects/messages.rb', line 19

def sent
  frm.link(:text=>"Sent").click
  MessagesSentList.new(@browser)
end

#settingsObject



44
45
46
47
# File 'lib/sakai-cle-test-api/page_objects/messages.rb', line 44

def settings
  frm.link(:text=>"Settings").click
  MessagesSettings.new(@browser)
end

#total_messages_in_folder(folder_name) ⇒ Object

Gets the count of messages in the specified folder and returns it as a string



52
53
54
55
# File 'lib/sakai-cle-test-api/page_objects/messages.rb', line 52

def total_messages_in_folder(folder_name)
  frm.table(:id=>"msgForum:_id23:0:privateForums").row(:text=>/#{Regexp.escape(folder_name)}/).span(:class=>"textPanelFooter", :index=>0).text =~ /\d+/
  return $~.to_s
end

#unread_messages_in_folder(folder_name) ⇒ Object

Gets the count of unread messages in the specified folder and returns it as a string



60
61
62
63
# File 'lib/sakai-cle-test-api/page_objects/messages.rb', line 60

def unread_messages_in_folder(folder_name)
  frm.table(:id=>"msgForum:_id23:0:privateForums").row(:text=>/#{Regexp.escape(folder_name)}/).span(:text=>/unread/).text =~ /\d+/
  return $~.to_s
end