本文整理汇总了Python中gaiatest.apps.messages.app.Messages.tap_create_new_message方法的典型用法代码示例。如果您正苦于以下问题:Python Messages.tap_create_new_message方法的具体用法?Python Messages.tap_create_new_message怎么用?Python Messages.tap_create_new_message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gaiatest.apps.messages.app.Messages
的用法示例。
在下文中一共展示了Messages.tap_create_new_message方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestContactMatch
# 需要导入模块: from gaiatest.apps.messages.app import Messages [as 别名]
# 或者: from gaiatest.apps.messages.app.Messages import tap_create_new_message [as 别名]
class TestContactMatch(GaiaTestCase):
def test_contact_match(self):
# insert contact
self.contact = MockContact(
tel={'value': '555%s' % repr(time.time()).replace('.', '')[8:]})
self.data_layer.insert_contact(self.contact)
# launch Messages app
self.messages = Messages(self.marionette)
self.messages.launch()
new_message = self.messages.tap_create_new_message()
from gaiatest.apps.keyboard.app import Keyboard
keyboard = Keyboard(self.marionette)
keyboard.send(self.contact['name'])
keyboard.tap_enter()
# verify that contacts and tel number match
self.assertEqual(self.contact['name'],
new_message.first_recipient_name)
self.assertEqual(self.contact['tel']['value'],
new_message.first_recipient_number_attribute)
示例2: TestSMSContactInput
# 需要导入模块: from gaiatest.apps.messages.app import Messages [as 别名]
# 或者: from gaiatest.apps.messages.app.Messages import tap_create_new_message [as 别名]
class TestSMSContactInput(GaiaTestCase):
def test_sms_semicolon_completes_the_entered_recipient(self):
"""
https://moztrap.mozilla.org/manage/case/10925/
"""
self.messages = Messages(self.marionette)
self.messages.launch()
new_message = self.messages.tap_create_new_message()
from gaiatest.apps.keyboard.app import Keyboard
keyboard = Keyboard(self.marionette)
keyboard.send('074')
keyboard.send(';')
# Verify if recipient is valid and uneditable
self.assertNotIn('invalid', new_message.recipient_css_class)
self.assertTrue(new_message.is_recipient_name_editable == 'false')
keyboard.send('777')
keyboard.send(';')
self.assertEqual(new_message.number_of_recipients, 2)
new_message.tap_message()
self.assertEqual(new_message.number_of_recipients, 2)
self.marionette.switch_to_frame()
self.assertTrue(new_message.keyboard.is_keyboard_displayed)
示例3: TestSms
# 需要导入模块: from gaiatest.apps.messages.app import Messages [as 别名]
# 或者: from gaiatest.apps.messages.app.Messages import tap_create_new_message [as 别名]
class TestSms(GaiaTestCase):
def test_sms_send(self):
"""
This test sends a text message to itself. It waits for a reply message.
https://moztrap.mozilla.org/manage/case/1322/
"""
_text_message_content = "Automated Test %s" % str(time.time())
# launch the app
self.messages = Messages(self.marionette)
self.messages.launch()
# click new message
new_message = self.messages.tap_create_new_message()
new_message.type_phone_number(self.testvars['carrier']['phone_number'])
new_message.type_message(_text_message_content)
#click send
self.message_thread = new_message.tap_send()
self.message_thread.wait_for_received_messages()
# get the most recent listed and most recent received text message
last_received_message = self.message_thread.received_messages[-1]
last_message = self.message_thread.all_messages[-1]
# Check the most recent received message has the same text content
self.assertEqual(_text_message_content, last_received_message.text)
# Check that most recent message is also the most recent received message
self.assertEqual(last_received_message.id, last_message.id)
示例4: TestDialerFromMessage
# 需要导入模块: from gaiatest.apps.messages.app import Messages [as 别名]
# 或者: from gaiatest.apps.messages.app.Messages import tap_create_new_message [as 别名]
class TestDialerFromMessage(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
# Launch the SMS app
self.messages = Messages(self.marionette)
self.messages.launch()
def test_dialer_from_message(self):
# Send a SMS to the device
_text_message_content = "Automated Test %s" % str(time.time())
# Tap new message
new_message = self.messages.tap_create_new_message()
new_message.type_phone_number(self.testvars['carrier']['phone_number'])
new_message.type_message(_text_message_content)
# Tap send
self.message_thread = new_message.tap_send()
self.message_thread.tap_header()
keypad = self.message_thread.tap_call()
self.assertEquals(keypad.phone_number, self.testvars['carrier']['phone_number'])
示例5: test_sms_send
# 需要导入模块: from gaiatest.apps.messages.app import Messages [as 别名]
# 或者: from gaiatest.apps.messages.app.Messages import tap_create_new_message [as 别名]
def test_sms_send(self):
# launch the app
messages = Messages(self.marionette)
messages.launch()
# click new message
new_message = messages.tap_create_new_message()
new_message.type_phone_number(self.testvars['carrier']['phone_number'])
new_message.type_message(self._text_message_content)
activities_list = new_message.tap_attachment()
camera = activities_list.tap_camera()
camera.tap_capture()
camera.tap_select_button()
# back to messages app frame
new_message.wait_for_resizing_to_finish()
#click send
self.message_thread = new_message.tap_send(timeout=300)
self.message_thread.wait_for_received_messages(timeout=300)
# get the most recent listed and most recent received text message
last_received_message = self.message_thread.received_messages[-1]
last_message = self.message_thread.all_messages[-1]
# Check the most recent received message has the same text content
self.assertEqual(self._text_message_content, last_received_message.text.strip('\n').strip())
# Check that most recent message is also the most recent received message
self.assertEqual(last_received_message.id, last_message.id)
# Check that message has attachments
self.assertTrue(last_message.has_attachments)
示例6: TestSmsAddContact
# 需要导入模块: from gaiatest.apps.messages.app import Messages [as 别名]
# 或者: from gaiatest.apps.messages.app.Messages import tap_create_new_message [as 别名]
class TestSmsAddContact(GaiaTestCase):
def test_sms_add_contact(self):
""" Add a contact to a message. """
_text_message_content = "Automated Test %s" % str(time.time())
# insert contact
self.contact = MockContact(tel=[{
'type': ['Mobile'],
'value': "%s" % self.testvars['carrier']['phone_number']}])
self.data_layer.insert_contact(self.contact)
self.messages = Messages(self.marionette)
self.messages.launch()
new_message = self.messages.tap_create_new_message()
contacts_app = new_message.tap_add_recipient()
contacts_app.wait_for_contacts()
contacts_app.contact(self.contact['givenName'][0]).tap(return_details=False)
contacts_app.wait_for_contacts_frame_to_close()
self.messages.switch_to_messages_frame()
self.assertIn(self.contact['givenName'][0], new_message.first_recipient_name)
new_message.type_message(_text_message_content)
self.message_thread = new_message.tap_send()
self.message_thread.wait_for_received_messages()
last_received_message = self.message_thread.received_messages[-1]
self.assertEqual(_text_message_content, last_received_message.text)
示例7: TestContactValidation
# 需要导入模块: from gaiatest.apps.messages.app import Messages [as 别名]
# 或者: from gaiatest.apps.messages.app.Messages import tap_create_new_message [as 别名]
class TestContactValidation(GaiaTestCase):
def test_sms_contact_validation(self):
self.messages = Messages(self.marionette)
self.messages.launch()
new_message = self.messages.tap_create_new_message()
keyboard = new_message.tap_recipient_section()
keyboard.send('test_contact')
keyboard.tap_enter()
# Verify if recipient is invalid and uneditable
self.assertIn('attention', new_message.recipient_css_class)
self.assertTrue(new_message.is_recipient_name_editable == 'false')
new_message.tap_recipient_name()
self.assertTrue(new_message.is_recipient_name_editable == 'true')
# Type_message will tap in the field to focus it
new_message.type_message('This is a test message')
#TODO Wait for the javascript
time.sleep(1)
self.assertFalse(new_message.is_send_button_enabled)
示例8: TestSmsAddContact
# 需要导入模块: from gaiatest.apps.messages.app import Messages [as 别名]
# 或者: from gaiatest.apps.messages.app.Messages import tap_create_new_message [as 别名]
class TestSmsAddContact(GaiaTestCase):
def test_sms_add_contact(self):
""" Add a contact to a message. """
_text_message_content = "Automated Test %s" % str(time.time())
# insert contact
self.contact = MockContact(tel={
'type': 'Mobile',
'value': '555%s' % repr(time.time()).replace('.', '')[8:]})
self.data_layer.insert_contact(self.contact)
self.messages = Messages(self.marionette)
self.messages.launch()
new_message = self.messages.tap_create_new_message()
contacts_app = new_message.tap_add_recipient()
contacts_app.wait_for_contacts()
# After tap, don't return a class; fall back to the displayed frame which should be Messages app
contacts_app.contact(self.contact['givenName']).tap(return_class=None)
self.assertIn(self.contact['givenName'], new_message.first_recipient_name)
self.assertEquals(self.contact['tel']['value'], new_message.first_recipient_number_attribute)
new_message.type_message(_text_message_content)
self.assertTrue(new_message.is_send_button_enabled)
示例9: TestContactValidation
# 需要导入模块: from gaiatest.apps.messages.app import Messages [as 别名]
# 或者: from gaiatest.apps.messages.app.Messages import tap_create_new_message [as 别名]
class TestContactValidation(GaiaTestCase):
def test_sms_contact_validation(self):
self.messages = Messages(self.marionette)
self.messages.launch()
new_message = self.messages.tap_create_new_message()
from gaiatest.apps.keyboard.app import Keyboard
keyboard = Keyboard(self.marionette)
keyboard.send('test_contact')
keyboard.tap_enter()
# Verify if recipient is invalid and uneditable
self.assertIn('invalid', new_message.recipient_css_class)
self.assertTrue(new_message.is_recipient_name_editable == 'false')
new_message.tap_recipient_name()
self.assertTrue(new_message.is_recipient_name_editable == 'true')
# Type_message will tap in the field to focus it
new_message.type_message('Test message')
self.assertFalse(new_message.is_send_button_enabled)
示例10: TestContactValidation
# 需要导入模块: from gaiatest.apps.messages.app import Messages [as 别名]
# 或者: from gaiatest.apps.messages.app.Messages import tap_create_new_message [as 别名]
class TestContactValidation(GaiaTestCase):
def test_sms_contact_validation(self):
self.messages = Messages(self.marionette)
self.messages.launch()
new_message = self.messages.tap_create_new_message()
keyboard = new_message.tap_recipient_section()
keyboard.send('test_contact')
keyboard.tap_enter()
self.messages.switch_to_messages_frame()
# Verify if recipient is invalid and uneditable
self.assertIn('attention', new_message.recipient_css_class)
self.assertTrue(new_message.is_recipient_name_editable == 'false')
new_message.tap_recipient_name()
self.assertTrue(new_message.is_recipient_name_editable == 'true')
# extra step to place the cursor in the message field
new_message.tap_message_field()
new_message.type_message('This is a test message')
self.assertFalse(new_message.is_send_button_enabled)
示例11: TestEnduranceSmsSendReceive
# 需要导入模块: from gaiatest.apps.messages.app import Messages [as 别名]
# 或者: from gaiatest.apps.messages.app.Messages import tap_create_new_message [as 别名]
class TestEnduranceSmsSendReceive(GaiaEnduranceTestCase):
def setUp(self):
GaiaEnduranceTestCase.setUp(self)
# delete any existing SMS messages to start clean
self.data_layer.delete_all_sms()
# launch the app
self.messages = Messages(self.marionette)
self.messages.launch()
def test_endurance_sms_send_receive(self):
self.drive(test=self.sms_send_receive, app='messages')
def sms_send_receive(self):
# send a message to self, wait for it to arrive, back to main message list
# setup received sms callback
self.marionette.execute_async_script("""
SpecialPowers.setBoolPref("dom.sms.enabled", true);
SpecialPowers.addPermission("sms", true, document);
window.wrappedJSObject.gotEvent = false;
window.navigator.mozMobileMessage.onreceived = function onreceived(event) {
log("Received 'onreceived' smsmanager event");
window.wrappedJSObject.gotEvent = true;
};
marionetteScriptFinished(1);
""", special_powers=True)
# create new message
_text_message_content = "SMS %d of %d (send receive endurance test %s)" % (self.iteration, self.iterations, str(time.time()))
new_message = self.messages.tap_create_new_message()
new_message.type_phone_number(self.testvars['local_phone_numbers'][0])
new_message.type_message(_text_message_content)
# send
self.message_thread = new_message.tap_send()
# verify/wait for the webapi new message callback, give 5 minutes; probably
# received the new sms message by now anyway
self.marionette.set_script_timeout(300000);
self.marionette.execute_async_script("""
function ready() {
window.navigator.mozMobileMessage.onreceived = null;
SpecialPowers.removePermission("sms", document);
SpecialPowers.setBoolPref("dom.sms.enabled", false);
marionetteScriptFinished(1);
};
waitFor(ready, function() {
return(window.wrappedJSObject.gotEvent);
});
""", special_powers = True)
# go back to main message list for next rep
self.message_thread.tap_back_button()
# sleep between reps
time.sleep(30)
示例12: TestSms
# 需要导入模块: from gaiatest.apps.messages.app import Messages [as 别名]
# 或者: from gaiatest.apps.messages.app.Messages import tap_create_new_message [as 别名]
class TestSms(GaiaMtbfTestCase):
def test_sms_send(self):
"""This test sends a text message to itself. It waits for a reply message.
https://moztrap.mozilla.org/manage/case/1322/
"""
self._text_message_content = "Automated Test %s" % str(time.time())
self._last_message = ".message-list li"
self._unread = "#threads-container li"
# launch the app
self.launch_by_touch("sms")
self.apps.switch_to_displayed_app()
self.messages = Messages(self.marionette)
self.messages.wait_for_message_list()
# click new message
new_message = self.messages.tap_create_new_message()
new_message.type_phone_number(self.testvars['carrier']['phone_number'])
new_message.type_message(self._text_message_content)
#click send
self.message_thread = new_message.tap_send()
self.message_thread.tap_back_button()
last_thread = self.marionette.find_element(By.CSS_SELECTOR, self._unread)
self.wait_for_condition(self.wait_for_unread_thread, 23)
def tearDown(self):
if hasattr(self, "message_thread"):
self.apps.switch_to_displayed_app()
self.message_thread.tap_back_button()
GaiaMtbfTestCase.tearDown(self)
def wait_for_unread_thread(self, m):
self.apps.switch_to_displayed_app()
threads = m.find_elements(By.CSS_SELECTOR, self._unread)
last_thread = threads[0]
if "unread" in last_thread.get_attribute("class"):
last_thread.tap()
self.wait_for_element_displayed(*self.message_thread._all_messages_locator)
messages = (m.find_elements(By.CSS_SELECTOR, self._last_message))
last_message = messages[-1]
if self._text_message_content in last_message.text:
return True
return False
def wait_for_last_message(self, m):
self.apps.switch_to_displayed_app()
messages = m.find_elements(By.CSS_SELECTOR, self._last_message)
if len(messages) < 2:
return False
last_message = messages[-1]
if "incoming" in last_message.get_attribute("class") and self._text_message_content in last_message.find_element(By.CSS_SELECTOR, ".bubble p").text:
return True
return False
示例13: test_mms_add_subject
# 需要导入模块: from gaiatest.apps.messages.app import Messages [as 别名]
# 或者: from gaiatest.apps.messages.app.Messages import tap_create_new_message [as 别名]
def test_mms_add_subject(self):
#launch the app
messages = Messages(self.marionette)
messages.launch()
#click new message
new_message = messages.tap_create_new_message()
#tap options icon
activities = new_message.tap_options()
#tap add subject option
activities.tap_add_subject()
new_message.wait_for_subject_input_displayed()
示例14: test_settings_from_message
# 需要导入模块: from gaiatest.apps.messages.app import Messages [as 别名]
# 或者: from gaiatest.apps.messages.app.Messages import tap_create_new_message [as 别名]
def test_settings_from_message(self):
# launch the app
messages = Messages(self.marionette)
messages.launch()
# click new message
new_message = messages.tap_create_new_message()
# tap options icon
activities = new_message.tap_options()
# tap settings icon
messaging_settings = activities.tap_settings()
self.assertTrue(messaging_settings.is_messaging_settings_displayed())
示例15: test_sms_send
# 需要导入模块: from gaiatest.apps.messages.app import Messages [as 别名]
# 或者: from gaiatest.apps.messages.app.Messages import tap_create_new_message [as 别名]
def test_sms_send(self):
"""
https://moztrap.mozilla.org/manage/case/10743/
"""
# launch the app
messages = Messages(self.marionette)
messages.launch()
# click new message
new_message = messages.tap_create_new_message()
new_message.type_phone_number(self.environment.phone_numbers[0])
new_message.type_message(self._text_message_content)
activities_list = new_message.tap_attachment()
camera = activities_list.tap_camera()
camera.tap_capture()
camera.tap_select_button()
# back to messages app frame
new_message.wait_for_resizing_to_finish()
#click send
self.message_thread = new_message.tap_send(timeout=300)
self.message_thread.wait_for_received_messages(timeout=300)
# get the most recent listed and most recent received text message
last_received_message = self.message_thread.received_messages[-1]
last_message = self.message_thread.all_messages[-1]
# Check the most recent received message has the same text content
self.assertEqual(self._text_message_content, last_received_message.text.strip('\n').strip())
# Check that most recent message is also the most recent received message
self.assertEqual(last_received_message.id, last_message.id)
# Check that message has attachments
self.assertTrue(last_message.has_attachments)
view_image = last_message.tap_attachment()
view_image.tap_save_image()
self.assertIn('saved to Gallery', view_image.banner_message)
# Check that there are 2 picture on the sd card
# One is the picture we sent, the second is the one saved
self.assertEqual(2, len(self.data_layer.picture_files))