class TestDialerFromMessage(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) def test_dialer_from_message(self): # Send a SMS to the device _text_message_content = "Automated Test %s" % str(time.time()) # Open first received message self.messages = Messages(self.marionette) self.messages.launch() self.data_layer.send_sms(self.testvars['carrier']['phone_number'], _text_message_content) self.apps.switch_to_displayed_app() self.messages.wait_for_message_received(timeout=180) message_thread = self.messages.tap_first_received_message() # Check the phone number message_thread.tap_header() keypad = message_thread.tap_call() self.assertEquals(keypad.phone_number, self.testvars['carrier']['phone_number'])
class TestDialerFromMessage(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) def test_dialer_from_message(self): # Send a SMS to the device _text_message_content = "Automated Test %s" % str(time.time()) # Open first received message self.messages = Messages(self.marionette) self.messages.launch() self.data_layer.send_sms(self.environment.phone_numbers[0], _text_message_content) self.apps.switch_to_displayed_app() self.messages.wait_for_message_received(timeout=180) # Sometimes tap is done on the notification instead of message header self.marionette.switch_to_frame() system = System(self.marionette) system.wait_for_notification_toaster_not_displayed() self.apps.switch_to_displayed_app() message_thread = self.messages.tap_first_received_message() # Check the phone number keypad = message_thread.tap_call() self.assertEquals(keypad.phone_number, self.environment.phone_numbers[0])
class TestDialerFromMessage(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) def test_dialer_from_message(self): # Send a SMS to the device _text_message_content = "Automated Test %s" % str(time.time()) # Open first received message self.messages = Messages(self.marionette) self.messages.launch() self.data_layer.send_sms(self.testvars["carrier"]["phone_number"], _text_message_content) self.apps.switch_to_displayed_app() self.messages.wait_for_message_received(timeout=180) # Sometimes tap is done on the notification instead of message header self.marionette.switch_to_frame() system = System(self.marionette) system.wait_for_notification_toaster_not_displayed() self.apps.switch_to_displayed_app() message_thread = self.messages.tap_first_received_message() # Check the phone number keypad = message_thread.tap_call() self.assertEquals(keypad.phone_number, self.testvars["carrier"]["phone_number"])
def test_sms_forward_sent_message(self): """ https://moztrap.mozilla.org/manage/case/11075/ """ # Launch the app messages = Messages(self.marionette) messages.launch() message_thread = messages.tap_first_received_message() sent_messages = len(message_thread.sent_messages) # Forward the last sent message last_sent_message = message_thread.sent_messages[-1] activities = last_sent_message.long_press_message() new_message = activities.tap_forward_message() # Check that the 'To' field is empty self.assertEqual(new_message.recipients[0].text, u'') # Check that the message field has the content we expect self.assertEqual(new_message.message, self._text_message_content) new_message.type_phone_number(self.testvars['plivo']['phone_number']) new_message.tap_send() # Wait for the message to be sent correctly self.wait_for_condition( lambda m: len(message_thread.sent_messages) > sent_messages) # Check that the last sent message has the content we expect self.assertEqual(message_thread.sent_messages[1].text, self._text_message_content)
def test_sms_notification_removed_when_sms_deleted(self): """ https://moztrap.mozilla.org/manage/case/8778/ """ _text_message_content = "Automated Test %s" % str(time.time()) messages = Messages(self.marionette) messages.launch() self.data_layer.send_sms(self.environment.phone_numbers[0], _text_message_content, skip_verification=True) system = System(self.marionette) # We will wait upto 300 seconds for the SMS to arrive due to network latency system.wait_for_notification_toaster_displayed(timeout=300) system.wait_for_notification_toaster_not_displayed() self.apps.switch_to_displayed_app() message_thread = messages.tap_first_received_message() Wait(self.marionette).until(lambda m: len(message_thread.received_messages) > 0) messages_number = len(message_thread.all_messages) last_received_message = message_thread.received_messages[-1] activities = last_received_message.long_press_message() activities.tap_delete_message() activities.confirm_delete_message() Wait(self.marionette).until(lambda m: len(message_thread.all_messages) == messages_number - 1) self.marionette.switch_to_frame() utility_tray = system.open_utility_tray() self.assertEqual(0, len(utility_tray.notifications))
def test_sms_forward_sent_message(self): """ https://moztrap.mozilla.org/manage/case/11075/ """ # Launch the app messages = Messages(self.marionette) messages.launch() message_thread = messages.tap_first_received_message() sent_messages = len(message_thread.sent_messages) # Forward the last sent message last_sent_message = message_thread.sent_messages[-1] activities = last_sent_message.long_press_message() new_message = activities.tap_forward_message() # Check that the 'To' field is empty self.assertEqual(new_message.recipients[0].text, u'') # Check that the message field has the content we expect self.assertEqual(new_message.message, self._text_message_content) new_message.type_phone_number(self.testvars['plivo']['phone_number']) new_message.tap_send() # Wait for the message to be sent correctly self.wait_for_condition(lambda m: len(message_thread.sent_messages) > sent_messages) # Check that the last sent message has the content we expect self.assertEqual(message_thread.sent_messages[1].text, self._text_message_content)
class TestDialerFromMessage(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) def test_dialer_from_message(self): # Send a SMS to the device _text_message_content = "Automated Test %s" % str(time.time()) # Open first received message self.messages = Messages(self.marionette) self.messages.launch() self.data_layer.send_sms(self.testvars['carrier']['phone_number'], _text_message_content) self.apps.switch_to_displayed_app() self.messages.wait_for_message_received(timeout=180) message_thread = self.messages.tap_first_received_message() # Check the phone number message_thread.tap_header() keypad = message_thread.tap_call() self.assertEquals(keypad.phone_number, self.testvars['carrier']['phone_number'])
def test_sms_notification_removed_when_sms_deleted(self): """ https://moztrap.mozilla.org/manage/case/8778/ """ _text_message_content = "Automated Test %s" % str(time.time()) # launch messages app messages = Messages(self.marionette) messages.launch() # Send a SMS to the device self.data_layer.send_sms(self.environment.phone_numbers[0], _text_message_content, skip_verification=True) system = System(self.marionette) # We will wait upto 300 seconds for the SMS to arrive due to network latency system.wait_for_notification_toaster_displayed( timeout=300, message="Notification did not appear. SMS database dump: %s " % self.data_layer.get_all_sms()) system.wait_for_notification_toaster_not_displayed() self.apps.switch_to_displayed_app() # Tap on the latest received SMS message_thread = messages.tap_first_received_message() Wait(self.marionette).until( lambda m: len(message_thread.received_messages) > 0) messages_number = len(message_thread.all_messages) last_received_message = message_thread.received_messages[-1] # Delete latest received SMS activities = last_received_message.long_press_message() activities.tap_delete_message() activities.confirm_delete_message() Wait(self.marionette).until( lambda m: len(message_thread.all_messages) == messages_number - 1) self.marionette.switch_to_frame() # Check that SMS notification no longer appears in utility tray utility_tray = system.open_utility_tray() self.assertEqual(0, len(utility_tray.notifications))
class TestSmsCreateContact(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) _text_message_content = "Automated Test %s" % str(time.time()) self.data_layer.send_sms(self.testvars['carrier']['phone_number'], _text_message_content) self.messages = Messages(self.marionette) self.messages.launch() def test_sms_create_new_contact(self): self.contact = MockContact() self.message_thread = self.messages.tap_first_received_message() self.message_thread.wait_for_received_messages() # Check that we received the correct message self.assertEqual(self.message_thread.header_text, self.testvars['carrier']['phone_number']) activities = self.message_thread.tap_header() # Create a new contact activities.tap_create_new_contact() # Populate new contact fields new_contact = NewContact(self.marionette) new_contact.type_given_name(self.contact['givenName']) new_contact.type_family_name(self.contact['familyName']) new_contact.type_email(self.contact['email']['value']) new_contact.type_street(self.contact['adr']['streetAddress']) new_contact.type_zip_code(self.contact['adr']['postalCode']) new_contact.type_city(self.contact['adr']['locality']) new_contact.type_country(self.contact['adr']['countryName']) new_contact.type_comment(self.contact['note']) new_contact.tap_done(return_contacts=False) self.messages.switch_to_messages_frame() self.wait_for_condition( lambda m: self.message_thread.header_text == self.contact['name']) contacts = Contacts(self.marionette) contacts.launch() contact_details = contacts.contacts[0].tap() self.assertEqual(contact_details.phone_numbers[0], self.testvars['carrier']['phone_number'])
class TestSmsAddToExistingContact(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.contact = MockContact() self.data_layer.insert_contact(self.contact) _text_message_content = "Automated Test %s" % str(time.time()) self.data_layer.send_sms(self.testvars['carrier']['phone_number'], _text_message_content) self.messages = Messages(self.marionette) self.messages.launch() def test_sms_add_number_to_existing_contact(self): # open the message thread screen self.message_thread = self.messages.tap_first_received_message() self.message_thread.wait_for_received_messages() # Check that we received the correct message self.assertEqual(self.message_thread.header_text, self.testvars['carrier']['phone_number']) activities = self.message_thread.tap_header() contacts = activities.tap_add_to_contact() contacts.wait_for_contacts(1) contacts.contacts[0].tap(return_details=False) edit_contact = EditContact(self.marionette) edit_contact.tap_update(return_details=False) self.messages.switch_to_messages_frame() self.wait_for_condition( lambda m: self.message_thread.header_text == self.contact['name']) contacts = Contacts(self.marionette) contacts.launch() contact_details = contacts.contacts[0].tap() self.assertEqual(contact_details.phone_numbers[1], self.testvars['carrier']['phone_number'])
class TestSmsCreateContact(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) _text_message_content = "Automated Test %s" % str(time.time()) self.data_layer.send_sms(self.testvars['carrier']['phone_number'], _text_message_content) self.messages = Messages(self.marionette) self.messages.launch() def test_sms_create_new_contact(self): self.contact = MockContact() self.message_thread = self.messages.tap_first_received_message() self.message_thread.wait_for_received_messages() # Check that we received the correct message self.assertEqual(self.message_thread.header_text, self.testvars['carrier']['phone_number']) activities = self.message_thread.tap_header() # Create a new contact activities.tap_create_new_contact() # Populate new contact fields new_contact = NewContact(self.marionette) new_contact.type_given_name(self.contact['givenName']) new_contact.type_family_name(self.contact['familyName']) new_contact.type_email(self.contact['email']['value']) new_contact.type_street(self.contact['adr']['streetAddress']) new_contact.type_zip_code(self.contact['adr']['postalCode']) new_contact.type_city(self.contact['adr']['locality']) new_contact.type_country(self.contact['adr']['countryName']) new_contact.type_comment(self.contact['note']) new_contact.tap_done(return_contacts=False) self.messages.switch_to_messages_frame() self.wait_for_condition(lambda m: self.message_thread.header_text == self.contact['name']) contacts = Contacts(self.marionette) contacts.launch() contact_details = contacts.contacts[0].tap() self.assertEqual(contact_details.phone_numbers[0], self.testvars['carrier']['phone_number'])
def test_sms_notification_removed_when_sms_deleted(self): """ https://moztrap.mozilla.org/manage/case/8778/ """ _text_message_content = "Automated Test %s" % str(time.time()) # launch messages app messages = Messages(self.marionette) messages.launch() # Send a SMS to the device self.data_layer.send_sms(self.testvars["local_phone_numbers"][0], _text_message_content) system = System(self.marionette) # We will wait upto 300 seconds for the SMS to arrive due to network latency system.wait_for_notification_toaster_displayed( timeout=300, message="Notification did not appear. SMS database dump: %s " % self.data_layer.get_all_sms() ) system.wait_for_notification_toaster_not_displayed() self.apps.switch_to_displayed_app() # Tap on the latest received SMS message_thread = messages.tap_first_received_message() Wait(self.marionette).until(lambda m: len(message_thread.received_messages) > 0) messages_number = len(message_thread.all_messages) last_received_message = message_thread.received_messages[-1] # Delete latest received SMS activities = last_received_message.long_press_message() activities.tap_delete_message() activities.confirm_delete_message() Wait(self.marionette).until(lambda m: len(message_thread.all_messages) == messages_number - 1) self.marionette.switch_to_frame() # Check that SMS notification no longer appears in utility tray utility_tray = system.open_utility_tray() self.assertEqual(0, len(utility_tray.notifications))
class TestSmsAddToExistingContact(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.contact = MockContact() self.data_layer.insert_contact(self.contact) _text_message_content = "Automated Test %s" % str(time.time()) self.data_layer.send_sms(self.testvars['carrier']['phone_number'], _text_message_content) self.messages = Messages(self.marionette) self.messages.launch() def test_sms_add_number_to_existing_contact(self): # open the message thread screen self.message_thread = self.messages.tap_first_received_message() self.message_thread.wait_for_received_messages() # Check that we received the correct message self.assertEqual(self.message_thread.header_text, self.testvars['carrier']['phone_number']) activities = self.message_thread.tap_header() contacts = activities.tap_add_to_contact() contacts.wait_for_contacts(1) contacts.contacts[0].tap(return_details=False) edit_contact = EditContact(self.marionette) edit_contact.tap_update(return_details=False) self.messages.switch_to_messages_frame() self.wait_for_condition(lambda m: self.message_thread.header_text == self.contact['name']) contacts = Contacts(self.marionette) contacts.launch() contact_details = contacts.contacts[0].tap() self.assertEqual(contact_details.phone_numbers[1], self.testvars['carrier']['phone_number'])