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))
    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)
Exemplo n.º 3
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)
Exemplo n.º 4
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)
Exemplo n.º 5
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)
Exemplo n.º 6
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())

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

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

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

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

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

        self.assertEqual(_text_message_content, last_received_message.text)
        self.assertEqual(last_received_message.id, last_message.id)
Exemplo n.º 8
0
    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))