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)

        # 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'])
Exemple #3
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.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])
    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)
Exemple #5
0
    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)
Exemple #6
0
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)
    def test_sms_send(self):
        """
        https://moztrap.mozilla.org/manage/case/10743/
        """
        messages = Messages(self.marionette)
        messages.launch()

        new_message = messages.create_new_message(recipients=[self.environment.phone_numbers[0]],
                                                  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()

        self.message_thread = new_message.tap_send(timeout=300)
        self.message_thread.wait_for_received_messages(timeout=300)

        last_received_message = self.message_thread.received_messages[-1]
        last_message = self.message_thread.all_messages[-1]

        self.assertEqual(self._text_message_content, last_received_message.text.strip('\n').strip())
        self.assertEqual(last_received_message.id, last_message.id)
        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)

        # 2 pictures should be on the sd card:
        # One is the picture we sent, the other is the one saved
        self.assertEqual(2, len(self.data_layer.picture_files))
Exemple #8
0
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)
        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)
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)
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)
Exemple #11
0
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/
        https://moztrap.mozilla.org/manage/case/1293/
        """
        _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)
Exemple #12
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)

        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'])
Exemple #13
0
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()

        contacts_app.contact(
            self.contact['givenName'][0]).tap(return_details=False)
        contacts_app.wait_for_contacts_frame_to_close()

        # Now switch to the displayed frame which should be Messages app
        self.marionette.switch_to_frame(self.apps.displayed_app.frame)

        self.assertIn(self.contact['givenName'][0],
                      new_message.first_recipient_name)
        self.assertEquals(self.contact['tel'][0]['value'],
                          new_message.first_recipient_number_attribute)

        new_message.type_message(_text_message_content)
        self.assertTrue(new_message.is_send_button_enabled)
Exemple #14
0
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()

        keyboard = new_message.tap_recipient_section()
        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)
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)
Exemple #16
0
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)
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:]
        },
                                   email=None)
        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)
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"])
Exemple #19
0
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)
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)
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)
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)
Exemple #23
0
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)
    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)
    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))
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)
Exemple #27
0
 def prepare_app(self):
     # launch the messages app and wait for the messages to be displayed,
     # the first launch after populating the data takes a long time.
     messages = Messages(self.device.marionette)
     messages.launch()
     Wait(
         self.device.marionette, 120, ignored_exceptions=(NoSuchElementException, ElementNotVisibleException)
     ).until(lambda m: m.find_element(By.CSS_SELECTOR, "#threads-container li").is_displayed())
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)
Exemple #29
0
 def test_settings_from_inbox(self):
     
     #launch the app
     messages = Messages(self.marionette)
     messages.launch()
     
     #tap settings icon
     messaging_settings = messages.tap_settings()
     
     self.assertTrue(messaging_settings.is_messaging_settings_displayed())
Exemple #30
0
 def prepare_app(self):
     # launch the messages app and wait for the messages to be displayed,
     # the first launch after populating the data takes a long time.
     messages = Messages(self.device.marionette)
     messages.launch()
     Wait(self.device.marionette,
          120,
          ignored_exceptions=(
              NoSuchElementException,
              ElementNotVisibleException)).until(lambda m: m.find_element(
                  By.CSS_SELECTOR, '#threads-container li').is_displayed())
    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())
    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()
Exemple #33
0
    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()
Exemple #34
0
    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())
    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))
    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))
    def test_sms_cropped_picture(self):
        """
        https://moztrap.mozilla.org/manage/case/10742/
        """

        messages = Messages(self.marionette)
        messages.launch()

        new_message = messages.create_new_message(recipients=[self.environment.phone_numbers[0]],
                                                  message=self._text_message_content)

        activities_list = new_message.tap_attachment()
        gallery = activities_list.tap_gallery()

        # go through the crop process
        gallery.wait_for_thumbnails_to_load()
        gallery.thumbnails[0].tap()
        from gaiatest.apps.gallery.regions.crop_view import CropView
        crop_view = CropView(self.marionette)

        # can't actually crop the element
        crop_view.tap_crop_done()

        # back to messages app frame
        new_message.wait_for_resizing_to_finish()

        attachment_options = new_message.tap_image_attachment()
        view_image = attachment_options.tap_view_button()

        self.assertTrue(view_image.is_image_visible)
        view_image.tap_back_button()

        self.message_thread = new_message.tap_send(timeout=300)
        self.message_thread.wait_for_received_messages(timeout=300)

        last_received_message = self.message_thread.received_messages[-1]
        last_message = self.message_thread.all_messages[-1]


        self.assertEqual(self._text_message_content, last_received_message.text.strip('\n').strip())
        self.assertEqual(last_received_message.id, last_message.id)
        self.assertTrue(last_message.has_attachments)


        view_image = last_message.tap_attachment()
        self.assertTrue(view_image.is_image_visible)
    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))
Exemple #39
0
    def test_sms_cropped_picture(self):
        """
        https://moztrap.mozilla.org/manage/case/10742/
        """

        messages = Messages(self.marionette)
        messages.launch()

        new_message = messages.create_new_message(
            recipients=[self.environment.phone_numbers[0]],
            message=self._text_message_content)

        activities_list = new_message.tap_attachment()
        gallery = activities_list.tap_gallery()

        # go through the crop process
        gallery.wait_for_thumbnails_to_load()
        gallery.thumbnails[0].tap()
        from gaiatest.apps.gallery.regions.crop_view import CropView
        crop_view = CropView(self.marionette)

        # can't actually crop the element
        crop_view.tap_crop_done()

        # back to messages app frame
        new_message.wait_for_resizing_to_finish()

        attachment_options = new_message.tap_image_attachment()
        view_image = attachment_options.tap_view_button()

        self.assertTrue(view_image.is_image_visible)
        view_image.tap_back_button()

        self.message_thread = new_message.tap_send(timeout=300)
        self.message_thread.wait_for_received_messages(timeout=300)

        last_received_message = self.message_thread.received_messages[-1]
        last_message = self.message_thread.all_messages[-1]

        self.assertEqual(self._text_message_content,
                         last_received_message.text.strip('\n').strip())
        self.assertEqual(last_received_message.id, last_message.id)
        self.assertTrue(last_message.has_attachments)

        view_image = last_message.tap_attachment()
        self.assertTrue(view_image.is_image_visible)
Exemple #40
0
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 TestSmsWithAttachments(GaiaTestCase):
    def test_sms_send(self):
        self.data_layer.connect_to_cell_data()
        _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)
        select_attachment = new_message.tap_attachment()
        camera = select_attachment.tap_camera()

        # switch frame to camera iframe
        camera.switch_to_camera_frame()

        camera.wait_for_camera_ready()
        camera.tap_capture()
        camera.wait_for_select_button_displayed()
        camera.tap_select_button()

        # switch back to messages app frame
        self.messages.switch_to_messages_frame()

        #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(_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)
Exemple #42
0
 def prepare_app(self):
     # launch the messages app and wait for the messages to be displayed,
     # the first launch after populating the data takes a long time.
     messages = Messages(self.device.marionette)
     messages.launch()
     end_time = time.time() + 120
     while time.time() < end_time:
         try:
             message = self.device.marionette.find_element(
                 By.CSS_SELECTOR, '#threads-container li')
             if message.is_displayed():
                 break
         except (NoSuchElementException, StaleElementException):
             pass
         time.sleep(0.5)
     else:
         raise TimeoutException('No messages displayed')
     self.device.gaiaApps.kill(messages.app)
Exemple #43
0
 def prepare_app(self):
     # launch the messages app and wait for the messages to be displayed,
     # the first launch after populating the data takes a long time.
     messages = Messages(self.device.marionette)
     messages.launch()
     end_time = time.time() + 120
     while time.time() < end_time:
         try:
             message = self.device.marionette.find_element(
                 By.CSS_SELECTOR, '#threads-container li')
             if message.is_displayed():
                 break
         except (NoSuchElementException, StaleElementException):
             pass
         time.sleep(0.5)
     else:
         raise TimeoutException('No messages displayed')
     self.device.gaiaApps.kill(messages.app)
Exemple #44
0
    def test_delete_threads(self):
        """ https://moztrap.mozilla.org/manage/case/15927/ """

        messages = Messages(self.marionette)
        messages.launch()

        new_message = messages.create_new_message(recipients=[self.environment.phone_numbers[0]],
                                                  message=self._generate_text())
        new_message.save_as_draft()
        self.assertGreaterEqual(len(messages.threads), 2)

        messages.enter_select_mode()
        for thread in messages.threads:
            thread.choose()

        messages.delete_selection()
        self.assertEqual(len(messages.threads), 0)
        self.assertFalse(messages.is_in_select_mode)
Exemple #45
0
class TestSmsReport(GaiaTestCase):

    def test_sms_report(self):
        
        time_test_began = time.time()
        _text_message_content = "Automated Test %s" % str(time_test_began)
        _test_phone_number = self.environment.phone_numbers[0]

        error_range_sent_in_seconds = 120
        error_range_received_in_seconds = 300
        
        # Sending the message
        self.messages = Messages(self.marionette)
        self.messages.launch()
        new_message = self.messages.create_new_message(recipients=_test_phone_number,
                                                       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]
        last_message = self.message_thread.all_messages[-1]
        
        report = last_received_message.open_report()

        # Checking that the data in the received report is correct
        self.assertTrue(report.is_message_an_sms)
        self.assertEqual(_test_phone_number, report.sender)

        date_sent_maximum_delay = time_test_began + error_range_sent_in_seconds 
        self.assertLessEqual(report.sent_date, date_sent_maximum_delay)

        date_received_maximum_delay = time_test_began + error_range_received_in_seconds
        self.assertLessEqual(report.received_date, date_received_maximum_delay)  

        report.close()

        last_sent_message = self.message_thread.sent_messages[0]
        report = last_sent_message.open_report()

        # Checking that the data in the sent report is correct
        self.assertTrue(report.is_message_an_sms)
        self.assertLessEqual(report.sent_date, date_sent_maximum_delay)
        self.assertEqual(_test_phone_number, report.receiver)
class TestSmsWithAttachments(GaiaTestCase):
    def test_sms_send(self):
        self.data_layer.connect_to_cell_data()
        _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)
        select_attachment = new_message.tap_attachment()
        camera = select_attachment.tap_camera()

        # switch frame to camera iframe
        camera.switch_to_camera_frame()

        camera.wait_for_camera_ready()
        camera.tap_capture()
        camera.wait_for_select_button_displayed()
        camera.tap_select_button()

        # switch back to messages app frame
        self.messages.switch_to_messages_frame()

        # 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(_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)
    def test_sms_auto_save_draft(self):
        """
        https://moztrap.mozilla.org/manage/case/7806/
        """
        _text_message_content = "Automated Test %s" % str(time.time())

        # launch messages app
        messages = Messages(self.marionette)
        messages.launch()

        # click new message
        new_message = messages.tap_create_new_message()

        self.marionette.switch_to_frame()
        Wait(self.marionette).until(
            lambda m: new_message.keyboard.is_keyboard_displayed)
        self.apps.switch_to_displayed_app()

        new_message.type_message(_text_message_content)
        self.assertEqual(new_message.message, _text_message_content)

        # close message app and leave cards view
        self.device.hold_home_button()
        from gaiatest.apps.system.regions.cards_view import CardsView
        cards_view = CardsView(self.marionette)
        cards_view.wait_for_cards_view()

        # wait for first app ready
        cards_view.wait_for_card_ready('sms')
        cards_view.close_app('sms')
        self.assertFalse(cards_view.is_app_present('sms'),
                         "Killed app not expected to appear in cards view")

        # wait for homescreen to be displayed
        self.wait_for_condition(
            lambda m: self.apps.displayed_app.name == Homescreen.name)

        # re-open messages app
        messages.launch()
        self.assertTrue(messages.draft_message[0].is_draft_icon_displayed)
        new_message = messages.draft_message[0].tap_draft_message()

        # check that last message draft is shown correctly
        self.assertEqual(new_message.message, _text_message_content)
Exemple #48
0
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'])
Exemple #50
0
    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))
Exemple #51
0
    def test_sms_auto_save_draft(self):
        """
        https://moztrap.mozilla.org/manage/case/7806/
        """
        _text_message_content = "Automated Test %s" % str(time.time())

        # launch messages app
        messages = Messages(self.marionette)
        messages.launch()

        # click new message
        new_message = messages.tap_create_new_message()

        self.marionette.switch_to_frame()
        Wait(self.marionette).until(
            lambda m: new_message.keyboard.is_keyboard_displayed)
        self.apps.switch_to_displayed_app()

        new_message.type_message(_text_message_content)
        self.assertEqual(new_message.message, _text_message_content)

        # close message app and leave cards view
        self.device.hold_home_button()

        cards_view = CardsView(self.marionette)
        cards_view.wait_for_cards_view()

        # wait for first app ready
        cards_view.cards[0].wait_for_centered()
        cards_view.cards[0].close()
        self.assertEqual(len(cards_view.cards), 0)

        # wait for homescreen to be displayed
        Homescreen(self.marionette).wait_to_be_displayed()

        # re-open messages app
        messages.launch()
        self.assertTrue(messages.draft_threads[0].is_draft_icon_displayed)
        new_message = messages.draft_threads[0].open()

        # check that last message draft is shown correctly
        self.assertEqual(new_message.message, _text_message_content)
    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.wait_for_camera_ready()
        camera.switch_to_camera_frame()
        camera.tap_capture()
        camera.wait_for_select_button_displayed()
        camera.tap_select_button()

        # switch back to messages app frame
        self.wait_for_condition(
            lambda m: self.apps.displayed_app.name == messages.name)
        self.apps.switch_to_displayed_app()
        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)
    def test_sms_auto_save_draft(self):
        """
        https://moztrap.mozilla.org/manage/case/7806/
        """
        _text_message_content = "Automated Test %s" % str(time.time())

        # launch messages app
        messages = Messages(self.marionette)
        messages.launch()

        # click new message
        new_message = messages.tap_create_new_message()

        self.marionette.switch_to_frame()
        Wait(self.marionette).until(lambda m: new_message.keyboard.is_keyboard_displayed)
        self.apps.switch_to_displayed_app()

        new_message.type_message(_text_message_content)
        self.assertEqual(new_message.message, _text_message_content)

        # close message app and leave cards view
        self.device.hold_home_button()
        from gaiatest.apps.system.regions.cards_view import CardsView
        cards_view = CardsView(self.marionette)
        cards_view.wait_for_cards_view()

        # wait for first app ready
        cards_view.wait_for_card_ready('sms')
        cards_view.close_app('sms')
        self.assertFalse(cards_view.is_app_present('sms'),
                         "Killed app not expected to appear in cards view")

        # wait for homescreen to be displayed
        Homescreen(self.marionette).wait_to_be_displayed()

        # re-open messages app
        messages.launch()
        self.assertTrue(messages.draft_threads[0].is_draft_icon_displayed)
        new_message = messages.draft_threads[0].open()

        # check that last message draft is shown correctly
        self.assertEqual(new_message.message, _text_message_content)
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'])
Exemple #55
0
    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.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)