Module: SendMessagePopUp

Includes:
PageObject
Defined in:
lib/sakai-oae-test-api/pop_up_dialogs.rb

Overview

The Email message fields in My Messages and the pop up dialog that appears when in the Worlds context (or when you click the little envelop icon in lists of People).

Instance Method Summary collapse

Methods included from PageObject

#method_missing, #name_li, #name_link

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class PageObject

Instance Method Details

#accept_join_requestObject

Clicks the link for accepting a join request inside a Manager’s join request email



1192
1193
1194
1195
1196
1197
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 1192

def accept_join_request
  self.link(:text=>/=joinrequests/).click
  # currently this opens a page in a new tab. So it's best not to use it.
  # UGLY!!!
  # TODO - Refactor this ugly method. They may change the behavior so that a new tab isn't opened
end

#body=(text) ⇒ Object

Enters the specified text string into the Body field.



1169
1170
1171
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 1169

def body=(text)
  body_element.set text
end

#body_elementObject

The “Body” text area element for the message.



1163
1164
1165
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 1163

def body_element
  current_div.textarea(:id=>"comp-body")
end

#dont_sendObject

Clicks the “Don’t send” button



1185
1186
1187
1188
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 1185

def dont_send
  current_div.button(:id=>"send_message_cancel").click
  self.linger_for_ajax(2)
end

#message_recipientsObject

Returns an array containing the listed message recipients



1126
1127
1128
1129
1130
1131
1132
1133
1134
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 1126

def message_recipients
  recipients = []
  self.lis(:id=>/as-selection-/).each do |li|
    string = li.text
    string.gsub!("×\n","")
    recipients << string
  end
  return recipients
end

#remove_recipient(name) ⇒ Object

Removes the recipient from the To list for the email by clicking on the item’s “x” button.



1121
1122
1123
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 1121

def remove_recipient(name)
  name_li(name).link(:text=>"×").click
end

#see_allObject

Clicks the “See all” element on the page.



1115
1116
1117
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 1115

def see_all
  see_all_element.click
end

#see_all_elementObject

The “See all” page element definition.



1110
1111
1112
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 1110

def see_all_element
  current_div.link(:id=>"inbox_back_to_messages")
end

#send_messageObject

Clicks the “Send message” button



1179
1180
1181
1182
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 1179

def send_message
  send_message_element.click
  self.wait_for_ajax
end

#send_message_elementObject

The “Send message” button element on the page.



1174
1175
1176
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 1174

def send_message_element
  current_div.button(:id=>"send_message")
end

#send_this_message_to=(name) ⇒ Object

Enters the specified text string into the “Send this message to” text box, then clicks The matching item in the results list box.



1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 1139

def send_this_message_to=(name)
  name.split("", 4).each do |letter|
    current_div.text_field(:id=>"sendmessage_to_autoSuggest", :class=>"as-input").focus
    current_div.text_field(:id=>"sendmessage_to_autoSuggest", :class=>"as-input").send_keys(letter)
    self.wait_until { self.div(:id=>"as-results-sendmessage_to_autoSuggest").visible? }
    if self.li(:text=>/#{Regexp.escape(name)}/, :id=>/as-result-item-\d+/).present?
      self.li(:text=>/#{Regexp.escape(name)}/, :id=>/as-result-item-\d+/).click
      break
    end
  end
end

#subject=(text) ⇒ Object

Enters the specified text string into the “Subject” field



1158
1159
1160
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 1158

def subject=(text)
  subject_element.set text
end

#subject_elementObject

The “Subject” text field page element definition.



1152
1153
1154
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 1152

def subject_element
  current_div.text_field(:id=>"comp-subject")
end