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



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

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.



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

def body=(text)
  body_element.set text
end

#body_elementObject

The “Body” text area element for the message.



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

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

#dont_sendObject

Clicks the “Don’t send” button



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

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



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

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.



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

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

#see_allObject

Clicks the “See all” element on the page.



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

def see_all
  see_all_element.click
end

#see_all_elementObject

The “See all” page element definition.



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

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

#send_messageObject

Clicks the “Send message” button



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

def send_message
  send_message_element.click
  self.wait_for_ajax
end

#send_message_elementObject

The “Send message” button element on the page.



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

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.



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

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



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

def subject=(text)
  subject_element.set text
end

#subject_elementObject

The “Subject” text field page element definition.



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

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